[
https://issues.apache.org/jira/browse/PDFBOX-2126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047728#comment-14047728
]
Andreas Lehmkühler commented on PDFBOX-2126:
--------------------------------------------
[~jahewson] I seems that you didn't test your changes. Now I get the following
NPE when validating the pdf attached to PDFBOX-1813 :-(
Exception in thread "main" java.lang.NullPointerException
at
org.apache.pdfbox.util.PDFStreamEngine.saveGraphicsState(PDFStreamEngine.java:554)
at org.apache.pdfbox.util.operator.GSave.process(GSave.java:38)
at
org.apache.pdfbox.preflight.content.PreflightContentStream.processOperator(PreflightContentStream.java:151)
at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:259)
at
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:226)
at
org.apache.pdfbox.preflight.content.PreflightContentStream.validXObjContentStream(PreflightContentStream.java:99)
at
org.apache.pdfbox.preflight.xobject.XObjFormValidator.validateXObjectContent(XObjFormValidator.java:113)
at
org.apache.pdfbox.preflight.xobject.XObjFormValidator.validate(XObjFormValidator.java:76)
at
org.apache.pdfbox.preflight.process.reflect.GraphicObjectPageValidationProcess.validate(GraphicObjectPageValidationProcess.java:77)
at
org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
at
org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
at
org.apache.pdfbox.preflight.process.reflect.ResourcesValidationProcess.validateXObjects(ResourcesValidationProcess.java:191)
at
org.apache.pdfbox.preflight.process.reflect.ResourcesValidationProcess.validate(ResourcesValidationProcess.java:78)
at
org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
at
org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
at
org.apache.pdfbox.preflight.process.reflect.SinglePageValidationProcess.validateResources(SinglePageValidationProcess.java:164)
at
org.apache.pdfbox.preflight.process.reflect.SinglePageValidationProcess.validate(SinglePageValidationProcess.java:83)
at
org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
at
org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
at
org.apache.pdfbox.preflight.process.PageTreeValidationProcess.validatePage(PageTreeValidationProcess.java:58)
at
org.apache.pdfbox.preflight.process.PageTreeValidationProcess.validate(PageTreeValidationProcess.java:47)
at
org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
at
org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:88)
at
org.apache.pdfbox.preflight.PreflightDocument.validate(PreflightDocument.java:168)
at
org.apache.pdfbox.preflight.Validator_A1b.runSimple(Validator_A1b.java:163)
at
org.apache.pdfbox.preflight.Validator_A1b.main(Validator_A1b.java:127)
> Optimize clipping
> -----------------
>
> Key: PDFBOX-2126
> URL: https://issues.apache.org/jira/browse/PDFBOX-2126
> Project: PDFBox
> Issue Type: Improvement
> Components: Rendering
> Affects Versions: 2.0.0
> Reporter: Petr Slaby
> Attachments: ClipPath.1.patch, ClipPath.patch, example_010.pdf
>
>
> As already stated in a TODO comment in PageDrawer, the call of
> Graphics2D#setClip() is time and memory consuming. The attached patch
> optimizes clipping by calling Graphics2D#setClip() only if the clipping path
> has changed. The effect depends on the document, e.g. the attached one
> renders in 10.5s without the optimization and in 5.5 seconds in the optimized
> version.
> The clipping has to be re-applied whenever the transform in Graphics2D
> changes. This is not explicitly checked for, the implementation rather
> depends on the cached value being reset manually. Currently this is only
> needed at one place when processing annotations (AcroForms). Also, the
> implementation relies upon the clipping path object stored in PDGraphicsState
> to never change so that a comparison using == can be used. This works fine,
> but needs a bit of awareness in future changes. To make the design more
> clean, the clipping path could be made private to PDGraphcisState and thus
> really "immutable" from outside.
--
This message was sent by Atlassian JIRA
(v6.2#6252)