I am almost certain that the expected order is basically top-left to
bottom-right, yes. Currently there is no calculation being used that I
know of.
Flattening: The issue isn't in the actual flattening itself. I need to
explain more about the way the PDFs are used.
The proprietary software is running as a web service where we upload
multiple "forms" in PDF form as a library. At the simplest level, the
fields on the form are one of two types.
Field Type 1 is an internal field name that the software matches to
internal data that it uses to set the field's value. Say, if the field
name is "Policy.PolicyNumber" then it sets the field's contents to its
internal data for the Policy # data that it has... and that is what it
uses when it flattens the PDF.
Field Type 2 has a user-defined field name and the software (during the
process of generating the output PDF, before flattening the fields)
prompts the user for each user-defined field's contents that will be
used during the flattening.
There is a configuration page for each form that allows some control
over the prompting of data from the user (validation constraints,
descriptive names for prompts, etc.) and a basic way to reorder the
order that the fields are processed (drag and drop a field up or down in
the order, one field at a time), but if the form is edited in any way,
this order "resets" to one based off of the PDF's contents.
Some forms have hundreds of fields on them and so we are having
semi-technical people trying to "build out" multiple forms and getting
very frustrated when they need to make a small change in an edition of a
form and suddenly the order is reset to an unexpected order (I believe
the same order that fields/widgets appear in the PDFBox debugger's
"internal structure" tree view under Root/Catalog -> AcroForm -> Fields)
when they re-upload the PDF file.
Why this order is important (for the Type 2 fields only) is that we want
the user to be prompted for each user-defined field in order from
top-left to bottom-right, row by row. When the order is off, this is no
longer possible.
No errors are thrown as the proprietary software will happily prompt the
user for the user-defined fields, but... it is adding hours to the form
updating time and starting to drive our semi-technical people crazy.
One other approach is to figure out how to force the order of the fields
in Acrobat (which can be changed by dragging the fields up/down to
position them in the list of field names) to be "honored" when it writes
out the PDF contents to a file. It doesn't appear to do so. And it
also sometimes creates Fields with Widgets as "Kids" and fields with the
Widget data combined with the Field data when new fields are created via
copy/paste... all of this I had hoped to handle with a "cleanup"
utility that would take the user-edited PDFs as a source and create
cleaned up PDFs as separate output files.
I hope that that makes more sense on the why. Thanks for listening!!!
- Dwayne
On 1/30/2024 3:33 PM, sahy...@fileaffairs.de wrote:
what is the expected order? Is it by location, top left to bottom
right? Calculation order ...
Never heard that order matters for flattening. Is the proprietry
software throwing any errors which would be a hint?
BR
Maruan
Am Dienstag, dem 30.01.2024 um 15:27 -0600 schrieb Dwayne Parks:
Hello list!
I'm dealing with a proprietary software product that accepts PDFs
with
fields in them to "flatten" into a final output PDF. The difficulty
is
that it expects the ordering of the fields (or their associated
widgets)
to be in a certain order. I don't know the exact details of this,
but
it takes much trial and error for our folks here manually deleting
and
recreating fields, trying them and seeing if they are accepted.
So, to greatly streamline the process of getting the field/widget
content in the PDF files in a correct order, I would like to write a
utility that takes a configuration file containing a list of Field
Names
and reorders the content in the PDF to match the order they are in
the
configuration file.
My naive initial idea is to:
- Write a utility that outputs the current list of fields (in the
PDF in the order that they are there) into a config file
- Allow a user to reorder the lines of field names as desired
- Write a utility that takes the config file and the PDF and
rebuilds the field list/tree in the order that the config file
specifies... then writes out the updated PDF contents to a new
PDF file
Alternately, I believe that there is an order for forms/widgets that
is
specified in Adobe Acrobat (tab order?) that I might be able to try
to
try to recreate. I'm not sure if that will work, but it would allow
non-technical users to define the needed order without intervention
from
technical staff.
I realize that there might be issues with combined field/widget
fields
if it comes to needing to order the widgets instead, but I am wanting
to
start with the above and go from there.
So, I have a few questions to start with that someone might be able
to
help me out with!
- Are there any examples of doing this sort of order modification?
- Is it possible to reorder field contents at the PDDocument /
PDAcroForm / PDField level?
- Is it possible to reorder widget annotations at the PDAnnotiation /
PDAnnotationWidget level?
- Do I need to drop down to the COS* object level to do this?
Thanks in advance for any pointers, info or suggestions!
- Dwayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org