Closed fancycarp closed 3 years ago
Looks like Google Docs, Chrome and Mac OSX Preview has issue with this file as well. Are you sure that iTextSharp does not produce the corrupted PDF?
The last file looks fine Firefox and Edge on Windows and Firefox and Chrome on OSX. So the last screenshot shows defect on Chrome for Windows.
There are two issues: corrupted PDF ("Original PDF") and upstream Chrome defect ("With Annotation (Re-save by Reader CC)").
Upstream issue https://code.google.com/p/chromium/issues/detail?id=552080 (cc @Rob--W)
Making this issue only about corrupted PDF.
It's possible that iTextSharp produce corrupted PDF. I'm searching some tool to analyze corrupted PDF. But Adobe Reader CC and Foxit Reader still can render it ("With Annotation"). So I hope PDF js can do that too. ^^
I don't think the file ("With Annotation") is corrupted. Three PDF readers (Adobe Reader DC, Foxit Reader, PDF Exchange Viewer) can render it correctly.
This issue is that some annotations (line, circle and square) are not fully supported.
From console log
Warning: Unimplemented annotation type "FreeText", falling back to base annotation Warning: Unimplemented annotation type "Square", falling back to base annotation Warning: Unimplemented annotation type "Circle", falling back to base annotation Warning: Unimplemented annotation type "Line", falling back to base annotation
So PDF.js fallback to use base annotation implementation to render them, which means it is rendering those annotations use its AP
field (appearance stream). Most of the PDF reader/editor generates this filed by default. That's why resave the file using some reader will fixes the file. However because this field is optional, some PDF tool (iText) may generate the annotation without this field, then the fallback rendering no longer works.
Implement those annotations should be very easy, but may be blocked by #5218
The upstream bug (https://crbug.com/552080) has been fixed. This fix will be available in Chrome 49. Once Skia has rolled and a Canary update has been published, could you check whether the bug is fixed in Canary and close this bug if possible?
By using Chrome 49.0.2599.0 + PDF JS Extension (v1.1.527) on Windows 8.0
Opening the last file looks OK. The bug is fixed. With Annotation (Re-save by Reader CC) https://drive.google.com/file/d/0B-_5BgJGB33EaXl0MVVkMThBNzQ/view
But, actually, I hope PDF JS can render annotation in the third file With Annotation https://drive.google.com/file/d/0B-_5BgJGB33Ea2dQZnpUY2FvYkk/view
(the re-saved file is just my curious to know what happen when re-save) :
So, I request PDF JS team to do rendering default appearance stream like other PDF readers do. (mentioned by xlc). You have the plan to implement them, right?
i have a question.in this sample pdf.js shows annotations created in adobe acrobat.
but there is currently no way to get other details like comments, coordinates, right?
The problem with the WithComment.pdf
file is indeed that the annotations don't have appearance streams defined, so https://github.com/mozilla/pdf.js/issues/6564#issuecomment-157176620 is completely right. PDF.js now renders the square and circle annotations correctly after pull request #13031. Strangely, line annotations without appearance streams are also supported after pull request #13033, but this particular line annotation doesn't render. Free text annotations are not yet supported.
This is therefore largely a duplicate of #6810 aside from the line annotation issue.
Strangely, line annotations without appearance streams are also supported after pull request #13033, but this particular line annotation doesn't render.
My guess is that it's connected to, and/or caused by, the bogus entry /Rect = [0, 0, 0, 0]
since that causes the computed /BBox to be completely off. Perhaps it's possible to somehow use the /L entry (suitably transformed) as a stand-in for the /Rect in that case?
Yes. Adobe Reader changes the /Rect entry accordingly.
Closing since pull request #13106 fixed the line annotation too, so only the free text annotation is left which is tracked in #6810.
I merged the annotations from FDF file into PDF file using iTextSharp 5.5.0.0 and all annotations were not rendered. *Tested with pdfjs-1.1.366
Right screen is the expected result (Opened in Adobe Reader CC)
When I re-save file (with annotation) using Adobe Reader CC, annotations do appear in PDFJS like this
Please check the related sample files : Original PDF https://drive.google.com/file/d/0B-_5BgJGB33EX3BUbDBuQkI3Rlk/view
FDF File https://drive.google.com/file/d/0B-_5BgJGB33EM3JLT0NocDFDMFU/view
With Annotation https://drive.google.com/file/d/0B-_5BgJGB33Ea2dQZnpUY2FvYkk/view
With Annotation (Re-save by Reader CC) https://drive.google.com/file/d/0B-_5BgJGB33EaXl0MVVkMThBNzQ/view
Thank you