Re: method PdfCopy.fixTaggedStructure throws NullPointerException

"Pichtchikov, Alexandre" <[email protected]>
Newsgroups gmane.comp.java.lib.itext.general
Message-ID <A30CA919C96A5544977357131E6583EBA9CAC9E1@MSGMMKCCRB2WIN.DMN1.FMR.COM>
Thanks a lot for your help!

-----Original Message-----
From: Raf Hens [mailto:[email protected]] 
Sent: Wednesday, September 10, 2014 6:57 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws NullPointerException

On 13/08/2014 16:16, Pichtchikov, Alexandre wrote:
> Here is an example of tagged pdf I tried to use with iText.

Hi Alexandre,

Your tagged PDF seems fine.  The problem is that you're merging a tagged 
and untagged PDF.

In your appendPDF() method, you now use:
target.addPage(target.getImportedPage(source, i, true));

This is okay for the tagged PDF, but for the untagged it will try to 
preserve the structure which is not there.  A simple fix:
target.addPage(target.getImportedPage(source, i, source.isTagged()));


Alternatively, you can replace your appendPDF() method with 
PdfCopy.addDocument().  This method detects if the document is tagged or 
not.  In your code:
newPDF.addDocument(basePDF);
newPDF.addDocument(legendInformation);


Also, make sure you are creating tagged output.  In your code:
newPDF.setTagged();


Best regards,

Raf Hens
iText Software

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.