Quantcast

method PdfCopy.fixTaggedStructure throws NullPointerException

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
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, 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

info-2
On 8/6/2014 10:01 AM, Pichtchikov, Alexandre wrote:
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, 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.
It looks like NullPointerException(PdfCopy.java:890) is generated at this line:

HashMap<Integer, PdfIndirectReference> numTree = structureTreeRoot.getNumTree();//iText 5.5.2;PdfCopy.java:890

structureTreeRoot can be null in case the method getImportedPage(PdfReader, int, boolean) was used without keeping tagged structure (which would be wrong use of iText). Unfortunately, this code is hidden in your appendPDF() method so we can't check if you're doing something wrong or if there's really a problem inside iText.

The issue with a PG key has been fixed in iText 5.5.0.



------------------------------------------------------------------------------
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre

Hello,

Thanks a lot for the replay.

Yes, my bad, I should include appendPDF method from the beginning.

Here is the code :
     private static final void appendPDF( final PdfCopy target, final PdfReader source )

           throws BadPdfFormatException, IOException

     {

           final int pages = source.getNumberOfPages();

           for ( int i = 1; i <= pages; i++ )

           {

                target.addPage( target.getImportedPage( source, i ) );

           }

     }

 

 

Thank you,

Alexandre Pichtchikov

 

From: iText mailing list [mailto:[hidden email]]
Sent: Thursday, August 07, 2014 10:16 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws NullPointerException

 

On 8/6/2014 10:01 AM, Pichtchikov, Alexandre wrote:

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, 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.

It looks like NullPointerException(PdfCopy.java:890) is generated at this line:

HashMap<Integer, PdfIndirectReference> numTree = structureTreeRoot.getNumTree();//iText 5.5.2;PdfCopy.java:890

structureTreeRoot can be null in case the method getImportedPage(PdfReader, int, boolean) was used without keeping tagged structure (which would be wrong use of iText). Unfortunately, this code is hidden in your appendPDF() method so we can't check if you're doing something wrong or if there's really a problem inside iText.

The issue with a PG key has been fixed in iText 5.5.0.


------------------------------------------------------------------------------
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
In reply to this post by info-2

Hello,

Thanks a lot for the replay.

Yes, my bad, I should include appendPDF method from the beginning.

Here is the code :
     private static final void appendPDF( final PdfCopy target, final PdfReader source )

           throws BadPdfFormatException, IOException

     {

           final int pages = source.getNumberOfPages();

           for ( int i = 1; i <= pages; i++ )

           {

                target.addPage( target.getImportedPage( source, i ) );

           }

     }

 

 

                In addition to the information above, byteArray used to createbasePDF reader is creating from XML transformed using JClass:

 

                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

                {

                     JCDocument jcDocument =

                           new JCDocument(

                                outputStream,

                                JCPageTemplate.loadTemplates( new ByteArrayInputStream( templateXML ) ) );

 

                     JCPrinter printer = jcDocument.getPrinter();

                     if (printer instanceof JCPDFPrinter) {

                           // Add pdf tags for accessibility

                           JCPDFPrinter pdfPrinter = (JCPDFPrinter)printer;

                           pdfPrinter.setLogicallyStructured(true);

                     }

 

                     jcDocument.setXMLLoadProperties( loadProperties );

                     jcDocument.setUserObject( new StatementUserObject( statementConfig, language ) );

                     jcDocument.loadXML( new ByteArrayInputStream( transformedXML ) );

                     jcDocument.print();

                     byteArray = outputStream.toByteArray();

                }

 

Thank you,

Alexandre Pichtchikov

 

From: iText mailing list [[hidden email]]
Sent: Thursday, August 07, 2014 10:16 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws NullPointerException

 

On 8/6/2014 10:01 AM, Pichtchikov, Alexandre wrote:

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, 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.

It looks like NullPointerException(PdfCopy.java:890) is generated at this line:

HashMap<Integer, PdfIndirectReference> numTree = structureTreeRoot.getNumTree();//iText 5.5.2;PdfCopy.java:890

structureTreeRoot can be null in case the method getImportedPage(PdfReader, int, boolean) was used without keeping tagged structure (which would be wrong use of iText). Unfortunately, this code is hidden in your appendPDF() method so we can't check if you're doing something wrong or if there's really a problem inside iText.

The issue with a PG key has been fixed in iText 5.5.0.


------------------------------------------------------------------------------
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

info-2
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.

