Question on UserUnit handling #136
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've been trying to study the code of
img2pdf
a bit, and am surprised by the functionfind_scale()
to determine a UserUnit for oversized pages:(This was implemented with commit
a826939
)I was wondering why you are only using powers of 10? I've been skimming the PDF 1.7 Manual and am unable to find a statement that would require this. Table 30 on page 79 only says:
This makes me think that UserUnit may basically be any positive int or float, as far as the PDF reference is concerned. I'd like to know if there is a specific reason why you are using only powers of 10? Are there any PDF libraries or apps you know of which strictly require this condition?
Thanks!
As you can see from the commit, it wasn't me but @j_barlow who authored
a826939
.As far as my understanding goes you are correct: we could use any multiplier. I think there is a simple reason to choose powers of 10: it makes reading the PDF source (not the rendering) easier for a human because all numbers in the PDF format are expressed as base-10.
Is there any reason you ask?
What @josch wrote is correct in all respects.
Thanks for the clarification. I see it is useful to use powers of 10 so the original digits can be kept and only the comma shifts, that makes sense.
(The reason I ask is that I have some other code that deals with UserUnit, so I was wondering if it always has to be a power of 10.)
Thanks for bringing this up. In case you are not the last one to read the img2pdf source to make sense of how PDF works I recorded the result of this issue in a code comment
7c48bfb868
Great, thanks!