2

I'd like to merge at least 2 PDF files into one while preserving all the form elements in the original PDFs. The form elements include text fields, radio buttons, check boxes, drop down menus and others. Please have a look at this sample PDF file with forms:

http://foersom.com/net/HowTo/data/OoPdfFormExample.pdf

Now try to merge it with any other arbitrary PDF file.

Can you do it?

EDIT: As for the implementation, I'd ideally prefer a command line solution on a linux plattform using open source tools such as 'ghostscript', or any other tool that you think is appropriate to solve this task.

Of course, everybody is welcome to supply any working solution to this problem, including a coded solution that involves writing a script which makes some API calls to a pdf-processing library. However, I'd suggest to take the path of least resistance first (CMD Solution).

Best Regards

EDIT #2: Well there are indeed several CMD tools that merge PDFs. However, these tools don't seem to, AFAIK, to preserve the forms in the original PDFs! These tools appear to simply just concatenate the printouts of all those PDFs into a single Printout, which is then presented as a single PDF.

Furthermore, If you printout a PDF file with forms into a file, you lose all the forms in it. This clearly not what I'm looking for.

  • In which programming language do you want to write that merging code? Which pdf library do you want to use? – mkl Jul 05 '20 at 06:07
  • Hello mkl, thanks for taking the time to respond :D I've updated the original question to include a description of the preferred technical implementation. – Thomas Jordan Jul 05 '20 at 12:53
  • Does this answer your question? [Merge / convert multiple PDF files into one PDF](https://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf) – Vitaliy Shibaev Jul 07 '20 at 03:06
  • Hello Vitaliy Shibaev , thanks for suggesting an answer. Unfortunately, that thread - which I've checked out before writing this question - only seems to present CMD Solutions that concatenate the printouts of multiple PDFs together. Doing so will neutralize all the active forms in those documents, as the text and check boxes, drop down menus and radio buttons are turned into static - and therefore useless - images. Preserving the form elements is what makes this question different :) – Thomas Jordan Jul 07 '20 at 21:30

1 Answers1

1

I have found success using pdftk, which is an open-source software that runs on linux and can be called from your terminal.

To concatenate multiple pdfs into one (and preserve form-fillable elements), you can use the following command:

pdftk input1.pdf input2.pdf cat output output-file.pdf
Jarred Allen
  • 194
  • 3
  • 19
  • pdftk works ok but I had a strange bug with it in concatenation of fillable pdf files - it does merge them into a single file and the pages do stay fillable but anything already filled into text fields is again overlaid with purple, editable field... only trying to edit the field unveils the text beneath - looks like it first flattens the files and merges anything in the textfields and then adds empty fillable fields on top of it – 6opko Apr 06 '21 at 20:51
  • to add to my comment - I figured it out! The trick is to first do the merge into one big pdf and then fill-in the fields. – 6opko Apr 06 '21 at 21:34