-
Notifications
You must be signed in to change notification settings - Fork 687
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
Error 135 in Acrobat Reader when reading Prawn generated PDFs #497
Comments
diveboard@dev:~$ pdf2ps logbook.pdf **** This file had errors that were repaired or ignored. |
I have the same issue. I am using prawn(0.12.0) and the rendered document works fine in preview and chrome, but in Acrobat Reader only the first two pages can be viewed with the following pages being all blank. I am not using templates or repeatable images. Acrobat Reader gives me this error: "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem." |
I found the solution to my problem. The method dash() breaks the pdf for acrobat reader. I redrew all lines with a solid line instead of dashed lines and all is well... Oh yeah... |
I had the same issue, and removing dash() solves the problem for me as well. |
I can confirm this is still an issue. Just ran into this today, and removing dash fixes the problem. |
Can someone post a minimal reproducing example that fails on 0.13.2? Once I have that I can re-open the ticket. A quick attempt to reproduce failed for me. |
Whoops, sorry about this. This isn't the same problem, or indeed any problem. I had set |
When you write |
Unfortunately, after blowing away gems and updating to 0.13.2 (when trying to make the first example), I can't replicate this bug. I think it was just a matter of an old gem.
|
@McPolemic Thanks for investigating! Still willing to re-open if others run into this problem on a recent release, the only reason we closed the ticket in the first place was due to inactivity and a lack of a code sample. |
The problem remains:
corrupts the file to Photoshop/Acrobat Reader (but not for OSX Preview). But:
works just fine. No warning, no exceptions. Prawn 1.0.0 And thanks for the awesome work. Prawn kicks ass! |
@rbrancher: Thanks. Time is very limited now so I don't know if/when I'll look into this myself. But if we can get a pull request together I could review that and possibly merge. Until that happens, additional research is welcome on this ticket as to figuring out the source of the problem. |
the problem might have something to do with Adobe Reader's float/precision support, for instance code that effectively looked something like this (using calculated numbers)... pdf.bounding_box [0, 19.1990551181102352072], width: 280.80000000000004134, height: 19.199055118110239047 do
pdf.text "hello"
end works fine in Chrome browser pdf reader but fails in Adobe Reader. Using .round(ndigits) on my values fixes the problem, with .round(20) being the breaking point for Adobe Reader in this example. |
Seems plausible. See this mailing list thread for additional context: If you want to try to patch the PdfObject method in PDF::Core, and look for places where we do add_content, we could probably fix this by rounding out to N decimal places (something like 4 places would probably be more than enough) |
I think we may want to consider a much higher resolution than 4 places, the newer retina displays have 401 pixels per inch making rounding differences possibly more apparent. I may be just being pedantic. |
@packetmonkey: PDF points are 1/72 inch. So rounding them to 4 decimal place gives us a precision of |
Yep, I forgot we are dealing in PDF points and not directly rendered to screen. It's like we are working on a PDF library or something. My bad. |
Here's what the "Developing With PDF" book from O'Reilly has to say on this topic:
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. |
Upon closer investigation, this issue does not have to do with float rounding (though I'll open a second ticket for that, because it needs to be fixed throughout Prawn) It has to do with the difference between This is what
And this is what
The latter is what the standard expects for setting dash to an unbroken line. We don't seem to document anywhere the idea that people ought to use Thoughts? |
See #780 for updates about the decimal rounding issue. |
That sounds good to me. The two options for not creating an erring PDF are to throw an exception on |
@McPolemic: That's what I'm thinking too. Unless there is a reasonable use case for |
Disallowed dash(0) in e65c244 |
Hi guys,
When I'm printing my dive logbook on Diveboard I get the following pdf : https://dl.dropboxusercontent.com/u/6774414/logbook%20%281%29.pdf
this is generated through prawn + prawn/fast_png
prawn (0.12.0)
pdf-reader (>= 0.9.0)
ttfunk (~> 1.0.2)
prawn-fast-png (0.2.3)
prawn
rmagick
As you can see in the screenshot, standard windows acrobat reader can't read it properly (chrome, osx preview and everything else I know never complained)
Any idea what's going on ?
thanks heaps for your help !
The text was updated successfully, but these errors were encountered: