pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Retrieve the format of a date field in PDF
Date Fri, 17 Oct 2014 14:15:39 GMT
Hi Rajeev,

unfortunately not as the whole content of the COSString is the JavaScript call. AFDate_FormatEx
is a JavaScript method defined within Adobe Acrobat taking the format as a parameter.

BR

Maruan

Am 17.10.2014 um 15:58 schrieb Rajeev Menon <rajeevrmenong@gmail.com>:

> Hi Maruan,
> 
> Thanks for putting me in the right direction. I tried the following to get
> the details in the actions object.
> 
>                System.out.println("actions K:
> "+field.getActions().getCOSDictionary().getDictionaryObject("K"));
>                System.out.println("actions F:
> "+field.getActions().getCOSDictionary().getDictionaryObject("F"));
> 
> Here is the content of the COSDictionary.
> 
> COSDictionary{
> (COSName{F}:COSDictionary{(COSName{JS}:COSString{AFDate_FormatEx("*yyyymmdd*");})
> 
> (COSName{S}:COSName{JavaScript}) })
> (COSName{K}:COSDictionary{(COSName{JS}:COSString{AFDate_Keysd");})
> (COSName{S}:COSName{JavaScrit}) })
> }
> Is there any direct method to extract the "yyyymmdd" instead of doing
> string operations on this text?
> 
> Thanks,
> Rajeev.
> 
> On Thu, Oct 16, 2014 at 2:01 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
> wrote:
> 
>> Hi Rajeev,
>> 
>> there is no such thing like a date field in PDF. Date fields are
>> represented as regular text field with some JavaScript (if you define them
>> in Acrobat). You can get the field actions with
>> 
>> 
>> http://pdfbox.apache.org/docs/1.8.6/javadocs/org/apache/pdfbox/pdmodel/interactive/form/PDField.html#getActions()
>> 
>> BR
>> Maruan
>> 
>> Am 16.10.2014 um 19:49 schrieb Rajeev Menon <rajeevrmenong@gmail.com>:
>> 
>>> All,
>>> 
>>> I am trying to find if a field is of type Date and if yes, what is the
>>> format (like yyyymmdd) of the date (in a Flat PDF). I tried the following
>>> lines of code to see if anything helps, but no luck.
>>> 
>>>               if (fldPD!=null) {
>>> 
>>> 
>> System.out.println("*************"+entryData.getKey()+"*****************");
>>>                   System.out.println("subtype =
>>> "+fldPD.getWidget().getSubtype());
>>>                   System.out.println("annotName =
>>> "+fldPD.getWidget().getAnnotationName());
>>>                   System.out.println("hilit =
>>> "+fldPD.getWidget().getHighlightingMode());
>>>                   System.out.println("fldFlags =
>> "+fldPD.getFieldFlags());
>>>                   System.out.println("contents =
>>> "+fldPD.getWidget().getContents());
>>>                   System.out.println("appeStream =
>>> "+fldPD.getWidget().getAppearanceStream());
>>>                   //fldPD.setValue(entryData.getValue());
>>>               }
>>> 
>>> Please help me here.
>>> 
>>> Thanks,
>> 
>> 


Mime
View raw message