Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6FB834F75 for ; Fri, 10 Jun 2011 11:19:25 +0000 (UTC) Received: (qmail 22468 invoked by uid 500); 10 Jun 2011 11:19:25 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 22451 invoked by uid 500); 10 Jun 2011 11:19:25 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 22442 invoked by uid 99); 10 Jun 2011 11:19:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 11:19:25 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of info@rayman2200.de designates 80.67.31.41 as permitted sender) Received: from [80.67.31.41] (HELO smtprelay03.ispgateway.de) (80.67.31.41) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 11:19:16 +0000 Received: from [80.67.16.112] (helo=webmailfront02.ispgateway.de) by smtprelay03.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1QUzjp-0003rJ-Qb for users@pdfbox.apache.org; Fri, 10 Jun 2011 13:18:53 +0200 Received: from p01e.bremen.de (p01e.bremen.de [194.95.255.66]) by webmail.df.eu (Horde Framework) with HTTP; Fri, 10 Jun 2011 13:18:53 +0200 Message-ID: <20110610131853.100161ztffh0pv48@webmail.df.eu> Date: Fri, 10 Jun 2011 13:18:53 +0200 From: Thomas Chojecki To: users@pdfbox.apache.org Subject: Re: PDFBox form fields help References: <4DF1D329.6010906@lehmi.de> <20110610110306.323630u6euxefow0@webmail.df.eu> <20110610114923.210048lpktjcugu8@webmail.df.eu> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.2) X-Originating-IP: 194.95.255.66 X-Df-Sender: 1067930 Zitat von Gilad Denneboom : > 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