------------------------------------------------------------------------------
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
In reply to this post by Pichtchikov, Alexandre

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:[hidden email]]
Sent: Thursday, August 07, 2014 2:22 PM
To: [hidden email]
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

info-2
On 8/8/2014 7:47 AM, Pichtchikov, Alexandre wrote:
Is something missing?
Maybe the document you're trying to copy isn't a properly tagged PDF.

------------------------------------------------------------------------------
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre

Thanks a lot and sorry for the late replay.

What is the best way to check if my pdf tagged properly?

Thanks,

Alex

 

From: iText mailing list [mailto:[hidden email]]
Sent: Friday, August 08, 2014 11:43 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws NullPointerException

 

On 8/8/2014 7:47 AM, Pichtchikov, Alexandre wrote:

Is something missing?

Maybe the document you're trying to copy isn't a properly tagged PDF.


------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

info-2
On 8/12/2014 8:27 AM, Pichtchikov, Alexandre wrote:
What is the best way to check if my pdf tagged properly?

It takes a human to do that.
No machine can ever know if a PDF is properly tagged.
Compare the PDF/UA specification with the Matterhorn protocol for more info.

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[hidden email]
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
mkl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

mkl
Alexandre, Bruno,
iText mailing list wrote
On 8/12/2014 8:27 AM, Pichtchikov, Alexandre wrote:
> What is the best way to check if my pdf tagged properly?

It takes a human to do that.
No machine can ever know if a PDF is properly tagged.
Compare the PDF/UA specification with the Matterhorn protocol for more info.
@Bruno
While this certainly is true for a complete check, I assume Alexandre would be happy to have one check which would guarantee that the tagging will not give rise to the NullPointerException this thread is about.

@Alexandre
Have you checked whether a document causing that Exception in one case always does so? In that case an obvious check would be to try once.

regards,   Michael
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
In reply to this post by info-2

Ok, I got, thanks a lot.

 

From: iText mailing list [mailto:[hidden email]]
Sent: Wednesday, August 13, 2014 3:24 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws NullPointerException

 

On 8/12/2014 8:27 AM, Pichtchikov, Alexandre wrote:

What is the best way to check if my pdf tagged properly?


It takes a human to do that.
No machine can ever know if a PDF is properly tagged.
Compare the PDF/UA specification with the Matterhorn protocol for more info.


------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [SPAM] Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
In reply to this post by mkl
Thanks a lot for your response Michael,
Answer is yes, the document always throw this exception when I try to use tagging related methods (setTagged + getImportedPage( source, i , true))
Thanks, Alex

-----Original Message-----
From: mkl [mailto:[hidden email]]
Sent: Wednesday, August 13, 2014 6:06 AM
To: [hidden email]
Subject: [iText-questions] [SPAM] Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Alexandre, Bruno,

iText mailing list wrote
> On 8/12/2014 8:27 AM, Pichtchikov, Alexandre wrote:
>> What is the best way to check if my pdf tagged properly?
>
> It takes a human to do that.
> No machine can ever know if a PDF is properly tagged.
> Compare the PDF/UA specification with the Matterhorn protocol for more
> info.

@Bruno
While this certainly is true for a complete check, I assume Alexandre would
be happy to have one check which would guarantee that the tagging will not
give rise to the NullPointerException this thread is about.

@Alexandre
Have you checked whether a document causing that Exception in one case
always does so? In that case an obvious check would be to try once.

regards,   Michael



--
View this message in context: http://itext-general.2136553.n4.nabble.com/method-PdfCopy-fixTaggedStructure-throws-NullPointerException-tp4660201p4660230.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[hidden email]
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

------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

info-2
In reply to this post by Pichtchikov, Alexandre
On 8/13/2014 1:19 PM, Pichtchikov, Alexandre wrote:
Ok, I got, thanks a lot.
As Michael indicated, I misunderstood the question because I didn't look at the context.
Without you showing us the PDF that causes the problem (and a SSCCE), we can only guess about the nature of the problem.
For instance: the question you posted on August 7 showed that you didn't use iText correctly, which resulting in an obvious error.
(But I already answered that question, explaining what you did wrong.)


------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre

Thanks you for the answer. Can I send examples as attachment using the same email address?

 

From: iText mailing list [mailto:[hidden email]]
Sent: Wednesday, August 13, 2014 7:53 AM
To: [hidden email]
Subject: Re: [iText-questions] method PdfCopy.fixTaggedStructure throws NullPointerException

 

On 8/13/2014 1:19 PM, Pichtchikov, Alexandre wrote:

Ok, I got, thanks a lot.

As Michael indicated, I misunderstood the question because I didn't look at the context.
Without you showing us the PDF that causes the problem (and a SSCCE), we can only guess about the nature of the problem.
For instance: the question you posted on August 7 showed that you didn't use iText correctly, which resulting in an obvious error.
(But I already answered that question, explaining what you did wrong.)


------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[hidden email]
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
mkl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

mkl
Alexandre,
Pichtchikov, Alexandre wrote
Can I send examples as attachment using the same email address?
Yes, simply send them attached to an e-mail to the mailing list. Be aware, though, of the size restrictions many SMTP servers have. Sizes larger than 15 MB after encoding might be rejected.

Regards,   Michael
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [SPAM] Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
Hello Michael,
Here is an example of tagged pdf I tried to use with iText.
Thanks,
Alex

-----Original Message-----
From: mkl [mailto:[hidden email]]
Sent: Wednesday, August 13, 2014 10:01 AM
To: [hidden email]
Subject: [iText-questions] [SPAM] Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Alexandre,

Pichtchikov, Alexandre wrote
> Can I send examples as attachment using the same email address?

Yes, simply send them attached to an e-mail to the mailing list. Be aware,
though, of the size restrictions many SMTP servers have. Sizes larger than
15 MB after encoding might be rejected.

Regards,   Michael



--
View this message in context: http://itext-general.2136553.n4.nabble.com/method-PdfCopy-fixTaggedStructure-throws-NullPointerException-tp4660201p4660235.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[hidden email]
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

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[hidden email]
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

statement.output.pdf (56K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Raf Hens
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

Pichtchikov, Alexandre
Thanks a lot for your help!

-----Original Message-----
From: Raf Hens [mailto:[hidden email]]
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
[hidden email]
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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: method PdfCopy.fixTaggedStructure throws NullPointerException

gloriacarol
This post has NOT been accepted by the mailing list yet.
In reply to this post by Pichtchikov, Alexandre
[b]Top 5 Blu-ray Ripper for Mac programs Reviews 2014[/b]

[b]Top 1. [url=http://www.multipelife.com/bytecopy-mac]Pavtube ByteCopy for Mac[/url] - Excellent[/b]

[b]Price:[/b] $29.4
 
[img]http://open-mobile-share.com/wp-content/uploads/2014/06/blu-ray-to-fcp-with-multi-track.png[/img]
 
[b]The good[/b]: When it comes to ripping Blu-ray discs and DVDs with multi-tracks, Pavtube ByteCopy for Mac is top one on the market. Pavtube ByteCopy for Mac not noly well deserves its high reputation in bd/dvd decryption, intuitive interface, the ready-made profile, high quality and fast speed, but also perfectly perform recoding files from Blu-ray discs an standard DVDs into MKV/MP4/MOV/M4V video with certain video/audio codecs. If you want to rip a Blu-ray/DVD to MKV on Mac with multi audio tracks, subtitles, and chapter markers without quality loss, Pavtube ByteCopy for Mac would be your choice.

[b]The bad[/b]: A little more expensive but I think it is worthy of that! And I'm glad to see it has many specials recently.

[b]The bottom line[/b]: Backup BD/DVD to MKV without quality loss. Allow full preservation of all audio tracks, subtitles and chapter markers. Remove unwanted subs streams and audio tracks at will. Resumed subtitle output feature to Format menu to directly output *.srt subtitle.

[b]Editors' note[/b]: ByteCopy for Mac is intuitive and simple. The encoding to .mkv happens fast and the result is perfect.

Review:[url=http://media-playback.jimdo.com/2014/06/24/top-5-reasons-to-choose-bdmagic/]Top 5 Reasons to choose Pavtube BDMagic[/url]
 
What's New? H.265 is the codec of the future. Don't miss our New Year deals for this updated H.265/HEVC Converter! Is that all of its features? Of course Not! It also functions as a strong performer for ripping [url=http://www.multipelife.com/convert-blu-ray-to-h-265-hevc-mp4.html]Blu-ray[/url], [url=http://open-media-community.com/2014/12/29/convert-dvd-to-h-265-files/]DVD[/url] to H.265 MP4 for playback.
 
About ByteCopy Money-Saving Boundles:
[url=http://www.multipelife.com/special-offer#ByteCopy&Video-Converter-Ultimate]ByteCopy($42) + Video Converter Ultimate($65)[/url] = Only $79.9, Save $27.1
[url=http://www.multipelife.com/special-offer#ByteCopy&DVD-Creator]ByteCopy($42) + DVD Creater($35)[/url] = Only $44.9, Save $32.1
[url=http://www.multipelife.com/special-offer#ByteCopy&Vidpie]ByteCopy($42) + ChewTune($29)[/url] = Only $54.9, Save $16.1

[b]Top 2. [url=http://www.multipelife.com/bdmagic-mac]Pavtube BDMagic for Mac[/url] - Good[/b]
 
[b]Price:[/b] $34.3

[img]http://open-media-community.com/wp-content/uploads/2014/06/bdmagic-for-mac-1-1.png[/img]
 
[b]The good:[/b] You can import all kinds of Blu-ray and DVD sources: BDMV folder, physical DVD, Blu-ray ISO, VIDEO_TS folder, DVD ISO and IFO file, protected Blu-ray Disc and unprotected Blu-ray Disc. Using the "Full Disc Copy" feature, you can preserve the Blu-ray's original file structure, buakup Blu-ray disc to PC with one click. Using "Directly Copy" feature, you can [url=http://1080p-video-tool.blogspot.com/2014/04/make-copy-of-blu-ray-on-mac.html]backup Blu-ray/DVD main movie in original format(m2ts or vob) on Mac[/url] without quality loss.

[b]Pavtube BDMagic for Mac[/b], the [b]Best Blu-ray Ripper for Mac OS X 10.9 Mavericks[/b] software which makes blu-ray backup a matter of capturing a disc image and saving it on your hard drive. It has various profiles and formats, e.g. most mainstream output video formats like AVI, MP4, and WMV are all included in the format lists. Moreover, Pavtube programs support adding *.srt and *.ass subtitles into video and merge into one file for output.

Whether you prefer to back up your blu-ray collection with physical copies or with compatible formats for various devices, it leaves the choice up to you.

[b]What' more:[/b]

Added 3D profiles in Format menu. (Side-by-Side, Top-Bottom, or Anaglyph 3D in MKV/MP4/MOV/WMV/AVI)
Perfectly compatible with Mac OS X 10.9 Mavericks and 10.10 Yosemite
 
[b]The bad[/b]: It lets you trim a specific duration from a movie, but not allows you to split movie/divide a movie evenly into multiple segments.

[b]The bottom line[/b]: With decent decrypting capability, high quality video output and considerate backup solution and specific format templates for versatile PMP devices, Pavtube BDMagic for Mac ranks top on the Mac Blu-ray ripping application list.

[b]Editors' note[/b]: Pavtube provides excellent customer support service, including lifetime free upgrade of product and technical support. Users can contact the support staff via email for help and suggestion.

[b]Top 3. Leawo Blu-ray Ripper for Mac - Good[/b]

[b]Price:[/b] $44.95

[img]http://open-media-community.com/wp-content/uploads/2015/01/leawo-blu-ray-ripper-for-mac.jpg[/img]
 
[b]The good:[/b] Leawo Blu-ray Ripper for Mac comes with the popular feature to convert 2D to 3D. It can load multiple Blu-ray and DVD movies at a time. Leawo Blu-ray Ripper for Mac has stunning trim and crop feature- it trims movie more accurate and crops video more considerate than its competitors. If you have tons of movies waiting to rip and feel like having a Blu-ray Ripper queue them several movies for running overnight, Leawo is recommended.

[b]The bad:[/b] Not recognizing Blu-ray ISO or forced subtitle (if there is). There's no backup option for keeping original movie quality.

[b]The bottom line:[/b] Leawo Blu-ray Ripper for Mac is a nice tool for DVD and Blu-ray ripping.

[b]Editors' note:[/b] We noticed that audio quality is noticeably degraded when ripping Blu-ray with Leawo Blu-ray Ripper for Mac.

[b]Top 4. Xilisoft Blu-ray Ripper for Mac -Poor[/b]
 
[img]http://open-media-community.com/wp-content/uploads/2015/01/xillsoft-blu-ray-ripper-for-mac.jpg[/img]
 
[b]Price:[/b] $49.95

[b]The good:[/b] Xilisoft Blu-ray Ripper for Mac can convert both standard Blu-ray videos and 3D Blu-ray videos to SD and HD video formats such as MKV, AVI, WMV, TS, etc. And it can preserve 3D effects when your source is 3D Blu-ray movie.

[b]The bad:[/b] The app does not decrypt Blu-ray protections and requires AnyDVD HD to be installed in advance for Blu-ray ripping. DVD ripping is not supported.

[b]The bottom line:[/b] Xilisoft Blu-ray Ripper for Mac does not rip movies from Blu-ray Disc, but if you have had the Blu-ray cracked and saved onto computer hard drive, this tool would be helpful and useful for you to enjoy movies on iPod, iPhone, Apple TV, PSP, Xbox, Zune, NDS, Wii, and 3D smartphones.

[b]Editors' note:[/b] This tool is not recommended unless when you want to convert 3D Blu-ray and keep 3D effect.

[b]Top 5. Aiseesoft Blu-ray Ripper for Mac Fair[/b]

[b]Price:[/b]

Platinum version: $48.75
Standard version: $36.75
 
[img]http://open-media-community.com/wp-content/uploads/2015/01/Aiseesoft-blu-ray-ripper-for-mac.png[/img]
 
[b]The good:[/b] When it comes to decrypting/hacking Blu-ray discs and DVDs, Aiseesoft is about as good as it gets. Aiseesoft Blu-ray Ripper for Mac well deserves its high reputation in decryption, and it handles not only AACS, BD+, Region code restriction, but also Cinavia protected Blu-rays. If you want to rip a Blu-ray to MKV and keep 2 audio language and external subtitles, Aiseesoft would be your choice.

[b]The bad:[/b] It is lacking of DVD ripping feature. The interface is not very intuitive. And Aiseesoft Blu-ray Ripper for Mac costs more than its alternatives.

[b]The bottom line:[/b] Aiseesoft Blu-ray Ripper for Mac decrypts and rips Blu-ray title to various video files playable on next generation consoles.

[b]In Conclusion:[/b]

Pavtube ByteCopy for Mac/BDMagic for Mac is proved to be the best Mac Blu-ray Ripping/Copying tool for Mac. It ranks top on the Blu-ray ripping/copying application list for almost every aspect except for interface design.

Anyhow, hope this top Mac Blu-ray Ripper/Copier Reviews can help you fast choose an easy-to-use and yet professional Mac Blu-ray ripping/copying tool. Now get the best Blu-ray Ripper/Copier for Mac Program for You!

[b]P.S.[/b]

1. If you only need to deal with DVD disc, try [b][url=http://www.multipelife.com/dvdaid-mac]Pavtube [/url][/b][b][url=http://www.multipelife.com/dvdaid-mac]DVDAid for Mac[/url][/b] ($28)- 20% off on sale now.
 
2. If you need an all-inclusive multimedia toolbox which integrates all the features of a blu-ray ripper, a dvd ripper and a video converter, get [b]Pavtube iMedia Converter for Mac ($52) - 20% Off now[/b].

Get it from Pavtube Official ($52): http://www.multipelife.com/imedia-converter-mac
Get it from App Store ($54.99): https://itunes.apple.com/us/app/pavtube-imedia-converter/id502813683?ls=1&mt=12)
 
[b]Review: Pavtube iMedia Converter for Mac - Perfectly and Powerful[/b]
 
Pavtube iMedia Converter for Mac quickly removes CSS, AACS, BD+copyright, region code from Blu-ray and DVD disc, copies Blu-ray, DVD content to hard drive and converts Blu-ray, DVD and SD/HD Videos, Audio files to popular video/audio formats on Mac (Yosemite and Mavericks included).
 
[img]http://www.multipelife.com/wp-content/uploads/multipelife/software/cover/1398857189.jpg[/img]
 
[b]The good[/b]: Not any other Blu-ray Ripper can do with all kinds of any Common/HD Videos, 3D/2D Blu-ray sources: protected and unprotected Blu-ray Disc, BDMV folder, Blu-ray ISO, physical DVD, VIDEO_TS folder, DVD ISO and IFO file, MKV, AVI, Tivo, MTS, MXF, VOB, Youtube, WMV, WebM, etc. As a professional and powerful all-in-one Video/Blu-ray/DVD disc handling tool, Pavtube integrates DVD/Blu-ray Ripping/Copying and Video Conversion.
 
Source:[url=http://media-playback.jimdo.com/2014/04/20/top-5-blu-ray-ripper-for-mac/]http://media-playback.jimdo.com/2014/04/20/top-5-blu-ray-ripper-for-mac/[/url]
Loading...