You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Ulf Dittmer <ul...@googlemail.com.INVALID> on 2025/06/03 15:47:22 UTC

How to work around this error?

Hello-

When trying to fill in values into a form, I'm encountering the error shown
below, which means nothing to me. It's not just for the first field it
encounters - if I comment that out, it happens for the next field.

The form (an official government PDF) doesn't seem different from any
number of other ones we are successfully filling out; it can be found at
https://ulfdittmer.com/pdfbox/Guide_BW.pdf

The source code is also similar to other codes we use for other forms:
https://ulfdittmer.com/pdfbox/StreamQRApplForm.java

It uses the following font, which is also standard
https://ulfdittmer.com/pdfbox/Arial.ttf

Are we doing something wrong? Is the PDF weird? Is there a way around this
issue?

Many thanks in advance for any help you can supply.

Ulf

Jun 03, 2025 5:21:00 PM org.apache.pdfbox.pdfparser.BaseParser
parseCOSDictionaryNameValuePair
WARNING: Empty COSName at offset 940
Exception in thread "main" java.io.IOException: Could not process default
appearance string ' 13 0 g' for field 'Name ggf Geburtsname': Missing
operands for set non stroking color operator [COSInt{13}, COSInt{0}]
at
org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.<init>(AppearanceGeneratorHelper.java:123)
at
org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:261)
at
org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:209)
at
org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:218)
at StreamQRApplForm.setField(StreamQRApplForm.java:67)
at StreamQRApplForm.main(StreamQRApplForm.java:28)
Caused by: java.io.IOException: Missing operands for set non stroking color
operator [COSInt{13}, COSInt{0}]
at
org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processSetFontColor(PDDefaultAppearanceString.java:202)
at
org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processOperator(PDDefaultAppearanceString.java:133)
at
org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.processAppearanceStringOperators(PDDefaultAppearanceString.java:105)
at
org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.<init>(PDDefaultAppearanceString.java:87)
at
org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaultAppearanceString(PDVariableText.java:105)
at
org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.<init>(AppearanceGeneratorHelper.java:117)
... 5 more

Re: How to work around this error?

Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Hello Marc,

was my thought too that 13 is the font size. Just for the records that
would be something like 

/Helv 13 Tf 0 g and not /Helv Tf 13 0 g

BR
Maruan 

Am Mittwoch, dem 04.06.2025 um 09:34 -0700 schrieb Marc Kaufman:
> I would point out that the problem with this appearance setting is
> not 
> the color, but the missing Font specification.
> 
> / 13 0 g vs / Helv Tf 13 0 g. The 13 being the font size.
> 
> Marc
> 
> On 6/4/2025 1:09 AM, sahyoun@fileaffairs.de wrote:
> > Your welcome. Good that you found a solution.
> > 
> > We could handle the wrong color setting in pdfbox and use defaults
> > instead of throwing but I'm not a big fan of that as different
> > users of
> > the lib might use different defaults.
> > 
> > BR
> > Maruan
> > 
> > Am Mittwoch, dem 04.06.2025 um 09:54 +0200 schrieb Ulf Dittmer:
> > > Thank you, that put me on the right track. I had no idea about
> > > the
> > > inner
> > > workings of appearances, and your explanation taught me enough
> > > about
> > > it to
> > > substitute something in case a field has a weird one - kudos!
> > > 
> > > I'm guessing the form is mostly printed out, and filled in by
> > > hand,
> > > so that
> > > this issue hasn't surfaced before.
> > > 
> > > Cheers!
> > > Ulf
> > > 
> > > On Tue, Jun 3, 2025 at 10:27 PMsahyoun@fileaffairs.de <
> > > sahyoun@fileaffairs.de> wrote:
> > > 
> > > > Hello Ulf,
> > > > 
> > > > a typical default appearance string looks like this
> > > > 
> > > > /Helv 12 Tf 0 g
> > > > 
> > > > There are two operators Tf, to set the font, and g to set the
> > > > color
> > > > with the arguments for the operators being supplied before.
> > > > 
> > > > Helv 12 being the arguments for Tf and
> > > > 0  being the argument for g
> > > > 
> > > > Your form has / 13 0 g
> > > > 
> > > > So 13 0 are being treated as arguments for the g operator. But
> > > > there
> > > > are no colors with 2 arguments. It's either 1 (Greyscale) , 3
> > > > (RGB)
> > > > or
> > > > 4 (CMYK) arguments.
> > > > 
> > > > So IMHO the default apperace string is wrong.
> > > > 
> > > > It's also very unusual that it doesn't set a font.
> > > > 
> > > > Workaround would be to set the default apperance string similar
> > > > to
> > > > the
> > > > first sample above.
> > > > 
> > > > BR
> > > > Maruan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: How to work around this error?

