You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/10/11 02:31:34 UTC

[jira] [Closed] (PDFBOX-1704) Null MediaBox value in the first page of a list of pages obtained using getAllPages()

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

John Hewson closed PDFBOX-1704.
-------------------------------
    Resolution: Invalid

This is not a bug, see the JavaDoc of getMediaBox().

> Null MediaBox value in the first page of a list of pages obtained using getAllPages()
> -------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-1704
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1704
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.2
>            Reporter: Gema Peña Chimeno
>            Priority: Minor
>
> Tryng to set pages in a PDF file generated using PDFMergerUtility (see PDFBOX-1703) we are getting the pages, setting the number page and creating a new PDF file. 
> In some cases the first page of the new file has the cut image. After debugging the code we realize that the value of the field mediaBox of the first page is null, and that produce strange affect in the new PDF:
>         File result
>         List allPages
>         PDDocument doc
>         PDDocument docWithPages
>         docWithPages = new PDDocument()
>         doc = PDDocument.load(tmpPdfFile);
>         allPages = doc.getDocumentCatalog().getAllPages();
>         for(PDPage page : allPages) {
>             docWithPages.addPage(page)
>         }
>         result = new File(pdfPathAndName)
>         docWithPages.save(result)
> If fact, to solve the problem, we add these line before addPage line:
>                 if (!page.mediaBox) {
>                     page.mediaBox = page.artBox
>                 }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)