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

Stefan Helfert updated PDFBOX-2027:
-----------------------------------

    Attachment: Vortrag_Roej.pdf
                Vortrag_Busch.pdf

> PDF Page completely white/empty
> -------------------------------
>
>                 Key: PDFBOX-2027
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2027
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox, PDModel
>    Affects Versions: 2.0.0
>         Environment: Windows XP 32bit
> JDK 1.7.0_51
>            Reporter: Stefan Helfert
>         Attachments: Vortrag_Busch.pdf, Vortrag_Roej.pdf
>
>
> Hello,
> i am using pdfbox to split the last pages of a pdf to single documents for 
> some calculations. 
> Unfortunatly for some PDF files i get only white pages. I already found the 
> following post on:
> https://issues.apache.org/jira/browse/PDFBOX-2000
> So I switched from 1.8.4 to pdfbox-2.0.0-20140412.210944-279 but the problem 
> is still present.
> My code is as seen here:
> {code:title=Bar.java|borderStyle=solid}
> PDDocument doc = new PDDocument();
>                       try {
>                               doc = PDDocument.load(file);
>                               List<PDPage> pages = 
> doc.getDocumentCatalog().getAllPages();
>                                 //process last 4 pages
>                               for (int i = pages.size(); i > pages.size() - 
> 4; i--) {
>                                       // Get Page
>                                       PDPage page = pages.get(i - 1);
>                                       // get rotation of page
>                                       int rotation = page.findRotation();
>                                       
>                                         //check for landscape
>                                       if (rotation == 90 || rotation == -90) {
>                                               // create a temp file
>                                               File tempFile = 
> File.createTempFile("pdfPage", ".pdf");
>                                               // Create a new PDF File
>                                               PDDocument tempDoc = new 
> PDDocument();
>                                               tempDoc.addPage(page);
>                                               // Save pdf to a temporary file
>                                               
> tempDoc.setDocumentInformation(new PDDocumentInformation());
>                                               tempDoc.save(tempFile);
>                                               tempDoc.close();
>                                                 
>                                                //DO SOMETHING
>                                       
>                                               tempFile.delete();
>                                       } else {
>                                               return "";
>                                       }
>                               }
>                       } catch (Exception e) {
>                               logger.error(e.getMessage());
>                       } finally {
>                               if (doc != null) {
>                                       doc.close();
>                               }
>                       }
> {code}
> If i check the temp file its only a white page



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to