Behemoth Company Logo Behemoth

Universal PDF Modifier

      - uPDF-Modifier -

The Universal PDF Modifier tool rapidly produces marked up versions of PDF forms. The resulting PDF files are printable on all popular platforms. This tool is ideal for automatic processing, such as for database back-end formatting of documents for downloading to customers.

This Modifier tool requires binary universal-pdf object data files that are produced by the Universal PDF object Extractor (uPDF-Extractor) tool.

The Universal PDF Modifier tool is released as Free Open-Source Software (FOSS) under the LGPL license (Lesser-GPL or Library-GPL), which can be embedded within all third party products and used by all customers without fees or entanglements. It is small and portable, self contained with no external dependencies.

Usage

The PDF-Modifier program requires three files on the command-line.
    universal_pdf_file_modifier   metadata       results         formpages_pdf_objects
The three files are:
  1. Metadata file - The metadata file specifies where on each page to place each value. Each value-name, or "label", is given page-coordinates. The metadata file can also specify formatting information, like text-size and color, justification, character spacing, and ways of displaying numerical or monetary values.
    For example:
                 Page 2
                    County   250 600
                    Earnings 250 700
    	
    The lines in the above example designate the positions on page 2 that the County and Earnings values should be placed, if any.

    For a given PDF form, the metadata is constant, or never or rarely changes. For example, you could fill out millions of form instances using the same unchanged metadata file.

    
            Hint: The easiest way to determine page-coordinates is by opening an image-editor, 
                  such as GIMP or Photoshop on your PDF-file at a resolution of 110-points/inch.
                  Move your cursor to each position, and read off the pixel coordinates, and paste or
                  type them into your metadata file.
    	
  2. Results file - The results file assigns values to label-names for each instance of a form to be printed.
    For example:
                    County = Dade
                    Earnings = 23,687.33
    	
    In combination with the example metadata above, will result in the string "Dade" appearing on page 2, at position (250,600), and the value "23,687.33" appearing at position (250,700) on page 2. (The equals "=" sign is optional. The parser basically looks for name-value pairs on the lines within the file.)

    You generally use a different results-file for each new instance of a given form that you print.

  3. PDF-object-data file - The PDF-object-data file holds the form background over which the above result-values are placed. It is the binary file created by Universal_pdf_object_Extractor from the original blank PDF form file. It never changes for a given form.

Command-line Options for Universal PDF Modifier:

        -o outfile                      - Name the output file.  Otherwise by default it produces "new.pdf".
        -testmode                       - Place labels in their locations on pages.
        -v 
        -help

Metadata File Syntax

The metadata file specifies where, on each page, to place each value. Each value-name, or "label", is given page-coordinates. By default, the coordinates are in pixels. (The coordinates can be changed to "Printer's Points" , which is 1/72 inch, by the "PtCoords" command.)

The metadata file can also specify formatting information, like text-size and color, justification, character spacing, and ways of displaying numerical or monetary values.

All metadata commands are given one-per line. Blank lines are allowed. Lines can be commented-out by prefixing the line with an exclamation mark (!).

Metadata Commands:

Page   num Starts new page.
Optional_Page num Page not printed out unless the page "num" is requested in the results file.
FontSz fntsz Sets letter size. (Default = 10).
no_zero_entries Prevents displaying zero values.
allow_zero_entries Reverses the no_zero_entries command. Default is to show zero entries.
showevenifzero Forces specific item to show even if zero.
round_to_whole_numbers Do not show cents, but round to whole amounts.
show_cents Show cents. This is the default mode.
no_commas Do not use commas in large numbers.
use_commas Use commas in large numbers (every three positions). This is the default.
no_show_decimal_pt Does not display decimal point in space-stretched numbers.
show_decimal_pt Shows decimals in space-stretched numbers. Default.
DoNotEnter00afterDecimals Do not force ".00" after rounded values. This is default.
Enter00afterDecimals Force ".00" after rounded values. Default is off.
right_justify n Default is to left-justify.
solid_status_check sz_w sz_h fntsz Sets the size and dimension of solid box fill-ins, or X mark for a check-box.
TxtColor: r g b Sets the text color in Red, Blue, Green, where the values range 0.0 - 1.0, with 0.0 being dark, and 1.0 being bright. For example, black text is 0 0 0. Medium dark-blue text is 0 0 0.6.
CoordReference: PtX0 PtY0 PixX0 PixY0 PtX1 PtY1 PixX1 PixY1 Establishes alternate coordinate system.
PtCoords Switches coordinate system to "Printer's Points", which is 1/72 inch.
MediaBox x y Custom "media-box". This sets the area on the page and implied coordinates.
END_OF_INPUT Enables putting junk in file after this tag -- for whatever reason, comments, notes, etc..
any_label x y padlen dx This is the main item entry.
It specifies where the value for the given label will be placed on the page.
Note that the last two arguments, padlen and dx, are optional.
For example, you could specify:
  just: x y
or
  just: x y padlen
or
  all four: x y padlen dx.
The padlen is used when right-justifying numerical values. It specifies the number of digit positions the number should be displayed with, so that the right-most column is always at the same horizontal position on the page, regardless of how many digits are in a given value. Without a padlen value, numerical values will be left-justified.
The dx value is used to increase the horizontal spacing between characters. The default value is 10.0.


Note that the metadata is basically modal, in that settings like TxtColor:, FontSz, no_commas, use_commas, etc., are not global, but rather they affect the following tags unless, or until, changed.


Testing:

You can quickly test Metadata files by:
        universal_pdf_file_modifier   -testmode   meta.txt   no_file_test   universal_pdf_obj.data

        xdg-open new.pdf

This will display each label-name in its designated position on each page.

(The xdg-open command is a convenient way to open your system's default PDF-Viewer on many Linux systems. If you are not on such Linux systems, you should substitute the appropriate PDF-Viewer command. For example, on Apple Macs use Preview, or Microsoft Windows use start.)


Get uPDF-Modifier

* You may need to Right-Click to Save-As.

The Linux and Mac downloads are Tar-Gzip'd packages. Unpack with tar xvfz {package-name}.
The MS-Win download is a Zip'd package, which can be Extracted from your file-browser.










Back to Universal PDF Forms Makers

.