[ https://issues.apache.org/jira/browse/PDFBOX-107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725014#action_12725014 ]
潘冠敬 commented on PDFBOX-107: ---------------------------- hi,The reason of the viewer crashed is the JFrame.setVisible(true) not blocked,so it will throw "IOException : handle is not useable",when you call the PDDocument.close() method. Because this is earlier called than PDFPagePanel.paint() method.The follows can fix the problem: 1.Use the model JDIalog replace the JFrame 2.call the PDDocument.close() after PDFPagePanel.paint() every time. > viewer crashed > -------------- > > Key: PDFBOX-107 > URL: https://issues.apache.org/jira/browse/PDFBOX-107 > Project: PDFBox > Issue Type: Bug > Components: PDModel > > [imported from SourceForge] > http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1352411 > Originally submitted by nobody on 2005-11-09 09:55. > Hi, > you have great product. > Tried to use viewer and it crashed > public static void main(String []args) > { > try { > PDDocument pdf = PDDocument.load(args[0]); > PDDocumentCatalog cat =pdf.getDocumentCatalog > (); > List l=cat.getAllPages(); > PDPage page=(PDPage)l.get(0); > PDFPagePanel p = new PDFPagePanel(); > // pdf.close(); > p.setPage(page); > JFrame fr = new JFrame(); > fr.setSize(800,600); > fr.getContentPane().add(p); > fr.setVisible(true); > } > catch(IOException e) { > } > } > I attached file for testing > [attachment on SourceForge] > http://sourceforge.net/tracker/download.php?group_id=78314&atid=552832&aid=1352411&file_id=155590 > RX_Fixed.pdf (application/pdf), 48965 bytes > this is pdf file I tried to open vith viewer -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.