Posted by Marc Kaufman <ka...@cs.stanford.edu>.
I meant / Helv 13 Tf 0 g, but you get my point.

The default appearance string (DA)...

At a minimum, the string must include a Tf (text font) operator along 
with its two operands, font and size. The specified font value must 
match a resource name in the Font entry of the default resource 
dictionary (referenced from the DR entry of the interactive form 
dictionary. [pdf 1.7 reference]

Marc

On 6/4/2025 9:34 AM, Marc Kaufman wrote:
>
> I would point out that the problem with this appearance setting is not 
> the color, but the missing Font specification.
>
> / 13 0 g vs / Helv Tf 13 0 g. The 13 being the font size.
>
> Marc
>
> On 6/4/2025 1:09 AM, sahyoun@fileaffairs.de wrote:
>> Your welcome. Good that you found a solution.
>>
>> We could handle the wrong color setting in pdfbox and use defaults
>> instead of throwing but I'm not a big fan of that as different users of
>> the lib might use different defaults.
>>
>> BR
>> Maruan
>>
>> Am Mittwoch, dem 04.06.2025 um 09:54 +0200 schrieb Ulf Dittmer:
>>> Thank you, that put me on the right track. I had no idea about the
>>> inner
>>> workings of appearances, and your explanation taught me enough about
>>> it to
>>> substitute something in case a field has a weird one - kudos!
>>>
>>> I'm guessing the form is mostly printed out, and filled in by hand,
>>> so that
>>> this issue hasn't surfaced before.
>>>
>>> Cheers!
>>> Ulf
>>>
>>> On Tue, Jun 3, 2025 at 10:27 PMsahyoun@fileaffairs.de <
>>> sahyoun@fileaffairs.de> wrote:
>>>
>>>> Hello Ulf,
>>>>
>>>> a typical default appearance string looks like this
>>>>
>>>> /Helv 12 Tf 0 g
>>>>
>>>> There are two operators Tf, to set the font, and g to set the color
>>>> with the arguments for the operators being supplied before.
>>>>
>>>> Helv 12 being the arguments for Tf and
>>>> 0  being the argument for g
>>>>
>>>> Your form has / 13 0 g
>>>>
>>>> So 13 0 are being treated as arguments for the g operator. But
>>>> there
>>>> are no colors with 2 arguments. It's either 1 (Greyscale) , 3 (RGB)
>>>> or
>>>> 4 (CMYK) arguments.
>>>>
>>>> So IMHO the default apperace string is wrong.
>>>>
>>>> It's also very unusual that it doesn't set a font.
>>>>
>>>> Workaround would be to set the default apperance string similar to
>>>> the
>>>> first sample above.
>>>>
>>>> BR
>>>> Maruan

Re: How to work around this error?

Posted by Marc Kaufman <ka...@cs.stanford.edu>.
I would point out that the problem with this appearance setting is not 
the color, but the missing Font specification.

/ 13 0 g vs / Helv Tf 13 0 g. The 13 being the font size.

Marc

On 6/4/2025 1:09 AM, sahyoun@fileaffairs.de wrote:
> Your welcome. Good that you found a solution.
>
> We could handle the wrong color setting in pdfbox and use defaults
> instead of throwing but I'm not a big fan of that as different users of
> the lib might use different defaults.
>
> BR
> Maruan
>
> Am Mittwoch, dem 04.06.2025 um 09:54 +0200 schrieb Ulf Dittmer:
>> Thank you, that put me on the right track. I had no idea about the
>> inner
>> workings of appearances, and your explanation taught me enough about
>> it to
>> substitute something in case a field has a weird one - kudos!
>>
>> I'm guessing the form is mostly printed out, and filled in by hand,
>> so that
>> this issue hasn't surfaced before.
>>
>> Cheers!
>> Ulf
>>
>> On Tue, Jun 3, 2025 at 10:27 PMsahyoun@fileaffairs.de <
>> sahyoun@fileaffairs.de> wrote:
>>
>>> Hello Ulf,
>>>
>>> a typical default appearance string looks like this
>>>
>>> /Helv 12 Tf 0 g
>>>
>>> There are two operators Tf, to set the font, and g to set the color
>>> with the arguments for the operators being supplied before.
>>>
>>> Helv 12 being the arguments for Tf and
>>> 0  being the argument for g
>>>
>>> Your form has / 13 0 g
>>>
>>> So 13 0 are being treated as arguments for the g operator. But
>>> there
>>> are no colors with 2 arguments. It's either 1 (Greyscale) , 3 (RGB)
>>> or
>>> 4 (CMYK) arguments.
>>>
>>> So IMHO the default apperace string is wrong.
>>>
>>> It's also very unusual that it doesn't set a font.
>>>
>>> Workaround would be to set the default apperance string similar to
>>> the
>>> first sample above.
>>>
>>> BR
>>> Maruan

Re: How to work around this error?

Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Your welcome. Good that you found a solution.

We could handle the wrong color setting in pdfbox and use defaults
instead of throwing but I'm not a big fan of that as different users of
the lib might use different defaults. 

BR
Maruan

Am Mittwoch, dem 04.06.2025 um 09:54 +0200 schrieb Ulf Dittmer:
> Thank you, that put me on the right track. I had no idea about the
> inner
> workings of appearances, and your explanation taught me enough about
> it to
> substitute something in case a field has a weird one - kudos!
> 
> I'm guessing the form is mostly printed out, and filled in by hand,
> so that
> this issue hasn't surfaced before.
> 
> Cheers!
> Ulf
> 
> On Tue, Jun 3, 2025 at 10:27 PM sahyoun@fileaffairs.de <
> sahyoun@fileaffairs.de> wrote:
> 
> > Hello Ulf,
> > 
> > a typical default appearance string looks like this
> > 
> > /Helv 12 Tf 0 g
> > 
> > There are two operators Tf, to set the font, and g to set the color
> > with the arguments for the operators being supplied before.
> > 
> > Helv 12 being the arguments for Tf and
> > 0  being the argument for g
> > 
> > Your form has / 13 0 g
> > 
> > So 13 0 are being treated as arguments for the g operator. But
> > there
> > are no colors with 2 arguments. It's either 1 (Greyscale) , 3 (RGB)
> > or
> > 4 (CMYK) arguments.
> > 
> > So IMHO the default apperace string is wrong.
> > 
> > It's also very unusual that it doesn't set a font.
> > 
> > Workaround would be to set the default apperance string similar to
> > the
> > first sample above.
> > 
> > BR
> > Maruan
> > 
> > 
> > 
> > 
> > 
> > Am Dienstag, dem 03.06.2025 um 21:36 +0200 schrieb
> > sahyoun@fileaffairs.de:
> > > Hello
> > > 
> > > 
> > > Am Dienstag, dem 03.06.2025 um 17:47 +0200 schrieb Ulf Dittmer:
> > > > Hello-
> > > > 
> > > > When trying to fill in values into a form, I'm encountering the
> > > > error
> > > > shown
> > > > below, which means nothing to me. It's not just for the first
> > > > field
> > > > it
> > > > encounters - if I comment that out, it happens for the next
> > > > field.
> > > > 
> > > > The form (an official government PDF) doesn't seem different
> > > > from
> > > > any
> > > > number of other ones we are successfully filling out; it can be
> > > > found
> > > > at
> > > > https://ulfdittmer.com/pdfbox/Guide_BW.pdf
> > > 
> > > is that the original form or after setting the font?
> > > 
> > > BR
> > > Maruan
> > > 
> > > > 
> > > > The source code is also similar to other codes we use for other
> > > > forms:
> > > > https://ulfdittmer.com/pdfbox/StreamQRApplForm.java
> > > > 
> > > > It uses the following font, which is also standard
> > > > https://ulfdittmer.com/pdfbox/Arial.ttf
> > > > 
> > > > Are we doing something wrong? Is the PDF weird? Is there a way
> > > > around
> > > > this
> > > > issue?
> > > > 
> > > > Many thanks in advance for any help you can supply.
> > > > 
> > > > Ulf
> > > > 
> > > > Jun 03, 2025 5:21:00 PM org.apache.pdfbox.pdfparser.BaseParser
> > > > parseCOSDictionaryNameValuePair
> > > > WARNING: Empty COSName at offset 940
> > > > Exception in thread "main" java.io.IOException: Could not
> > > > process
> > > > default
> > > > appearance string ' 13 0 g' for field 'Name ggf Geburtsname':
> > > > Missing
> > > > operands for set non stroking color operator [COSInt{13},
> > > > COSInt{0}]
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorH
> > > > elpe
> > > > r.
> > > > <init>(AppearanceGeneratorHelper.java:123)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.construc
> > > > tApp
> > > > ea
> > > > rances(PDTextField.java:261)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.appl
> > > > yCha
> > > > ng
> > > > e(PDTerminalField.java:209)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue
> > > > (PDT
> > > > ex
> > > > tField.java:218)
> > > > at StreamQRApplForm.setField(StreamQRApplForm.java:67)
> > > > at StreamQRApplForm.main(StreamQRApplForm.java:28)
> > > > Caused by: java.io.IOException: Missing operands for set non
> > > > stroking
> > > > color
> > > > operator [COSInt{13}, COSInt{0}]
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceS
> > > > trin
> > > > g.
> > > > processSetFontColor(PDDefaultAppearanceString.java:202)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceS
> > > > trin
> > > > g.
> > > > processOperator(PDDefaultAppearanceString.java:133)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceS
> > > > trin
> > > > g.
> > > > processAppearanceStringOperators(PDDefaultAppearanceString.java
> > > > :105
> > > > )
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceS
> > > > trin
> > > > g.
> > > > <init>(PDDefaultAppearanceString.java:87)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDe
> > > > faul
> > > > tA
> > > > ppearanceString(PDVariableText.java:105)
> > > > at
> > > > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorH
> > > > elpe
> > > > r.
> > > > <init>(AppearanceGeneratorHelper.java:117)
> > > > ... 5 more
> > > 
> > > -----------------------------------------------------------------
> > > ----
> > > 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


Re: How to work around this error?

Posted by Ulf Dittmer <ul...@googlemail.com.INVALID>.
Thank you, that put me on the right track. I had no idea about the inner
workings of appearances, and your explanation taught me enough about it to
substitute something in case a field has a weird one - kudos!

I'm guessing the form is mostly printed out, and filled in by hand, so that
this issue hasn't surfaced before.

Cheers!
Ulf

On Tue, Jun 3, 2025 at 10:27 PM sahyoun@fileaffairs.de <
sahyoun@fileaffairs.de> wrote:

> Hello Ulf,
>
> a typical default appearance string looks like this
>
> /Helv 12 Tf 0 g
>
> There are two operators Tf, to set the font, and g to set the color
> with the arguments for the operators being supplied before.
>
> Helv 12 being the arguments for Tf and
> 0  being the argument for g
>
> Your form has / 13 0 g
>
> So 13 0 are being treated as arguments for the g operator. But there
> are no colors with 2 arguments. It's either 1 (Greyscale) , 3 (RGB) or
> 4 (CMYK) arguments.
>
> So IMHO the default apperace string is wrong.
>
> It's also very unusual that it doesn't set a font.
>
> Workaround would be to set the default apperance string similar to the
> first sample above.
>
> BR
> Maruan
>
>
>
>
>
> Am Dienstag, dem 03.06.2025 um 21:36 +0200 schrieb
> sahyoun@fileaffairs.de:
> > Hello
> >
> >
> > Am Dienstag, dem 03.06.2025 um 17:47 +0200 schrieb Ulf Dittmer:
> > > Hello-
> > >
> > > When trying to fill in values into a form, I'm encountering the
> > > error
> > > shown
> > > below, which means nothing to me. It's not just for the first field
> > > it
> > > encounters - if I comment that out, it happens for the next field.
> > >
> > > The form (an official government PDF) doesn't seem different from
> > > any
> > > number of other ones we are successfully filling out; it can be
> > > found
> > > at
> > > https://ulfdittmer.com/pdfbox/Guide_BW.pdf
> >
> > is that the original form or after setting the font?
> >
> > BR
> > Maruan
> >
> > >
> > > The source code is also similar to other codes we use for other
> > > forms:
> > > https://ulfdittmer.com/pdfbox/StreamQRApplForm.java
> > >
> > > It uses the following font, which is also standard
> > > https://ulfdittmer.com/pdfbox/Arial.ttf
> > >
> > > Are we doing something wrong? Is the PDF weird? Is there a way
> > > around
> > > this
> > > issue?
> > >
> > > Many thanks in advance for any help you can supply.
> > >
> > > Ulf
> > >
> > > Jun 03, 2025 5:21:00 PM org.apache.pdfbox.pdfparser.BaseParser
> > > parseCOSDictionaryNameValuePair
> > > WARNING: Empty COSName at offset 940
> > > Exception in thread "main" java.io.IOException: Could not process
> > > default
> > > appearance string ' 13 0 g' for field 'Name ggf Geburtsname':
> > > Missing
> > > operands for set non stroking color operator [COSInt{13},
> > > COSInt{0}]
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelpe
> > > r.
> > > <init>(AppearanceGeneratorHelper.java:123)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructApp
> > > ea
> > > rances(PDTextField.java:261)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyCha
> > > ng
> > > e(PDTerminalField.java:209)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDT
> > > ex
> > > tField.java:218)
> > > at StreamQRApplForm.setField(StreamQRApplForm.java:67)
> > > at StreamQRApplForm.main(StreamQRApplForm.java:28)
> > > Caused by: java.io.IOException: Missing operands for set non
> > > stroking
> > > color
> > > operator [COSInt{13}, COSInt{0}]
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > > g.
> > > processSetFontColor(PDDefaultAppearanceString.java:202)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > > g.
> > > processOperator(PDDefaultAppearanceString.java:133)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > > g.
> > > processAppearanceStringOperators(PDDefaultAppearanceString.java:105
> > > )
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > > g.
> > > <init>(PDDefaultAppearanceString.java:87)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaul
> > > tA
> > > ppearanceString(PDVariableText.java:105)
> > > at
> > > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelpe
> > > r.
> > > <init>(AppearanceGeneratorHelper.java:117)
> > > ... 5 more
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Re: How to work around this error?

Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Hello Ulf,

