pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: PDFBox form fields help
Date Fri, 10 Jun 2011 11:23:26 GMT
Sent... Please let me know if you need anything else.

On Fri, Jun 10, 2011 at 1:18 PM, Thomas Chojecki <info@rayman2200.de> wrote:

>
> Zitat von Gilad Denneboom <gilad.denneboom@gmail.com>:
>
>  Well, I've found the code, but I must say it's not very clear to me what I
>> need to use from it. First of all, the comments are in German, and my
>> German
>> is a bit rusty...
>>
>
> I will try to translate it by time.
>
>
>  But beyond that, it seems most things are Signature-specific and some of
>> the
>> methods do not exist at all in version 1.5.0 (like needToBeUpdate on
>> COSBase).
>>
>
> The field is signature specific, the annotation is a normal widget. But
> thats no problem to use the right Fields / Annotations.
>
> needToBeUpdate is specific for incremental updates and you don't need it.
>
>
>
>> Here's my new code (the definition of textField is the same as above):
>>
>>        PDDocumentCatalog root = doc.getDocumentCatalog();
>>        PDAcroForm acroForm = root.getAcroForm();
>>
>>        // Set the widget's page
>>        PDPage page0 = (PDPage) root.getAllPages().get(0);
>>        textField.getWidget().getDictionary().setItem(COSName.P, page0); //
>> instead of PDAnnotation.setPage()
>>
>
> Both should do the same.
>
>
>         // Add the field to AcroForm
>>        List acroFormFields = acroForm.getFields();
>>        acroFormFields.add(textField);
>>
>>        // Add the widget to the page's annotations
>>        List annotations = page0.getAnnotations();
>>        if (annotations== null)
>>        {
>>          annotations = new COSArrayList();
>>        }
>>        annotations.add(textField.getWidget());
>>        page0.setAnnotations(annotations);
>>        //page0.getCOSObject().setNeedToBeUpdate(true);
>>
>> The result also shows the malformed message when I open the JS console and
>> the field is still not visible/accessible.
>>
>
> Thats bad, I use the same way to include visual signatures inside the
> document. Can you please mail me the malformed pdf? i think attachments
> aren't allowed in the mailinglist.
>
> Best Regards
> Thomas
>
>
>

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