Broken PDF Annotations / Flattening Bookmark Links

220 views
Skip to first unread message

Chris at Newforma

unread,
Dec 22, 2014, 11:18:49 AM12/22/14
to pdfnet-w...@googlegroups.com
Hey guys,

This will be a two part question. 

We have a PDF file (see attached) that has some PDF annotations on it, and the annotations show up fine in the Web Viewer Demo on the PDFTron site. However, when we convert to XOD and load in the web viewer (v1.8) on our end, the web viewer code throws the following error.

So, the first question is, can you see anything about this PDF that requires special handling, or particular web viewer settings in order to correctly render out these annotations? The only annotation types on the PDF are call out, text, arrow and line.

The second question comes out of our current work around for this problem. It's not strictly required that the annotations be editable / selectable after they are loaded in. It's more important that they simply show up. So, to work around the issue we just call PDFDoc.FlattenAnnotations on the PDF file before we convert to XOD. That works well, however, we noticed that bookmark links are also flattened during this process. External HTTP links work fine. So, the second question is, is there a way to flatten annotations without losing the bookmark links? 

Thanks!

- Chris 
RFI_00132_-_Model_Sketch.pdf

Matt Parizeau

unread,
Dec 22, 2014, 5:40:58 PM12/22/14
to pdfnet-w...@googlegroups.com
Hi Chris,

There isn't anything in the document that jumps out at me that requires some special handling. If you could tell me the exact version number you're using then I may be able to investigate from the error message line numbers. You can find the version number by running readerControl.docViewer.version or search inside CoreControls.js for the string 1.8.0.

When you refer to bookmark links you're referring to the links that show up under the second tab of the default WebViewer? I tried converting a document with some bookmarks and the flatten annotation option but they still seem to be in the XOD file. Do you have an example file and the exact options you're using for conversion?

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Chris at Newforma

unread,
Jan 3, 2015, 2:27:03 PM1/3/15
to pdfnet-w...@googlegroups.com
Hey Matt,

Thanks for the reply. The exact version number we are using is: 1.8.0.26375

By bookmark links, I mean hyperlinks inside the document that jump to the bookmark location.

I'm going to try to create a simpler sample file that can reproduce the issue and send that along shortly.

Thanks!

Chris at Newforma

unread,
Jan 3, 2015, 3:22:38 PM1/3/15
to pdfnet-w...@googlegroups.com
Matt, 

I created a more simplistic test file (attached) which has only a single callout annotation, and nothing else. This is enough to cause the following errors. 



These line numbers are relative to 1.8.0.26375. The callout shows up for a brief second, which I believe is the low resolution image of the PDF page, and then immediately disappears when the high resolution version is drawn.

I will post an example file for the bookmark link shortly.

Thanks - Chris


On Monday, December 22, 2014 11:18:49 AM UTC-5, Chris at Newforma wrote:
CalloutOnly.pdf

Chris at Newforma

unread,
Jan 3, 2015, 3:58:12 PM1/3/15
to pdfnet-w...@googlegroups.com
Ok, sorry for all of the different posts, but I've attached an example PDF with Links. When we call PDFDoc.FlattenAnnotations() on a PDF, then convert that PDF to XOD, the page/bookmark links stop working. These are links created in Acrobat with the Link tool, and the broken one is set to perform the action of going to a page view.

Thanks - Chris

On Monday, December 22, 2014 11:18:49 AM UTC-5, Chris at Newforma wrote:
Hyperlink.pdf

Matt Parizeau

unread,
Jan 5, 2015, 1:56:30 PM1/5/15
to pdfnet-w...@googlegroups.com
Hi Chris,

Thanks for the test files! I believe I have solutions for both issues.

The first error is an issue with importing callout annotations in a certain format and was fixed in WebViewer 1.8.1. You can download this from the download page: https://www.pdftron.com/webviewer/download.html

For FlattenAnnotations it seems that this is the expected behavior because links are technically annotations. However, although this is a bit confusing, if you want to flatten all annotations except for links then you can use the following code:
PDFDoc doc = new PDFDoc("mydoc.pdf");
pdftron
.PDF.Convert.XODOutputOptions options = new pdftron.PDF.Convert.XODOutputOptions();
options
.SetAnnotationOutput(pdftron.PDF.Convert.XODOutputOptions.AnnotationOutputFlag.e_flatten);
pdftron
.PDF.Convert.ToXod(doc, "output.pdf", options);

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Elena Savenok

unread,
Jun 24, 2015, 1:23:58 PM6/24/15
to pdfnet-w...@googlegroups.com
Hi guys,
Have the similar problem with hyperlinks within the xod file.
After upgrading to the latest PDFNet library from 5.92, hyperlinks not work.

I applied converting with this option SetAnnotationOutput(pdftron.PDF.Convert.XODOutputOptions.AnnotationOutputFlag.e_flatten).
And I able view hyperlinks, if I open XOD like XPS (after changed extension).
But in client viewer the same XOD file doesn't work with hyperlinks.
We are using Silverlight viewer now, I downloaded the latest 1.8.2 xap reader control. But the same issue.

Possible someone resolved the same issue.
Thanks

Matt Bojey

unread,
Jun 24, 2015, 3:58:49 PM6/24/15
to pdfnet-w...@googlegroups.com
Hi,

Is there a reason you are still using the Silverlight version of the WebViewer?  Most of our customers have made this upgrade as Silverlight has some known issues(e.g. crashing) that Microsoft won't be fixing. The HTML5 viewer is supported from IE 9+ and all other major browsers so we highly recommend switching to it.

Elena Savenok

unread,
Jun 24, 2015, 4:44:50 PM6/24/15
to pdfnet-w...@googlegroups.com
Hi Matt,
yeah we are on our way to do this, in couple of sprint we switch to HTML5.
Actually I now trying to display the same document (generated by 6.4 version) with HTML5 Viewer. Text marked with blue border on click, but don't loop to specific place.
Generated XOD file with old library 5.92 - works good on both Silverlight and HTML5.

Matt Bojey

unread,
Jun 24, 2015, 7:14:44 PM6/24/15
to pdfnet-w...@googlegroups.com
Hi,

Unfortunately I cannot reproduce your issue.  Can you attach the file that you are trying to convert?  Can you also attach the XOD file that is generated by your conversion?

Thanks.

Elena Savenok

unread,
Jun 25, 2015, 12:30:06 PM6/25/15
to pdfnet-w...@googlegroups.com
Actually I was able to view this file with the latest version of HTML5 viewer. Hyperlinks there works.
But not with Silverlight, could you help me with this?
I used ReaderControl.XAP from 1.8.2 version and opened XOD as local file.

Thanks
sample-link_1.pdf
sample.xod

Matt Bojey

unread,
Jun 25, 2015, 8:23:13 PM6/25/15
to pdfnet-w...@googlegroups.com
Hi, 

We are able to see the same issue with these files.  Are there some specific features you are using from the new version of PDFNet?  It may be easiest for you to revert back to using the old version of the PDFNet library for the short time from now until you make the switch to the HTML5 version of WebViewer.

Elena Savenok

unread,
Jun 26, 2015, 12:41:30 PM6/26/15
to pdfnet-w...@googlegroups.com
I see, seems this is only one solution to downgrade PDFNet library version. We didn't use any specific features yet.
Thanks, Matt!
Reply all
Reply to author
Forward
0 new messages