a typical default appearance string looks like this

/Helv 12 Tf 0 g

There are two operators Tf, to set the font, and g to set the color
with the arguments for the operators being supplied before. 

Helv 12 being the arguments for Tf and
0  being the argument for g 

Your form has / 13 0 g

So 13 0 are being treated as arguments for the g operator. But there
are no colors with 2 arguments. It's either 1 (Greyscale) , 3 (RGB) or
4 (CMYK) arguments.

So IMHO the default apperace string is wrong.

It's also very unusual that it doesn't set a font.

Workaround would be to set the default apperance string similar to the
first sample above.

BR
Maruan 





Am Dienstag, dem 03.06.2025 um 21:36 +0200 schrieb
sahyoun@fileaffairs.de:
> Hello 
> 
> 
> Am Dienstag, dem 03.06.2025 um 17:47 +0200 schrieb Ulf Dittmer:
> > Hello-
> > 
> > When trying to fill in values into a form, I'm encountering the
> > error
> > shown
> > below, which means nothing to me. It's not just for the first field
> > it
> > encounters - if I comment that out, it happens for the next field.
> > 
> > The form (an official government PDF) doesn't seem different from
> > any
> > number of other ones we are successfully filling out; it can be
> > found
> > at
> > https://ulfdittmer.com/pdfbox/Guide_BW.pdf
> 
> is that the original form or after setting the font?
> 
> BR
> Maruan
> 
> > 
> > The source code is also similar to other codes we use for other
> > forms:
> > https://ulfdittmer.com/pdfbox/StreamQRApplForm.java
> > 
> > It uses the following font, which is also standard
> > https://ulfdittmer.com/pdfbox/Arial.ttf
> > 
> > Are we doing something wrong? Is the PDF weird? Is there a way
> > around
> > this
> > issue?
> > 
> > Many thanks in advance for any help you can supply.
> > 
> > Ulf
> > 
> > Jun 03, 2025 5:21:00 PM org.apache.pdfbox.pdfparser.BaseParser
> > parseCOSDictionaryNameValuePair
> > WARNING: Empty COSName at offset 940
> > Exception in thread "main" java.io.IOException: Could not process
> > default
> > appearance string ' 13 0 g' for field 'Name ggf Geburtsname':
> > Missing
> > operands for set non stroking color operator [COSInt{13},
> > COSInt{0}]
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelpe
> > r.
> > <init>(AppearanceGeneratorHelper.java:123)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructApp
> > ea
> > rances(PDTextField.java:261)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyCha
> > ng
> > e(PDTerminalField.java:209)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDT
> > ex
> > tField.java:218)
> > at StreamQRApplForm.setField(StreamQRApplForm.java:67)
> > at StreamQRApplForm.main(StreamQRApplForm.java:28)
> > Caused by: java.io.IOException: Missing operands for set non
> > stroking
> > color
> > operator [COSInt{13}, COSInt{0}]
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > g.
> > processSetFontColor(PDDefaultAppearanceString.java:202)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > g.
> > processOperator(PDDefaultAppearanceString.java:133)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > g.
> > processAppearanceStringOperators(PDDefaultAppearanceString.java:105
> > )
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceStrin
> > g.
> > <init>(PDDefaultAppearanceString.java:87)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaul
> > tA
> > ppearanceString(PDVariableText.java:105)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelpe
> > r.
> > <init>(AppearanceGeneratorHelper.java:117)
> > ... 5 more
> 
> ---------------------------------------------------------------------
> 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


