Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit all PDF decimal numbers to four decimal places #9

Closed
practicingruby opened this issue Oct 5, 2014 · 2 comments
Closed

Limit all PDF decimal numbers to four decimal places #9

practicingruby opened this issue Oct 5, 2014 · 2 comments

Comments

@practicingruby
Copy link
Member

Here's what the "Developing With PDF" book from O'Reilly has to say on this topic:

While the term "real" is used in PDF to represent the object type, the actual implementation of a given viewer might use double, float, or even fixed point numbers. Since the implementations may differ, the number of decimal places of precision may also differ. It is therefore recommended for reliability and also for file size considerations to not write more than four decimal places

I looked this up in the PDF standard and it too said that it's common for "real" numbers to be implemented as fixed point values. In Appendix C, 5 decimal places is recommended as a maximum.

I think we will go with 4 to be a bit more conservative, but if that causes any problems we can try bumping it up to 5. But it's clear that beyond that we can expect trouble... even the standard tells us that.

@practicingruby
Copy link
Member Author

Since some PDF functionality is still directly implemented in Prawn, see the corresponding ticket here:
prawnpdf/prawn#780

Ideally we'll move all PDF functionality down into PDF::Core eventually, but it may be some time before that happens.

@practicingruby
Copy link
Member Author

#10 is the related pull request for this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant