You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Ro...@opengi.co.uk on 2013/08/02 10:17:03 UTC

FW: Issue with PDFBox 'Overlay' and Headers/Footers

Hi,

I'm experiencing an issue with overlaying PDFs using PDFBox 1.8.2.

I'm generating a ('Source') PDF via MS Word. When subsequently using the 'Overlay' class to place this source PDF onto another ('Stationery') PDF, the resulting PDF doesn't appear to contain any of the contents of the 'Source' PDF - it only appears to contain the content from the 'Stationery' PDF itself.

The issue only appears to be prevalent when the original MS Word document contains header/footer content - my original 'Source' Word document contains a header.

I'm including the following sample code to indicate how I'm using PDFBox to overlay the PDFs. Note: The sample code is C# - I can reproduce the same symptoms when using Java code.

            PDDocument sourcePDF = PDDocument.load(@"C:\1work\Source.pdf");
            PDDocument stationeryPDF = PDDocument.load(@"C:\1work\Stationery.pdf");

            // Overlay the stationery document over the main document...
            Overlay pdfOverlay = new Overlay();
            PDDocument outputPDF = pdfOverlay.overlay(sourcePDF, stationeryPDF);

            // Save the document resulting from 'overlay'...
            outputPDF.save(@"C:\1work\Output.pdf");

            // Close the documents...
            stationeryPDF.close();
            sourcePDF.close();
            outputPDF.close();

I've attached the two PDFs used in this sample.

Any help gratefully received,

Regards,

Robert Page
Lead Developer - Strategic Core Development
open gi
Buckholt Drive, Warndon, Worcester WR4 9SR
Tel: +44 (0)1905 754455 Ext: 2154
Fax: +44 (0)1905 754441
Email: robert.page@opengi.co.uk<ma...@opengi.co.uk>
Web: www.opengi.co.uk<http://www.opengi.co.uk/>

powering broker business for 30 years

Please consider the environment before printing this e-mail

"This message is intended for the named recipient only and may be privileged and/or confidential. If you are not the intended or named recipient or have received this email in error then you should not copy forward or disclose it to any other persons. If you have received this email in error you should destroy it and contact the sender so that we may take appropriate action. The views and opinions expressed in this email may not represent the views and opinions of Open International Limited or any of its subsidiaries and are made without prejudice and subject to contract. The Company Reserves the right to intercept and review all email communications."

Open International Limited. Registered Office: Buckholt Drive, Warndon, Worcester, WR4 9SR.
Registered in England. Registered No: 05716519


RE: Issue with PDFBox 'Overlay' and Headers/Footers

Posted by Ro...@opengi.co.uk.
FYI - I have a resolution (workaround) to the issue detailed in my post below.

The issue was caused by accessibility tags contained in the PDF (included by MS Word upon saving documents to PDF).

The workaround is to ensure 'Document structure tags for accessibility' is disabled, when saving MS Word documents to PDF.
Regards,

Rob.

Robert Page
Lead Developer - Strategic Core Development
open gi
Buckholt Drive, Warndon, Worcester WR4 9SR
Tel: +44 (0)1905 754455 Ext: 2154
Fax: +44 (0)1905 754441
Email: robert.page@opengi.co.uk<ma...@opengi.co.uk>
Web: www.opengi.co.uk<http://www.opengi.co.uk/>

powering broker business for 30 years

Please consider the environment before printing this e-mail

"This message is intended for the named recipient only and may be privileged and/or confidential. If you are not the intended or named recipient or have received this email in error then you should not copy forward or disclose it to any other persons. If you have received this email in error you should destroy it and contact the sender so that we may take appropriate action. The views and opinions expressed in this email may not represent the views and opinions of Open International Limited or any of its subsidiaries and are made without prejudice and subject to contract. The Company Reserves the right to intercept and review all email communications."

Open International Limited. Registered Office: Buckholt Drive, Warndon, Worcester, WR4 9SR.
Registered in England. Registered No: 05716519

