phax / ph-pdf-layout

Java library for creating fluid page layouts with Apache PDFBox. Supporting multi-page tables, different page layouts etc.
Apache License 2.0
64 stars 11 forks source link

Creating .pdf form file based on already prepared document template in .doc/.docx/.pdf filled with JSON data incoming from UI (frontend) #39

Closed arESrv closed 1 month ago

arESrv commented 1 month ago

Hi everyone.

It's not strictly an issue, but rather a question.

I have this scenario: there's a form on a frontend I need to fill, validate and send the data to backend as a JSON, so backend will be able to use the data to prepare .pdf form.

The forms templates were initially printed on paper and filled by hand, but now the organization wants to digitalize it and partially automate filling the template form so result will be a completed .pdf file.

I have two forms templates as a MS Word type files (.docx) - but since Word can convert .docx to .pdf so the templates can be also .pdf files - which I need to populate with this data I'm getting from UI.

Both .docx templates are already formatted, with all needed fields, images, colors .etc placed in particular order - only thing I need to do is just automate copying the template file, read it to get the template's structure, fill the copied template with data (fill the fields inside/outside tables, check checkboxes, circle or underscore "Yes/No" answers in fields outside/inside tables, fill text boxes with id numbers .etc) and convert it to .pdf.

Does the ph-pdf-layout library can load the already prepared form template of .doc/.docx/.pdf type, as a base for form creation, recognize all the structure of fields available/needed to be filled, fill them with data and prepare the .pdf form file?

If it's not that easy, what additional steps or tools alongside using ph-pdf-layout I'd need to utilize? Or maybe even use completely different library?

Thanks!