[
https://issues.apache.org/jira/browse/PDFBOX-2132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14028881#comment-14028881
]
Petr Slaby commented on PDFBOX-2132:
------------------------------------
{quote}
I'd suggest just removing the following code from PDFStreamEngine instead:
{quote}
That's fine with me, I just thought this would be a compatibility break.
Current solution tries to render everything it can, without the runtime
exception catching it will stop after the first error (or bug :-) it runs into.
In the type of applications we do, it is usually better not to print a document
at all than print it incomplete or with errors.
> 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)