FDFMerge and FDFMerge Lite – Running
In this chapter…
…you will learn how to run FDFMerge Lite and FDFMerge on the command line. Information that is specific to FDFMerge is followed by the notation: (FDFMerge only).
- Running FDFMerge Lite and FDF Merge shows how to run the software.
- Examples of Merging FDF files and PDF Forms presents basic examples of running FDFMerge Lite and FDFMerge and guides you through the procedure of merging an FDF file with a PDF form to create a PDF document.
- Additional merging examples for UNIX and Windows provides several more complex examples.
Running FDFMerge Lite and FDFMerge
You’re ready to start merging FDF data files and PDF forms. Before you begin, remember these important points about FDFMerge Lite and FDFMerge:
For FDFMerge Lite or FDFMerge to run successfully, the PDF form file name must precede the FDF data file name on the command line unless you are running with the -reverse option.
- The order in which options are listed on the command line is not important. However, any file names associated with an option must immediately follow that option.
- The proper directory paths must be given for the fdfmergelite or fdfmerge executable and all of the files that you use.
- To prevent overwriting your original PDF file, save your output to a new file using the -o <outfile.pdf> option.
Example Command-Line Syntax
Listed below is an example of a simple command line for calling FDFMerge Lite or FDFMerge:
$ fdfmergeliteapp [options] -o out.pdf input.pdf input.fdf
$ fdfmergeapp [options] -o out.pdf input.pdf input.fdf
Note: Do not call the fdfmergelite or fdfmerge script from another script or application. Call fdfmergeliteapp or fdfmergeapp directly, as shown in the first example above.
Examples of Merging FDF Files and PDF Forms
For your first merge of FDF data files and PDF forms, try using the samples included with the installation of FDFMerge Lite or FDFMerge in the /samples/testfiles directory.
Basic merging data and forms on UNIX
- Make sure you’re in the directory you want to be in; the examples below assume you are in the directory where FDFMerge Lite or FDFMerge is installed.
- Using the sample files try:
$ ./fdfmergelite -p -o ./samples/testfiles/out_testfile.pdf ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
$ ./fdfmerge -p -o ./samples/testfiles/out_testfile.pdf ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
In this example the -p flag shows progress, and the -o flag specifies an output file to prevent overwriting the input PDF file.
- When you press Return the following progress messages appear on your screen:
Processing : ./samples/testfiles/testfile.pdf Open : ./samples/testfiles/testfile.fdf Close : ./samples/testfiles/testfile.fdf Done : ./samples/testfiles/out_testfile.pdf fdfmerge completed successfully.
Note: If you run FDFMerge Lite or FDFMerge without -p and no errors occur, nothing is written to the screen.
- Open out_testfile.pdf to see the completed form.
Basic merging data and forms on Windows
If you are not familiar with using the command line, refer to FDFMerge – Command Line Introduction or FDFMerge Lite – Command Line Introduction.
- Click the Start button.
- Go to Programs > Accessories and select Command Prompt.
- Make sure you’re in the directory you want to be in; the examples below assume you are in the directory where FDFMerge Lite or FDFMerge is installed.
- Using the sample files try:
>.\fdfmergelite -p -o .\samples\testfiles\out_testfile.pdf .\samples\testfiles\testfile.pdf .\samples\testfiles\testfile.fdf
>.\fdfmerge -p -o .\samples\testfiles\out_testfile.pdf .\samples\testfiles\testfile.pdf .\samples\testfilestest\file.fdf
In this example the -p flag shows progress, and the -o flag specifies an output file to prevent overwriting the input PDF file.
- When you press enter the following progress messages appear on your screen:
Processing : .\samples\testfiles\testfile.pdf Open : .\samples\testfiles\testfile.fdf Close : .\samples\testfiles\testfile.fdf Done : .\samples\testfiles\out_testfile.pdf fdfmerge completed successfully.
Note: If you run FDFMerge Lite or FDFMerge without -p and no errors occur, nothing is written to the screen.
- Open out_testfile.pdf to see the completed form.
Additional Merging Examples for UNIX and Windows
In the previous sections the resulting out_testfile.pdf file was a filled-in form with active form fields. Here we give a few more examples, using command-line options and FormInfo files for form flattening (or stamping).
The examples are shown in the UNIX format, which is only slightly different from the DOS format on Windows in that directories are separated by a forward-slash ( / ) in UNIX, rather than the backslash ( ) in Windows/DOS.
Merging data and forms with the sample FormInfo file — FDFMerge only
$ ./fdfmerge -p -o ./samples/testfiles/out_testfile.pdf -f ./samples/testfiles/testfile1.txt ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
The out_testfile.pdf file is a new form with text attributes as specified in testfile1.txt. Some form fields remain active while the fields specified in testfile1.txt are flattened.
Merging data and forms with form flattening
$ ./fdfmergelite -p -s -o ./samples/testfiles/out_testfile.pdf ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
$ ./fdfmerge -p -s -o ./samples/testfiles/out_testfile.pdf ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
The out_testfile.pdf file is a new PDF document with no active form fields; the text is stamped into the document as it appears in testfile.pdf.
Merging data and forms with FormInfo and form flattening — FDFMerge only
$ ./fdfmerge -p -o ./samples/testfiles/out_testfile.pdf -s -f ./samples/testfiles/testfile1.txt ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
The out_testfile.pdf file is a new PDF document with no active form fields; the text is stamped into the document as specified in testfile1.txt.
Merging data and forms using several options
$ ./fdfmergelite -p -l logfile.txt -o ./samples/testfiles/out_testfile.pdf -s ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
$ ./fdfmerge -p -l logfile.txt -o ./samples/testfiles/out_testfile.pdf -s -f ./samples/testfiles/testfile1.txt ./samples/testfiles/testfile.pdf ./samples/testfiles/testfile.fdf
All of the progress messages are written to logfile.txt. The out_testfile.pdf file is a new PDF document with no active form fields. The text is stamped into the document by FDFMerge Lite. FDFMerge stamps the data into the form fields and fields specified in testfile1.txt have their attributes changed to what is set in this file.