You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Ad Kooiman (JIRA)" <ji...@apache.org> on 2017/12/21 12:45:00 UTC

[jira] [Updated] (PDFBOX-4044) Unable to process overlay on Cognos PDF documents

     [ https://issues.apache.org/jira/browse/PDFBOX-4044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ad Kooiman updated PDFBOX-4044:
-------------------------------
    Description: 
Since we upgrade from PDFBox 1.x to PDFBox 2.0.8, we cannot overlay PDF documents anymore. These PDF documens are from Cognos Reporting and still works fine with PDFBox 1.x.

Attached files:
*[^report_cognos_merged.pdf]* - a document that contains an intro page that was succesfully merged into a cognos report. Page 2 and 3 are the original cognos report pages.
*[^confidential_overlay.pdf]* - an overlay pdf document
*[^report_cognos_overlayed.pdf]* - the resulting document after processing the overlay

To reproduce, use the attached report_cognos_merged.pdf and overlay this with the attached confidential_overlay.pdf. The resulting attached file report_cognos_overlayed.pdf only shows an overlay on the first page. The other pages are not overlayed.

Code snippet used to overlay:

{code}
   public void addLayer() throws Exception {
        PDDocument inDocument = PDDocument.load(basePdf);
        PDDocument layoutDocument = PDDocument.load(overlayLayout);        
        LayerUtility layerUtility = new LayerUtility(inDocument);
        PDFormXObject layerObject = layerUtility.importPageAsForm(layoutDocument, 0);        
        AffineTransform transform = new AffineTransform();
        for (int i = 0; i < inDocument.getNumberOfPages(); i++) {
            layerUtility.appendFormAsLayer(inDocument.getPage(i), layerObject, transform, layer + "_" + i);
        }
        layerUtility.getDocument().save(outPdf);
    }
{code}


  was:
Since we upgrade from PDFBox 1.x to PDFBox 2.0.8, we cannot overlay PDF documents anymore. These PDF documens are from Cognos Reporting and still works fine with PDFBox 1.x.

Attached files:
report_cognos_merged.pdf, a document that contains an intro page that was succesfully merged into a cognos report. Page 2 and 3 are the original cognos report pages.
confidential_overlay.pdf, an overlay pdf document
report_cognos_merged.pdf, the resulting document after processing the overlay

To reproduce, use the attached report_cognos_merged.pdf and overlay this with the attached confidential_overlay.pdf. The resulting attached file report_cognos_overlayed.pdf only shows an overlay on the first page. The other pages are not overlayed.

Code snippet used to overlay:

{code}
   public void addLayer() throws Exception {
        PDDocument inDocument = PDDocument.load(basePdf);
        PDDocument layoutDocument = PDDocument.load(overlayLayout);        
        LayerUtility layerUtility = new LayerUtility(inDocument);
        PDFormXObject layerObject = layerUtility.importPageAsForm(layoutDocument, 0);        
        AffineTransform transform = new AffineTransform();
        for (int i = 0; i < inDocument.getNumberOfPages(); i++) {
            layerUtility.appendFormAsLayer(inDocument.getPage(i), layerObject, transform, layer + "_" + i);
        }
        layerUtility.getDocument().save(outPdf);
    }
{code}



> Unable to process overlay on Cognos PDF documents
> -------------------------------------------------
>
>                 Key: PDFBOX-4044
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4044
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.8
>            Reporter: Ad Kooiman
>         Attachments: confidential_overlay.pdf, report_cognos_merged.pdf, report_cognos_overlayed.pdf
>
>
> Since we upgrade from PDFBox 1.x to PDFBox 2.0.8, we cannot overlay PDF documents anymore. These PDF documens are from Cognos Reporting and still works fine with PDFBox 1.x.
> Attached files:
> *[^report_cognos_merged.pdf]* - a document that contains an intro page that was succesfully merged into a cognos report. Page 2 and 3 are the original cognos report pages.
> *[^confidential_overlay.pdf]* - an overlay pdf document
> *[^report_cognos_overlayed.pdf]* - the resulting document after processing the overlay
> To reproduce, use the attached report_cognos_merged.pdf and overlay this with the attached confidential_overlay.pdf. The resulting attached file report_cognos_overlayed.pdf only shows an overlay on the first page. The other pages are not overlayed.
> Code snippet used to overlay:
> {code}
>    public void addLayer() throws Exception {
>         PDDocument inDocument = PDDocument.load(basePdf);
>         PDDocument layoutDocument = PDDocument.load(overlayLayout);        
>         LayerUtility layerUtility = new LayerUtility(inDocument);
>         PDFormXObject layerObject = layerUtility.importPageAsForm(layoutDocument, 0);        
>         AffineTransform transform = new AffineTransform();
>         for (int i = 0; i < inDocument.getNumberOfPages(); i++) {
>             layerUtility.appendFormAsLayer(inDocument.getPage(i), layerObject, transform, layer + "_" + i);
>         }
>         layerUtility.getDocument().save(outPdf);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org