[ https://issues.apache.org/jira/browse/PDFBOX-56?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler resolved PDFBOX-56. -------------------------------------- Resolution: Invalid The attached document can't be viewed with the adobe reader, too. It seems to be damaged. > PDFBox does not recognizes this PDF file > ---------------------------------------- > > Key: PDFBOX-56 > URL: https://issues.apache.org/jira/browse/PDFBOX-56 > Project: PDFBox > Issue Type: Bug > > [imported from SourceForge] > http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1192516 > Originally submitted by alaki on 2005-04-29 09:15. > It seems the PDFBox can not show the test.pdf file > using the following code. > import org.pdfbox.pdmodel.PDDocument; > import org.pdfbox.pdmodel.PDPage; > import org.pdfbox.exceptions.InvalidPasswordException; > import org.pdfbox.pdfviewer.PDFPagePanel; > import javax.swing.*; > import java.io.InputStream; > import java.io.IOException; > import java.io.File; > import java.io.FileInputStream; > import java.awt.*; > public class PDFTest2 { > public static void main(String args[]) { > InputStream input = null; > File f = new File("c:\\temp\\test.PDF"); > PDDocument document = null; > try { > input = new FileInputStream(f); > document = parseDocument(input); > } catch (IOException e) { > e.printStackTrace(); > } > java.util.List pages = > document.getDocumentCatalog().getAllPages(); > PDPage page = (PDPage) pages.get(0); > PDFPagePanel panel = null; > try { > panel = new PDFPagePanel(); > panel.setPage(page); > } catch (IOException e) { > e.printStackTrace(); > } > JFrame frame = new JFrame(); > frame.setSize(600, 600); > frame.getContentPane().setLayout(new > BorderLayout()); > frame.getContentPane().add(panel, > BorderLayout.CENTER); > frame.setVisible(true); > } > private static PDDocument parseDocument(InputStream > input) throws IOException { > PDDocument document = PDDocument.load(input); > if (document.isEncrypted()) { > try { > document.decrypt(""); > } catch (InvalidPasswordException e) { > System.err.println("Error: The document > is encrypted."); > } catch > (org.pdfbox.exceptions.CryptographyException e) { > e.printStackTrace(); > } > } > return document; > } > } > [attachment on SourceForge] > http://sourceforge.net/tracker/download.php?group_id=78314&atid=552832&aid=1192516&file_id=132281 > test.PDF (application/pdf), 37607 bytes > The one page document that can not be shown by PDFBox -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.