I have made a number of single page Forms with Open Office and exported them to PDF documents.
I my application I open up the a number of these pdf documents, fill in the form elements and combine them and save.
In am printing out a List onto each row of a particular form. The trouble is that if the list exceeds the size of the page, I need to duplicate the page and append the rest of the items on the remaining page.
There appears to be a problem having multiple field names on a document with the same name, only the first field has a value, subsequent fields with the same name are blank.
The code is something like this, I dont have the exact code with me right now.
org.pdfclown.files.File output = new org.pdfclown.files.File();
PageManager pageManager = new PageManager(output.getDocument());
for(org.pdfclown.files.File pdfPage : pdfPages) {
//fill in the form element ...
pdfPage.getDocument().getForm().getFields().get("some_field").setValue("something");
pageManager.add(pdfPage.getDocument());
}
java.io.File temp = Files.createTempFile("Test", ".pdf").toFile();
output.save(temp, SerializationModeEnum.Standard);
I noticed that when I export from OpenOffice there is a checkbox to allow duplicate form names. Has anyone had this issue before? Is there something in the API that allows duplicate form names to display with different values?
I never actually solved this problem but I did work out an alternative. On each page I iterated over all the form elements and changed their names by adding "[x]" where the 'x' is the page number. This made each pages form elements unique.