From: Robert.Page@opengi.co.uk [mailto:Robert.Page@opengi.co.uk]
Sent: 02 August 2013 09:17
To: users@pdfbox.apache.org
Subject: FW: Issue with PDFBox 'Overlay' and Headers/Footers

Hi,

I'm experiencing an issue with overlaying PDFs using PDFBox 1.8.2.

I'm generating a ('Source') PDF via MS Word. When subsequently using the 'Overlay' class to place this source PDF onto another ('Stationery') PDF, the resulting PDF doesn't appear to contain any of the contents of the 'Source' PDF - it only appears to contain the content from the 'Stationery' PDF itself.

The issue only appears to be prevalent when the original MS Word document contains header/footer content - my original 'Source' Word document contains a header.

I'm including the following sample code to indicate how I'm using PDFBox to overlay the PDFs. Note: The sample code is C# - I can reproduce the same symptoms when using Java code.

            PDDocument sourcePDF = PDDocument.load(@"C:\1work\Source.pdf");
            PDDocument stationeryPDF = PDDocument.load(@"C:\1work\Stationery.pdf");

            // Overlay the stationery document over the main document...
            Overlay pdfOverlay = new Overlay();
            PDDocument outputPDF = pdfOverlay.overlay(sourcePDF, stationeryPDF);

            // Save the document resulting from 'overlay'...
            outputPDF.save(@"C:\1work\Output.pdf");

            // Close the documents...
            stationeryPDF.close();
            sourcePDF.close();
            outputPDF.close();

I've attached the two PDFs used in this sample.

Any help gratefully received,

Regards,

Robert Page
Lead Developer - Strategic Core Development
open gi
Buckholt Drive, Warndon, Worcester WR4 9SR
Tel: +44 (0)1905 754455 Ext: 2154
Fax: +44 (0)1905 754441
Email: robert.page@opengi.co.uk<ma...@opengi.co.uk>
Web: www.opengi.co.uk<http://www.opengi.co.uk/>

powering broker business for 30 years

Please consider the environment before printing this e-mail

"This message is intended for the named recipient only and may be privileged and/or confidential. If you are not the intended or named recipient or have received this email in error then you should not copy forward or disclose it to any other persons. If you have received this email in error you should destroy it and contact the sender so that we may take appropriate action. The views and opinions expressed in this email may not represent the views and opinions of Open International Limited or any of its subsidiaries and are made without prejudice and subject to contract. The Company Reserves the right to intercept and review all email communications."

Open International Limited. Registered Office: Buckholt Drive, Warndon, Worcester, WR4 9SR.
Registered in England. Registered No: 05716519


RE: Issue with PDFBox 'Overlay' and Headers/Footers

Posted by Ro...@opengi.co.uk.
Hi Maruan,

Thanks for your reply. As the PDF attachments didn't get through, I've uploaded them for public access....

https://skydrive.live.com/redir?resid=6B3739ECDEF2E7E8!119&authkey=!AO-Jzq0GPR5Kwaw

Regards,

Robert Page
Lead Developer - Strategic Core Development
open gi
Buckholt Drive, Warndon, Worcester WR4 9SR
Tel: +44 (0)1905 754455 Ext: 2154
Fax: +44 (0)1905 754441
Email: robert.page@opengi.co.uk
Web: www.opengi.co.uk

powering broker business for 30 years

Please consider the environment before printing this e-mail

"This message is intended for the named recipient only and may be privileged and/or confidential. If you are not the intended or named recipient or have received this email in error then you should not copy forward or disclose it to any other persons. If you have received this email in error you should destroy it and contact the sender so that we may take appropriate action. The views and opinions expressed in this email may not represent the views and opinions of Open International Limited or any of its subsidiaries and are made without prejudice and subject to contract. The Company Reserves the right to intercept and review all email communications." 

Open International Limited. Registered Office: Buckholt Drive, Warndon, Worcester, WR4 9SR.
Registered in England. Registered No: 05716519

