method PdfCopy.fixTaggedStructure throws NullPointerException

"Pichtchikov, Alexandre" <[email protected]>
Newsgroups gmane.comp.java.lib.itext.general
Message-ID <A30CA919C96A5544977357131E6583EBA4700933@MSGMMKCCRB2WIN.DMN1.FMR.COM>
I am merging tagged pdf with untagged pdf. I am getting exception when I close Document object:
    NullPointerException(PdfCopy.java:890)

    Call stack
    com.itextpdf.text.pdf.PdfCopy.fixTaggedStructure(PdfCopy.java:890)
    com.itextpdf.text.pdf.PdfCopy.flushTaggedObjects(PdfCopy.java:866)
    com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:855)
    com.itextpdf.text.Document.close(Document.java:416)
    ......

Code:
        PdfReader basePDF = new PdfReader( byteArray );
        PdfReader legendInformation = new PdfReader( legendsStaticPDFs.get( language ) );

        boolean isBasePDFTagged = basePDF.isTagged();
        boolean islegendInformationTagged = legendInformation.isTagged();

        // Representation of the resultant, merged, PDF
        Document document = new Document( basePDF.getPageSize( 1 ) );

        // Wrap the target PDF in something concrete to facilitate adding pages
        ByteArrayOutputStream outputStreamNew = new ByteArrayOutputStream();
        PdfCopy newPDF = new PdfCopy( document, outputStreamNew );
        newPDF.setTagged();
        // Set the PDF language (Accessibility standards)
        newPDF.getExtraCatalog().put(PdfName.LANG,
            new PdfString( language.locale.getLanguage() ) );

        // Set the PDF document title (Accessibility standards)
        newPDF.getInfo().put(PdfName.TITLE, new PdfString(
                messageSourceAccessor.getMessage(
                        "statement.pdf.title." + language.locale.getLanguage() ) ) );

        document.open();
        appendPDF( newPDF, basePDF );
        //appendPDF( newPDF, legendInformation );
        document.close();

I checked this Merging Tagged PDF without ruining the tags<http://stackoverflow.com/questions/19839445/merging-tagged-pdf-without-ruining-the-tags>, and have found that it should be fixed, but it still exist at least in iText 5.5.2 I used. Is it any work around? Could PageName.PG be set manually? Thanks in advance.

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&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.