From users-return-11154-archive-asf-public=cust-asf.ponee.io@pdfbox.apache.org Wed Jul 25 06:39:03 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4D3DF18062C for ; Wed, 25 Jul 2018 06:39:03 +0200 (CEST) Received: (qmail 2376 invoked by uid 500); 25 Jul 2018 04:39:02 -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 2365 invoked by uid 99); 25 Jul 2018 04:39:01 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jul 2018 04:39:01 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 05F6E1A09EA for ; Wed, 25 Jul 2018 04:39:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.98 X-Spam-Level: X-Spam-Status: No, score=0.98 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id nIV8wBAHmISO for ; Wed, 25 Jul 2018 04:38:59 +0000 (UTC) Received: from mailout09.t-online.de (mailout09.t-online.de [194.25.134.84]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 21C515F1F3 for ; Wed, 25 Jul 2018 04:38:59 +0000 (UTC) Received: from fwd02.aul.t-online.de (fwd02.aul.t-online.de [172.20.26.148]) by mailout09.t-online.de (Postfix) with SMTP id 7321F425E269 for ; Wed, 25 Jul 2018 06:38:52 +0200 (CEST) Received: from [192.168.2.108] (X7RT6OZvwhJ0kuoIi6WOx50P4yd9U-x8eTfoaqPjCrelNO4IhlLWWWIT2Nl9EVYgjw@[217.231.132.199]) by fwd02.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1fiBZS-081RTM0; Wed, 25 Jul 2018 06:38:42 +0200 Subject: Re: PDFBox AcroForm: timeline? or how to make multiple copies of a page into one file? To: users@pdfbox.apache.org References: From: Tilman Hausherr Message-ID: Date: Wed, 25 Jul 2018 06:38:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-ID: X7RT6OZvwhJ0kuoIi6WOx50P4yd9U-x8eTfoaqPjCrelNO4IhlLWWWIT2Nl9EVYgjw X-TOI-MSGID: ed2845a9-a664-45c0-965c-c3fa94c5cbd6 Hi, The pages have only the widget annotations. The form fields are related to the document catalog. Each field has one or more widgets. So it's more tricky. The best would be to create a copy of the document and then delete pages. Tilman Am 25.07.2018 um 00:29 schrieb Dagnon, William: > Hello all, newb here; > > I have a source PDF file, and I need to build a new file from it by selectively copying/not copying/duplicating pages, and filling out annotated fields in the new file. Eg. sometimes the new file will have 6 pages, sometimes it will have 10 pages. > > So far, my searches haven't turned up people asking questions about quite this situation: > > 1. one or more of the pages are forms, eg. have annotated fields and need to fill them in. > 2. one of the form pages needs to get repeated in certain circumstances - mine is a table-of-inputs page with a header. May need zero, may need 1 or more copies filled out. > > I don't have a deep understanding of how the PDFBox operates, so I tried my simplistic version from the Javadocs and some Google-fu: > pddoc.importPage(originalDoc.getPage(0)); > cat = pddoc.getDocumentCatalog(); > acroForm = cat.getAcroForm();// returns null > field = acroForm.getField("name");// blows up with an NPE > > Meaning there is no PDAcroForm in the new PDDocument after I copy the first page, which has form fields. At least no cached version, according to my debugger. How do I get it to generate an appropriate AcroForm? Or do I need to wait for an AcroForm until all pages, or at least all field-containing pages, are in my pddoc before doing that? > > My secondary question addresses #2 above: how can I have 2 copies of the same page (form), and annotated elements, in one PDDocument? Does the 2nd copy of the PDPage need to rename all fields so all annotation names remain unique? Or can I operate on a copy of the PDPage and then import it into the final pddoc (assuming once the page has values, names won't interfere with existing names in the same PDDocument)? > > Websites, example code, deeper knowledge all appreciated! > > > P.S. and thanks to daedtech.com for getting me started! > > CONFIDENTIALITY NOTICE: This e-mail, including any attachments, may contain confidential, privileged and/or proprietary information which is solely for the use of the intended recipient(s). Any review, use, disclosure, or retention by others is strictly prohibited. If you are not an intended recipient, please contact the sender and delete this e-mail, any attachments, and all copies. > > --------------------------------------------------------------------- > 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