-----Original Message-----
From: Maruan Sahyoun [mailto:sahyoun@fileaffairs.de] 
Sent: 02 August 2013 09:41
To: users@pdfbox.apache.org
Subject: Re: Issue with PDFBox 'Overlay' and Headers/Footers

Hi Robert,

is it possible to upload the PDFs to a public location as they didn't make it through the mailing list?

BR

Maruan Sahyoun

Am 02.08.2013 um 10:17 schrieb Robert.Page@opengi.co.uk:

> Hi,
>  
> I'm experiencing an issue with overlaying PDFs using PDFBox 1.8.2.
>  
> I'm generating a ('Source') PDF via MS Word. When subsequently using the 'Overlay' class to place this source PDF onto another ('Stationery') PDF, the resulting PDF doesn't appear to contain any of the contents of the 'Source' PDF - it only appears to contain the content from the 'Stationery' PDF itself.
>  
> The issue only appears to be prevalent when the original MS Word document contains header/footer content - my original 'Source' Word document contains a header.
>  
> I'm including the following sample code to indicate how I'm using PDFBox to overlay the PDFs. Note: The sample code is C# - I can reproduce the same symptoms when using Java code.
>  
>             PDDocument sourcePDF = PDDocument.load(@"C:\1work\Source.pdf");
>             PDDocument stationeryPDF = 
> PDDocument.load(@"C:\1work\Stationery.pdf");
>  
>             // Overlay the stationery document over the main document...
>             Overlay pdfOverlay = new Overlay();
>             PDDocument outputPDF = pdfOverlay.overlay(sourcePDF, 
> stationeryPDF);
>  
>             // Save the document resulting from 'overlay'...
>             outputPDF.save(@"C:\1work\Output.pdf");
>  
>             // Close the documents...
>             stationeryPDF.close();
>             sourcePDF.close();
>             outputPDF.close();
>  
> I've attached the two PDFs used in this sample.
>  
> Any help gratefully received,
> 
> Regards,
>  
> Robert Page
> Lead Developer - Strategic Core Development open gi Buckholt Drive, 
> Warndon, Worcester WR4 9SR
> Tel: +44 (0)1905 754455 Ext: 2154
> Fax: +44 (0)1905 754441
> Email: robert.page@opengi.co.uk
> Web: www.opengi.co.uk
>  
> powering broker business for 30 years
>  
> Please consider the environment before printing this e-mail
>  
> "This message is intended for the named recipient only and may be privileged and/or confidential. If you are not the intended or named recipient or have received this email in error then you should not copy forward or disclose it to any other persons. If you have received this email in error you should destroy it and contact the sender so that we may take appropriate action. The views and opinions expressed in this email may not represent the views and opinions of Open International Limited or any of its subsidiaries and are made without prejudice and subject to contract. The Company Reserves the right to intercept and review all email communications."
>  
> Open International Limited. Registered Office: Buckholt Drive, Warndon, Worcester, WR4 9SR.
> Registered in England. Registered No: 05716519
>  


Re: Issue with PDFBox 'Overlay' and Headers/Footers

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi Robert,

is it possible to upload the PDFs to a public location as they didn't make it through the mailing list?

BR

Maruan Sahyoun

Am 02.08.2013 um 10:17 schrieb Robert.Page@opengi.co.uk:

