Petr Slaby created PDFBOX-2132:
----------------------------------

             Summary: Provide a pluggable exception handler to PDFStreamEngine
                 Key: PDFBOX-2132
                 URL: https://issues.apache.org/jira/browse/PDFBOX-2132
             Project: PDFBox
          Issue Type: Improvement
          Components: Rendering
    Affects Versions: 2.0.0
            Reporter: Petr Slaby
         Attachments: ExceptionHandler.patch

In our text processing and OMS application, PDFs are used as attachments to 
documents and rendered to target formats, among others AFP or PCL. The 
rendering part is implemented as a Graphics2D which gets called from PageDrawer 
and produces corresponding commands in the target printing language. 

As PDF is a much richer language than AFP or PCL, there are cases when we are 
not able to directly implement the corresponding g2d function (e.g. partial 
transparency of objects in AFP as it only supports transparency masks in 
bitmaps). In such case, the g2d implementation throws an 
UnsupportedOperationException which is supposed to abort the rendering in 
PDFBox. We catch the exception back in our code and render the PDF as a full 
page bitmap using a BufferedImage instead.

Current PDFBox trunk implementation swallows all exceptions that happen in 
PDFStreamEngine. For our purposes, a pluggable exception handler that can log 
all exceptions and re-throw UnsupportedOperationException would be perfect. A 
simple solution that works for me is shown in the attached patch.



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

Reply via email to