Skip to content
Discussion options

You must be logged in to vote

Iterate over the dictionary - there are 3 hierarchy levels: blocks, lines and spans.
For every span perform a page.insert_text(), taking the following argument values:

  • insertion point: span["origin"]
  • text: span["text"]
  • fontsize: span["size"]
  • fontname is a trickier thing:
    • if you can use one of the Base-14 fonts, Times-Roman, Helvetica, Courier. Watch for choosing the right font weight / style by inspecting the span["flags"] value.
    • re-using existing fonts is difficult if writing to a new file - save this for a time when you have more experience.
    • using file-based new fonts is also not straightforward: you must first insert the font to the page, assign a fontname to it, e.g. "F1", then use …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JorjMcKie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants