[ https://issues.apache.org/jira/browse/PDFBOX-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Hewson updated PDFBOX-1704: -------------------------------- Component/s: PDModel > 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.1.5#6160)