pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clifford <cliffo...@paprika-software.com>
Subject Re: PDPattern PDFBOX-1094
Date Wed, 09 Nov 2016 15:17:01 GMT
Looking at PDColor

It stores the Patten as a String, but stores the colour space as a 
object, and from this object it can not get back to its original name 
that is stored in the resource or is not trying too.

PDF code follows:-

q
   /cs15 cs
   0.6 0.89804 0.6 /Patten1 scn
   402.00864 419.82635 68.9668 16.31381 re
   f
Q

so /cs15 cs should be /R9 cs as I had called the PDColorSpace this when 
storing it in PDPage.getResources() and that was the item I had passed 
to PDColor.


On 09/11/2016 14:42, clifford wrote:
>
> Only just notice this.
>
> No it dose not work.
>
> COSArray ca = new COSArray();
> ca.add(COSName.PATTERN);
> PDPage.getResources().put(COSName.getPDFName("R9"),PDColorSpace.create(ca,PDPage.getResources()));
>
> PDColor pdColour =  new PDColor(new 
> float[]{colour.getRed()/255f,colour.getGreen()/255f,colour.getBlue()/255f},COSName.getPDFName("Patten1"),PDPage.getResources().getColorSpace(COSName.getPDFName("R9")));
>
> PDPageContentStream.setNonStrokingColor(pdColour);
>
> when calling setNonStrokingColor it duplicates the PDPattern and so 
> the PDPage.getResources() ends up with another item in the colour 
> space, with a completely different name,
>
> PDFDebugger when selecting Page: 1 gets a null pointer so its not too 
> happy with the result.
>
> Attached image of PDFDebugger screen R9 is the only one that should be 
> there, and I did not create the rest of them
>
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
> java.lang.NullPointerException
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:176)
> sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
>     java.security.AccessController.doPrivileged(Native Method)
> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
> Caused by: java.util.concurrent.ExecutionException: 
> java.lang.NullPointerException
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:165)
> sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
>     java.security.AccessController.doPrivileged(Native Method)
> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
> Caused by: java.lang.NullPointerException: null
> org.apache.pdfbox.rendering.TilingPaint.getAnchorRect(TilingPaint.java:202)
> org.apache.pdfbox.rendering.TilingPaint.getImage(TilingPaint.java:121)
> org.apache.pdfbox.rendering.TilingPaint.<init>(TilingPaint.java:87)
> org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:256)
> org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:529)
> org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:588)
> org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:36)
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815)
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472)
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446)
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
> org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:189)
> org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:68)
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:156)
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:139)
>     java.lang.Thread.run(Thread.java:745)
>
> On 08/11/2016 20:21, Tilman Hausherr wrote:
>> Am 08.11.2016 um 20:41 schrieb Tilman Hausherr:
>>> Am 08.11.2016 um 18:58 schrieb clifford:
>>>> I have figured it out there is a bug in PDColorSpace.
>>>>
>>>> At no point you can not get a PDPattern with the variable array set.
>>>>
>>>> so the method in PDSpecialColorSpace "public COSBase 
>>>> getCOSObject()" always returns null, which is why it fails to get 
>>>> put into the resource.
>>>
>>> You're right. I need to think about this. I have opened an issue
>>> https://issues.apache.org/jira/browse/PDFBOX-3560
>>
>> I have just committed a change that should fix your problem. Please 
>> build from source or get a build from a snapshot directory
>> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.4-SNAPSHOT/

>>
>>
>> and please give feedback whether it works now.
>>
>> Tilman
>>
>>
>>>
>>> Tilman
>>>
>>>>
>>>>
>>>>
>>>> On 08/11/2016 17:00, Tilman Hausherr wrote:
>>>>> Am 08.11.2016 um 16:00 schrieb clifford:
>>>>>> in PDFBOX-1094 
>>>>>> <https://issues.apache.org/jira/browse/PDFBOX-1094> there is
a 
>>>>>> file called gs-bugzilla691715.pdf
>>>>>>
>>>>>> Was this file generated by PDFBox, if so could I have the source

>>>>>> as I am trying to get PDPattern to work.
>>>>>
>>>>> No, the file is from ghostscript:
>>>>> http://bugs.ghostscript.com/show_bug.cgi?id=691715
>>>>>
>>>>> I've never heard that people create PDFs with patterns because 
>>>>> it's complex. But you're welcome and hopefully you'll be helped. 
>>>>> Last year we had a guy who created shadings from scratch.
>>>>>
>>>>>>
>>>>>> when doing
>>>>>> cvPage.getResources().put(COSName.getPDFName("R9"),PDColorSpace.create(COSName.PATTERN,cvPage.getResources()));

>>>>>>
>>>>>>
>>>>>> cvPage = a PDPage object
>>>>>>
>>>>>> The Pattern is not added to the resources items, there is code in

>>>>>> PDFBox that actually stops a PDPattern from being added?
>>>>>> I can add any other PDColorSpace object I like but not a 
>>>>>> COSName.PATTERN one.
>>>>>
>>>>> Can you create some small but complete code that "proves" that the 
>>>>> Pattern is not being added? Obviously you have something, but I, 
>>>>> to help you, would have to create something from scratch.
>>>>>
>>>>>
>>>>> Tilman
>>>>>
>>>>>>
>>>>>> looking at gs-bugzilla691715.pdf it looks like ColourSpace Patten

>>>>>> has been added to Resources as a array under ColorSpace, how did

>>>>>> they do that.
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
> -- 
>
> *Kind regards*
>
> *Clifford Dann
> Paprika*
>
>
> T +44 (0)1732 811601
> www.paprika-software.com <https://www.paprika-software.com%3C>
> Latters House, High Street, Hadlow, Tonbridge, Kent, TN11 0EF, United 
> Kingdom
>
> Agency Software Worldwide Ltd.    Registered in England and Wales 01665695
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org

-- 

*Kind regards*

*Clifford Dann
Paprika*


T +44 (0)1732 811601
www.paprika-software.com <https://www.paprika-software.com%3C>
Latters House, High Street, Hadlow, Tonbridge, Kent, TN11 0EF, United 
Kingdom

Agency Software Worldwide Ltd.    Registered in England and Wales 01665695


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message