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 10:57:32 GMT
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...
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).

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()

        // 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.

On Fri, Jun 10, 2011 at 11:49 AM, Thomas Chojecki <info@rayman2200.de>wrote:

>
> Zitat von Gilad Denneboom <gilad.denneboom@gmail.com>:
>
>  Hi Thomas,
>>
> Hi Gilad
>
>
>  Thanks for the info!
>> However, I don't see any method called addSignature under PDDocument...
>>
> The code is available in the project trunk for the future pdfbox 1.6
> release.
>
>
>  Also, I've sent a detailed description of my code about an hour ago. Did
>> it
>> not come through?
>>
> Just a sec after i send my mail, i got yours. :)
>
> I will take a look at the code at home, but I hope you can take a look at
> the new pdfbox 1.6 snapshot from svn and solve it on your won :-)
>
>  Gilad
>>
> Best Regards
> Thomas
>
>
>

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