pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: content stream setGraphicsStateParameters gives null pointer
Date Wed, 16 Aug 2017 15:29:21 GMT
Am 16.08.2017 um 13:39 schrieb chitgoks:
> found the culprit
>
> the appearance stream does not have any resources object
>
> so i just instantiated a new one contentStream.setResources(new
> PDResource());
>
> i hope in the near future, new versions will create an instance of this
> automatically.

Although I've hit this problem twice, I didn't make any change in the 
code... Sometimes no resources are needed.

Btw you should use the current version before asking *any* question.

Tilman



>
>
> On Wed, Aug 16, 2017 at 7:20 PM, chitgoks <chitgoks@gmail.com> wrote:
>
>> I'll cook up some code for this
>>
>> the exception stack trace is vague. only shows this
>>
>> SEVERE: null
>> java.lang.NullPointerException
>> at org.apache.pdfbox.pdmodel.PDPageContentStream.
>> setGraphicsStateParameters(PDPageContentStream.java:2199)
>>
>> using pdfbox 2.0.4
>>
>>
>>
>> On Wed, Aug 16, 2017 at 7:16 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
>> wrote:
>>
>>>> Am 16.08.2017 um 13:14 schrieb chitgoks <chitgoks@gmail.com>:
>>>>
>>>> hi maruan. it is actually not null. it draws the shape and color as
>>>> intended. just not transparent.
>>> then I'd need a little more code and the stacktrace - even better would
>>> be a PDF to start from to reproduce (upload it to a public location).
>>> BR
>>> Maruan
>>>
>>>> i added those 3 lines for transparency then i get that null pointer.
>>>>
>>>> Website/Java Games: http://www.chitgoks.com
>>>> My Blogs:
>>>> http://tech.chitgoks.com
>>>> http://wuhtevah.chitgoks.com
>>>> http://disneyusa.blogspot.com
>>>>
>>>> On Wed, Aug 16, 2017 at 7:10 PM, Maruan Sahyoun <sahyoun@fileaffairs.de
>>>>
>>>> wrote:
>>>>
>>>>>> Am 16.08.2017 um 13:00 schrieb chitgoks <chitgoks@gmail.com>:
>>>>>>
>>>>>> hi. anyone got ideas why i get a nullpointer when my code looks like
>>>>> this?
>>>>>> square is a PDAnnotation object.
>>>>>>
>>>>>> cs.setStrokingColor(square.getInteriorColor());
>>>>>> cs.setNonStrokingColor(square.getInteriorColor());
>>>>> getInteriorColor() might be null if the annotations dictionary doesn't
>>>>> have such an entry
>>>>>
>>>>> BR
>>>>> Maruan
>>>>>
>>>>>> PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState();
>>>>>> graphicsState.setStrokingAlphaConstant(0.3f);
>>>>>> cs.setGraphicsStateParameters(graphicsState);
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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


Mime
View raw message