You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Dick Martin <rt...@nycap.rr.com> on 2017/03/18 16:19:09 UTC

FDF field value issue with PDFBox 2.0.5 - COSString{value}

I'm using PDFBox to fill form fields with data from XFDF files using PDFBox
to convert XFDF to FDF.
With 2.0.4, values are filled as expected.

When trying 2.0.5, I find that fdf field values are "enclosed" like this:
COSString{Tester, Richard     (Dick)}

Using the same code with 2.0.4, that same value is returned as expected
like this:
Tester, Richard     (Dick)

Is there something I should be doing differently in 2.0.5 to accommodate
the COSString "wrapper"?  Or is it a 2.0.5 issue?

Here is a code snippet showing how my code iterates through the FDF fields
and gets the field values.  I know this may be out of context.  I can
provide more detail if needed.

List<?> fields = fdf.getCatalog().getFDF().getFields();
if( fields != null )
{
    String defaultAppearanceString = "/Helv 0 Tf 0 g";
    for (Object field : fields)
    {
        FDFField fdfField = (FDFField) field;
        String fdfName, fdfValue;
        Integer fdfNameLen;
        Integer fdfValueLen;
        fdfName =  fdfField.getPartialFieldName() ;
        fdfValue = String.valueOf(fdfField.getValue());
        fdfNameLen = fdfName.length();
        fdfValueLen = fdfValue.length();


Thanks.
Dick Martin

Re: FDF field value issue with PDFBox 2.0.5 - COSString{value}

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,

> Am 18.03.2017 um 20:39 schrieb Dick Martin <rt...@nycap.rr.com>:
> 
> Mauran,
> Thanks.  Apparently whatever was masking it in 2.0.4 was what was making it
> work OK for me.
> I'll prepare a unit test and sample file(s); probably not until tomorrow.
> Do I post the files to the bug ticket?  Or make them available by Dropbox
> or such means?

the easiest would be to attach them to the ticket.
Thanks in advance.

> Thanks.
> Dick
> 
> On Sat, Mar 18, 2017 at 2:58 PM, Maruan Sahyoun <sa...@fileaffairs.de>
> wrote:
> 
>> Hi,
>> 
>> that's a bug in PDFBox which also exists in PDFBox 2.0.x for 2.0.4 and
>> earlier but was masked by another issue. I've opened PDFBOX-3723 for that.
>> Please comment if you don't think the description matches your issue. It
>> would also be good to have some sample files and a unit test with the
>> expected results.
>> 
>> BR
>> Maruan
>> 
>>> Am 18.03.2017 um 17:19 schrieb Dick Martin <rt...@nycap.rr.com>:
>>> 
>>> I'm using PDFBox to fill form fields with data from XFDF files using
>> PDFBox
>>> to convert XFDF to FDF.
>>> With 2.0.4, values are filled as expected.
>>> 
>>> When trying 2.0.5, I find that fdf field values are "enclosed" like this:
>>> COSString{Tester, Richard     (Dick)}
>>> 
>>> Using the same code with 2.0.4, that same value is returned as expected
>>> like this:
>>> Tester, Richard     (Dick)
>>> 
>>> Is there something I should be doing differently in 2.0.5 to accommodate
>>> the COSString "wrapper"?  Or is it a 2.0.5 issue?
>>> 
>>> Here is a code snippet showing how my code iterates through the FDF
>> fields
>>> and gets the field values.  I know this may be out of context.  I can
>>> provide more detail if needed.
>>> 
>>> List<?> fields = fdf.getCatalog().getFDF().getFields();
>>> if( fields != null )
>>> {
>>>   String defaultAppearanceString = "/Helv 0 Tf 0 g";
>>>   for (Object field : fields)
>>>   {
>>>       FDFField fdfField = (FDFField) field;
>>>       String fdfName, fdfValue;
>>>       Integer fdfNameLen;
>>>       Integer fdfValueLen;
>>>       fdfName =  fdfField.getPartialFieldName() ;
>>>       fdfValue = String.valueOf(fdfField.getValue());
>>>       fdfNameLen = fdfName.length();
>>>       fdfValueLen = fdfValue.length();
>>> 
>>> 
>>> Thanks.
>>> Dick Martin
>> 
>> 
>> ---------------------------------------------------------------------
>> 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: pdfbox.net

Posted by chitgoks <ch...@gmail.com>.
hi tilman ok

yeah i tead about instructions on porting to .net

not sure though if bug is reproducible in java cuz i use 2.0.4

i justed wanted to make a c# equivalent. thats the only issue ive come
across with

guess ill just leave t as it is

On Sun, 19 Mar 2017 at 3:59 PM Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 19.03.2017 um 01:43 schrieb chitgoks:
> > can i also ask questions regarding pdfbox ikvm .net here?
>
> Sure, but I don't know if it will be answered.
>
>
> >
> > even if it is only version 1.8.7?
>
> That is several years old.
>
> >
> > are you guys responsible for porting it?
>
> No... nobody is. You can use IKVM yourself to create a .net version of
> PDFBox, in theory.
>
> >
> > cuz there is a bug when creating annotations regarding cosname.m and
> > creationdate it always sets it to jan 1,1970
>
>
> Is the bug reproducible in java with 1.8.13 ?
>
>
> Tilman
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
> --
Website/Java Games: http://www.chitgoks.com
My Blogs:
http://tech.chitgoks.com
http://wuhtevah.chitgoks.com
http://disneyusa.blogspot.com

Re: pdfbox.net

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 19.03.2017 um 01:43 schrieb chitgoks:
> can i also ask questions regarding pdfbox ikvm .net here?

Sure, but I don't know if it will be answered.


>
> even if it is only version 1.8.7?

That is several years old.

>
> are you guys responsible for porting it?

No... nobody is. You can use IKVM yourself to create a .net version of 
PDFBox, in theory.

>
> cuz there is a bug when creating annotations regarding cosname.m and
> creationdate it always sets it to jan 1,1970


Is the bug reproducible in java with 1.8.13 ?


Tilman



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


pdfbox.net

Posted by chitgoks <ch...@gmail.com>.
can i also ask questions regarding pdfbox ikvm .net here?

even if it is only version 1.8.7?

are you guys responsible for porting it?

cuz there is a bug when creating annotations regarding cosname.m and
creationdate it always sets it to jan 1,1970
-- 
Website/Java Games: http://www.chitgoks.com
My Blogs:
http://tech.chitgoks.com
http://wuhtevah.chitgoks.com
http://disneyusa.blogspot.com

Re: FDF field value issue with PDFBox 2.0.5 - COSString{value}

Posted by Dick Martin <rt...@nycap.rr.com>.
Mauran,
Thanks.  Apparently whatever was masking it in 2.0.4 was what was making it
work OK for me.
I'll prepare a unit test and sample file(s); probably not until tomorrow.
Do I post the files to the bug ticket?  Or make them available by Dropbox
or such means?
Thanks.
Dick

On Sat, Mar 18, 2017 at 2:58 PM, Maruan Sahyoun <sa...@fileaffairs.de>
wrote:

> Hi,
>
> that's a bug in PDFBox which also exists in PDFBox 2.0.x for 2.0.4 and
> earlier but was masked by another issue. I've opened PDFBOX-3723 for that.
> Please comment if you don't think the description matches your issue. It
> would also be good to have some sample files and a unit test with the
> expected results.
>
> BR
> Maruan
>
> > Am 18.03.2017 um 17:19 schrieb Dick Martin <rt...@nycap.rr.com>:
> >
> > I'm using PDFBox to fill form fields with data from XFDF files using
> PDFBox
> > to convert XFDF to FDF.
> > With 2.0.4, values are filled as expected.
> >
> > When trying 2.0.5, I find that fdf field values are "enclosed" like this:
> > COSString{Tester, Richard     (Dick)}
> >
> > Using the same code with 2.0.4, that same value is returned as expected
> > like this:
> > Tester, Richard     (Dick)
> >
> > Is there something I should be doing differently in 2.0.5 to accommodate
> > the COSString "wrapper"?  Or is it a 2.0.5 issue?
> >
> > Here is a code snippet showing how my code iterates through the FDF
> fields
> > and gets the field values.  I know this may be out of context.  I can
> > provide more detail if needed.
> >
> > List<?> fields = fdf.getCatalog().getFDF().getFields();
> > if( fields != null )
> > {
> >    String defaultAppearanceString = "/Helv 0 Tf 0 g";
> >    for (Object field : fields)
> >    {
> >        FDFField fdfField = (FDFField) field;
> >        String fdfName, fdfValue;
> >        Integer fdfNameLen;
> >        Integer fdfValueLen;
> >        fdfName =  fdfField.getPartialFieldName() ;
> >        fdfValue = String.valueOf(fdfField.getValue());
> >        fdfNameLen = fdfName.length();
> >        fdfValueLen = fdfValue.length();
> >
> >
> > Thanks.
> > Dick Martin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: FDF field value issue with PDFBox 2.0.5 - COSString{value}

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,

that's a bug in PDFBox which also exists in PDFBox 2.0.x for 2.0.4 and earlier but was masked by another issue. I've opened PDFBOX-3723 for that. Please comment if you don't think the description matches your issue. It would also be good to have some sample files and a unit test with the expected results.

BR
Maruan

> Am 18.03.2017 um 17:19 schrieb Dick Martin <rt...@nycap.rr.com>:
> 
> I'm using PDFBox to fill form fields with data from XFDF files using PDFBox
> to convert XFDF to FDF.
> With 2.0.4, values are filled as expected.
> 
> When trying 2.0.5, I find that fdf field values are "enclosed" like this:
> COSString{Tester, Richard     (Dick)}
> 
> Using the same code with 2.0.4, that same value is returned as expected
> like this:
> Tester, Richard     (Dick)
> 
> Is there something I should be doing differently in 2.0.5 to accommodate
> the COSString "wrapper"?  Or is it a 2.0.5 issue?
> 
> Here is a code snippet showing how my code iterates through the FDF fields
> and gets the field values.  I know this may be out of context.  I can
> provide more detail if needed.
> 
> List<?> fields = fdf.getCatalog().getFDF().getFields();
> if( fields != null )
> {
>    String defaultAppearanceString = "/Helv 0 Tf 0 g";
>    for (Object field : fields)
>    {
>        FDFField fdfField = (FDFField) field;
>        String fdfName, fdfValue;
>        Integer fdfNameLen;
>        Integer fdfValueLen;
>        fdfName =  fdfField.getPartialFieldName() ;
>        fdfValue = String.valueOf(fdfField.getValue());
>        fdfNameLen = fdfName.length();
>        fdfValueLen = fdfValue.length();
> 
> 
> Thanks.
> Dick Martin


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