Re: How to work around this error?

Posted by Ulf Dittmer <ul...@googlemail.com.INVALID>.
That is the original form.

On Tue, 3 Jun 2025, 21:36 sahyoun@fileaffairs.de, <sa...@fileaffairs.de>
wrote:

> Hello
>
>
> Am Dienstag, dem 03.06.2025 um 17:47 +0200 schrieb Ulf Dittmer:
> > Hello-
> >
> > When trying to fill in values into a form, I'm encountering the error
> > shown
> > below, which means nothing to me. It's not just for the first field
> > it
> > encounters - if I comment that out, it happens for the next field.
> >
> > The form (an official government PDF) doesn't seem different from any
> > number of other ones we are successfully filling out; it can be found
> > at
> > https://ulfdittmer.com/pdfbox/Guide_BW.pdf
>
> is that the original form or after setting the font?
>
> BR
> Maruan
>
> >
> > The source code is also similar to other codes we use for other
> > forms:
> > https://ulfdittmer.com/pdfbox/StreamQRApplForm.java
> >
> > It uses the following font, which is also standard
> > https://ulfdittmer.com/pdfbox/Arial.ttf
> >
> > Are we doing something wrong? Is the PDF weird? Is there a way around
> > this
> > issue?
> >
> > Many thanks in advance for any help you can supply.
> >
> > Ulf
> >
> > Jun 03, 2025 5:21:00 PM org.apache.pdfbox.pdfparser.BaseParser
> > parseCOSDictionaryNameValuePair
> > WARNING: Empty COSName at offset 940
> > Exception in thread "main" java.io.IOException: Could not process
> > default
> > appearance string ' 13 0 g' for field 'Name ggf Geburtsname': Missing
> > operands for set non stroking color operator [COSInt{13}, COSInt{0}]
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.
> > <init>(AppearanceGeneratorHelper.java:123)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppea
> > rances(PDTextField.java:261)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChang
> > e(PDTerminalField.java:209)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTex
> > tField.java:218)
> > at StreamQRApplForm.setField(StreamQRApplForm.java:67)
> > at StreamQRApplForm.main(StreamQRApplForm.java:28)
> > Caused by: java.io.IOException: Missing operands for set non stroking
> > color
> > operator [COSInt{13}, COSInt{0}]
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> > processSetFontColor(PDDefaultAppearanceString.java:202)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> > processOperator(PDDefaultAppearanceString.java:133)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> > processAppearanceStringOperators(PDDefaultAppearanceString.java:105)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> > <init>(PDDefaultAppearanceString.java:87)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaultA
> > ppearanceString(PDVariableText.java:105)
> > at
> > org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.
> > <init>(AppearanceGeneratorHelper.java:117)
> > ... 5 more
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: How to work around this error?

Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Hello 


