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

Tilman Hausherr updated PDFBOX-5335:
------------------------------------
    Description: 
I want to render the attached PDF-Document with the help of the following 
method. The target component gets an empty Image.
{code}
            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;
            }
{code}


  was:
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;
            }


> 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
>            Priority: Major
>         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.
> {code}
>             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;
>             }
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to