> Hi,
>  
> I’m experiencing an issue with overlaying PDFs using PDFBox 1.8.2.
>  
> I’m generating a (‘Source’) PDF via MS Word. When subsequently using the ‘Overlay’ class to place this source PDF onto another (‘Stationery’) PDF, the resulting PDF doesn’t appear to contain any of the contents of the ‘Source’ PDF – it only appears to contain the content from the ‘Stationery’ PDF itself.
>  
> The issue only appears to be prevalent when the original MS Word document contains header/footer content – my original ‘Source’ Word document contains a header.
>  
> I’m including the following sample code to indicate how I’m using PDFBox to overlay the PDFs. Note: The sample code is C# - I can reproduce the same symptoms when using Java code.
>  
>             PDDocument sourcePDF = PDDocument.load(@"C:\1work\Source.pdf");
>             PDDocument stationeryPDF = PDDocument.load(@"C:\1work\Stationery.pdf");
>  
>             // Overlay the stationery document over the main document...
>             Overlay pdfOverlay = new Overlay();
>             PDDocument outputPDF = pdfOverlay.overlay(sourcePDF, stationeryPDF);
>  
>             // Save the document resulting from 'overlay'...
>             outputPDF.save(@"C:\1work\Output.pdf");
>  
>             // Close the documents...
>             stationeryPDF.close();
>             sourcePDF.close();
>             outputPDF.close();
>  
> I’ve attached the two PDFs used in this sample.
>  
> Any help gratefully received,
> 
> Regards,
>  
> Robert Page
> Lead Developer - Strategic Core Development
> open gi
> Buckholt Drive, Warndon, Worcester WR4 9SR
> Tel: +44 (0)1905 754455 Ext: 2154
> Fax: +44 (0)1905 754441
> Email: robert.page@opengi.co.uk
> Web: www.opengi.co.uk
>  
> powering broker business for 30 years
>  
> Please consider the environment before printing this e-mail
>  
> "This message is intended for the named recipient only and may be privileged and/or confidential. If you are not the intended or named recipient or have received this email in error then you should not copy forward or disclose it to any other persons. If you have received this email in error you should destroy it and contact the sender so that we may take appropriate action. The views and opinions expressed in this email may not represent the views and opinions of Open International Limited or any of its subsidiaries and are made without prejudice and subject to contract. The Company Reserves the right to intercept and review all email communications."
>  
> Open International Limited. Registered Office: Buckholt Drive, Warndon, Worcester, WR4 9SR.
> Registered in England. Registered No: 05716519
>  


Re: FW: Issue with PDFBox 'Overlay' and Headers/Footers

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 02.08.2013 10:17, schrieb Robert.Page@opengi.co.uk:
> Hi,
>
> I’m experiencing an issue with overlaying PDFs using PDFBox 1.8.2.
>
> I’m generating a (‘Source’) PDF via MS Word. When subsequently using the
> ‘Overlay’ class to place this source PDF onto another (‘Stationery’) PDF, the
> resulting PDF doesn’t appear to contain any of the contents of the ‘Source’ PDF
> – it only appears to contain the content from the ‘Stationery’ PDF itself.
>
> The issue only appears to be prevalent when the original MS Word document
> contains header/footer content – my original ‘Source’ Word document contains a
> header.
>
> I’m including the following sample code to indicate how I’m using PDFBox to
> overlay the PDFs. Note: The sample code is C# - I can reproduce the same
> symptoms when using Java code.
>
>              PDDocument sourcePDF = PDDocument.load(@"C:\1work\Source.pdf");
>
>              PDDocument stationeryPDF = PDDocument.load(@"C:\1work\Stationery.pdf");
>
>              // Overlay the stationery document over the main document...
>
>              Overlay pdfOverlay = new Overlay();
>
>              PDDocument outputPDF = pdfOverlay.overlay(sourcePDF, stationeryPDF);
>
>              // Save the document resulting from 'overlay'...
>
>              outputPDF.save(@"C:\1work\Output.pdf");
>
>              // Close the documents...
>
>              stationeryPDF.close();
>
>              sourcePDF.close();
>
>              outputPDF.close();
>
> I’ve attached the two PDFs used in this sample.
>
> Any help gratefully received,
Did you ever try the improved overlay-tool? See [1] for further details.
I guess the old one will be removed in PDFBox 2.0

> Regards,
>
> *Robert Page*
>SNIP

BR
Andreas Lehmkühler

[1] https://issues.apache.org/jira/browse/PDFBOX-1514