Am Dienstag, dem 03.06.2025 um 17:47 +0200 schrieb Ulf Dittmer:
> Hello-
> 
> When trying to fill in values into a form, I'm encountering the error
> shown
> below, which means nothing to me. It's not just for the first field
> it
> encounters - if I comment that out, it happens for the next field.
> 
> The form (an official government PDF) doesn't seem different from any
> number of other ones we are successfully filling out; it can be found
> at
> https://ulfdittmer.com/pdfbox/Guide_BW.pdf

is that the original form or after setting the font?

BR
Maruan

> 
> The source code is also similar to other codes we use for other
> forms:
> https://ulfdittmer.com/pdfbox/StreamQRApplForm.java
> 
> It uses the following font, which is also standard
> https://ulfdittmer.com/pdfbox/Arial.ttf
> 
> Are we doing something wrong? Is the PDF weird? Is there a way around
> this
> issue?
> 
> Many thanks in advance for any help you can supply.
> 
> Ulf
> 
> Jun 03, 2025 5:21:00 PM org.apache.pdfbox.pdfparser.BaseParser
> parseCOSDictionaryNameValuePair
> WARNING: Empty COSName at offset 940
> Exception in thread "main" java.io.IOException: Could not process
> default
> appearance string ' 13 0 g' for field 'Name ggf Geburtsname': Missing
> operands for set non stroking color operator [COSInt{13}, COSInt{0}]
> at
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.
> <init>(AppearanceGeneratorHelper.java:123)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppea
> rances(PDTextField.java:261)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChang
> e(PDTerminalField.java:209)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTex
> tField.java:218)
> at StreamQRApplForm.setField(StreamQRApplForm.java:67)
> at StreamQRApplForm.main(StreamQRApplForm.java:28)
> Caused by: java.io.IOException: Missing operands for set non stroking
> color
> operator [COSInt{13}, COSInt{0}]
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> processSetFontColor(PDDefaultAppearanceString.java:202)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> processOperator(PDDefaultAppearanceString.java:133)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> processAppearanceStringOperators(PDDefaultAppearanceString.java:105)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDDefaultAppearanceString.
> <init>(PDDefaultAppearanceString.java:87)
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.getDefaultA
> ppearanceString(PDVariableText.java:105)
> at
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.
> <init>(AppearanceGeneratorHelper.java:117)
> ... 5 more

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org