You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Daniel (Jira)" <ji...@apache.org> on 2021/12/01 08:33:00 UTC

[jira] [Created] (PDFBOX-5335) Rendering of PDDocument failed

Daniel created PDFBOX-5335:
------------------------------

             Summary: Rendering of PDDocument failed
                 Key: PDFBOX-5335
                 URL: https://issues.apache.org/jira/browse/PDFBOX-5335
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 2.0.24
            Reporter: Daniel
         Attachments: Traverse Type QC, Nr. 1.1.pdf

I want to render the attached PDF-Document with the help of the following method. The target component gets an empty Image.

 

            private Component createPDFVorschau(byte[] dateiinhalt) {

                PDDocument doc = null;

                try {
                    doc = PDDocument.load(dateiinhalt, "");

                    if (doc!=null && doc.getNumberOfPages()>0) {
                        BufferedImage image = new PDFRenderer(doc).renderImage(0);
                        YImage imgVorschau = new YImage();
                        imgVorschau.setImage(image);
                        imgVorschau.setToolTipPicture(true);
                        return imgVorschau;
                    }

                } catch (Throwable e1) {
                    if (!(e1 instanceof OutOfMemoryError)) {
                        ErrorLog.warn(""+traverse, e1);
                    }
                } finally {
                    try {
                        if (doc!=null)
                            doc.close();
                    } catch (IOException e) {
                        Context.displayErrorToEndUser(e);
                    }
                }

                return null;
            }



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org