Thanks a lot for looking into this.
I tied to add third parameter to getImportedPage so it looks like this:
target.addPage( target.getImportedPage( source, i, true ) );
I am getting the following exception now:
Exception thrown
BadPdfFormatException: No StructTreeRoot found, this probably
isn't a tagged PDF document!(PdfStructTreeController.java:69)
Call stack
com.itextpdf.text.pdf.PdfStructTreeController.<init>(PdfStructTreeController.java:69)
com.itextpdf.text.pdf.PdfCopy.getImportedPage(PdfCopy.java:263)
com.fmr.fic.ai.service.PDFGenerationServicejClassImpl.appendPDF(PDFGenerationServicejClassImpl.java:877)
com.fmr.fic.ai.service.PDFGenerationServicejClassImpl.generateStatementsFromXML(PDFGenerationServicejClassImpl.java:588)
com.fmr.fic.ai.service.PDFGenerationServicejClassImpl.generateStatement(PDFGenerationServicejClassImpl.java:486)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
(124 more)
I checked PdfStructTreeController code, and have found that exception is thown
by this line of code:
if (!writer.isTagged())
throw new
BadPdfFormatException(MessageLocalization.getComposedMessage("no.structtreeroot.found"));
In my case, writer is my PdfCopy object, and I used newPDF.setTagged(). Is
something missing?
Thanks,
Alex
From: iText mailing list [mailto:i...@1t3xt.info]
Sent: Thursday, August 07, 2014 2:22 PM
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws
NullPointerException
On 8/7/2014 10:39 AM, Pichtchikov, Alexandre wrote:
target.addPage( target.getImportedPage( source, i ) );
This line is wrong, you should add the boolean value that tells iText to
preserve the structure.
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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