pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PDFBox AcroForm: timeline? or how to make multiple copies of a page into one file?
Date Wed, 25 Jul 2018 04:38:39 GMT

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.


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

View raw message