[xep-support] Re: XEP 4.23 NullPointerException

Alexey Gagarinov agagarinov at renderx.com
Fri Sep 1 17:49:47 PDT 2017

Hi Till,

> when using XEP 4.23 to create a PDF file with an additional PDF attachment, there is a 
> NullPointerException and the resulting PDF cannot be read.

It's a 'a1_attachment-1-page-3.pdf' that cause the NPE.

This PDF file is a TOC and contains links.
Each link itself is an annotations with a GoTo action (in terms of PDF Specification).
In more simple words: you click on the link and will be forwarded to some place on other page.

A PDF splitting software (iText in your case) correctly removes all objects from other pages, but keeps the 
"hanging" links.
By "hanging" I mean an indirect PDF object reference without the PDF object itself.
For example,

<</D[20 0 R/XYZ 52 715 0.0]/S/GoTo>>

  where 20 0 R is the indirect reference to another page, but the obj #20 (20 0 R) itself is absent in the 
PDF file.

In such a case XEP fails to create a PDF image.
And, in my opinion, it's the most reasonable behavior -- no PDF image when parsing of the PDF is failed.
Not with NPE, of course :) -- it's our fault, I will fix.

I believe it's worth to ping iText about removing "hanging" indirect objects for links (PDF Annots) during 
splitting a PDF file.

With best regards,
   Alexey Gagarinov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.renderx.com/pipermail/xep-support/attachments/20170902/b83817b3/attachment.html>

More information about the Xep-support mailing list