The following document will go through the functionality found within JetTrac PDFDeleteEmptyPages. This module is used to delete pages from a AcroForm PDF if those pages have not been used. Specifically this is useful if a form has multiple overflow pages for additional data, but those pages may not always be necessary.
If you need assistance in installing and configuring JetTrac PDFDeleteEmptyPages™, call Pro Technology Automation, Inc. at 805-527-1248 or email us at firstname.lastname@example.org. Please note that the JetTrac PDFDeleteEmptyPages™ license fee does not cover configuration services and technical support so there may be an additional charge. Please ensure you read these instructions carefully before calling for technical support.
To run the program, you will need to have the following files located in the same folder:
Executable files and dll files should not be edited for any reason.
JetTrac PDFDeleteEmptyPages looks through an input AcroForm PDF for hidden fields marking pages as eligible for deletion, and if all of the fields on that eligible page do not have a value (excluding exception fields listed within the configuration file) the module will delete the pages and output the new form.
When setting up a job step using JTPDFDeleteEmptyPages in JobConfig the only lines of the config you need to worry about are the first and the last two, the Config file, the Input PDF and the Output PDF. If left as an asterisk * the input will be whatever file is in the data folder that triggered the job running. This works well if it’s the first step but if the input is also the output of a previous job step you would need to specify the fully qualified path of the input pdf you want to remove pages from. All other fields should be filled with the fully qualified path to the intended file. Eg: C:\JetTrac\…\input.pdf
In JobConfig, file paths entered should not be in quotes.
As with all modules, there is a dropdown to select whether or not the job should stop completely if this step fails. If you select Yes, any error will terminate the job process and write to the log file what happened, if no, then the job will try to continue anyways. However if any steps further down the line rely on the output of a job set to not stop on error, they may not work properly.
For more specifics go to the JetTrac Field ServiceJobConfig page.
The command line to run JetTrac PDFDeleteEmptyPages contains the location of the executable, the input PDF file, the output PDF, the configuration .ini file, and the log file. The following is an example of the command line used to run this module:
“C:\JTPDFDeleteEmptyPages.exe” “C:\Input.pdf” “C:\Output.pdf” “C:\Config.ini” “C:\PdfDeleteEmptyPages.log”
Each part of the line is divided by spaces (the amount doesn’t matter), and contains the fully qualified file path to the file you are referencing surrounded by quotes. In the example all of the file paths reference the root of C:\, however, it is likely that none of these files will be located in the root of C:\ for your system, so this is simply demonstrating that the full file path is required.
The configuration .ini file contains the following lines:
- ExceptionFields: Within this configuration file is a list of fields to exclude when the module looks through a page to see if any fields have data. For example, if a page only has data filled out in one field, if that field is not in the ExceptionFields list, the page will not be deleted. However, if the field is listed on this line, the page will still be deleted. This is used primarily when there are fields on a form that are prepopulated, but you want to delete the page if it hasn’t been filled out with the exception of this prepopulated data. This list is separated by a pipe “|”.
- DeleteField: This specifies the name of the hidden field that the module will look through the input PDF for. This field marks the page as being eligible for deletion and without the hidden field the page will not be deleted even if they contain no data.
- DeleteFieldMultiple: This line is used when you wish to delete pages in groups. For example if you have a PDF that contains multiple copies of the first and second pages for overflow, but those pages cannot be deleted separately because each page 1 has to be accompanied by a page 2, then you can use this line to specify each of those pages as being in a group to either be kept or deleted together. Within my example, you would add the hidden field DeleteEligibleMultiple1 to the first copy that can be deleted of page 1 and page 2, that way they will be kept or deleted together. This can contain multiple field names to create any amount of groups, simply separate each one by a comma.
- PhotoDeleteField: This value functions in much the same way as the DeleteField value. However, this field is used for pages that have image fields on them. If you add a hidden field named with the value entered on this line to a page with an image field, the module will check to see if an image has been added to the page, if not, the page will be deleted.
- LogWanted: This field is used to specify whether you want the log to output the data from all of the fields that prevented pages from being deleted or not. It is not recommended that you change this value.
In addition to setting up the configuration .ini file, you will also need to go through any forms that you want to delete pages from if they are not filled out and add hidden fields to them. For any page that has text fields that you want to make eligible for deletion, simply add a hidden field to this page and have the field name match the DeleteField key value on line 2 of your configuration .ini file.
For image pages that you wish to delete not based on values in text fields, but rather when there has not be an image added to the image field, you will add a similar hidden field that is named using whatever value you entered in on the PhotoDeleteField line of the configuration .ini file.
Then, for any pages that you wish to be deleted or kept together, you can add hidden fields with the names you specified in the DeleteFieldMultiple key value of the configuration file.
Even if a field is hidden, if it has a value, it could prevent JetTrac PDFDeleteEmptyPages from deleting the page. This is unless the field is added to the exception list.
In the example given in the “Setting Up the Configuration .ini” section of this guide, you will notice that the ExceptionFields value contains duplicates of each field name with an added period at the end. This is due to the way Adobe Acrobat stores field names when there are multiple copies of those fields. If you have a form that has multiple copies of the same field name and you wish to add this field name to the ExceptionFields list, you will need to add not only the field name itself but also the field name with an added period at the end. For example, if you have a field named FacilityName that shows up multiple times on a form and you don’t want this field to be counted when looking to see if a page is eligible for deletion, you will need to add “FacilityName” and “FacilityName.” to this list.