In this chapter

…you will learn how to use RESxml to export and import Redax boxes programmatically.

  • About RESxml provides an overview of RESxml
  • Command-line options describes the command syntax and the options you can use on the command line to create and apply RESxml to PDF documents
  • Creating RESxml explains how to generate RESxml from PDF documents.
  • Applying RESxml explains how to import RESxml to PDF documents.The examples in this chapter use the sample files contained in the samples subdirectory where Redax Enterprise Server was installed. In Windows, the default installation directory is C:\Appligent\RedaxServer\. In UNIX, it is wherever you installed it.

About RESxml

RESxml files are xml files containing complete details about the Redax boxes contained in a given PDF file (see RESxml.dtd in the samples folder).

These files are useful in the following scenarios:

  • “Template” applications, in which the information to be redacted is always located in the same place on the page, and for which the page-size and orientation is always the same.
  • Storing markup separately from the PDF document (for example, in a database or document management system).
  • Cases in which you wish to alter existing Redax boxes programmatically (for example, to change exemption codes or set categories).
  • Cases in which you wish to retrieve and analyze data about Redax boxes (for example, to compute redaction volumes, square-inches and other metrics).
  • Cases in which you wish to add or remove Redax boxes based on category.

Export to Database or Document Management System

The -exemptpat option (see Markup Options) places the name of the pattern that found this specific Redax box into the Exemption field in the Redax box.

The -annotmatch option places the full text of the area into the Note field in the Redax box that was found when using Find Using Pattern or Find Using Regular Expressions.

In both cases, this information is included with the XML export options noted below, and thus may be saved to a database or document management system independent of the PDF file itself. This is useful for tracking information marked for redaction and the type of data that is marked for redaction.

Command-line options

This section describes the command-line options for creating RESxml and applying RESxml. Subsequent sections of this chapter explain how to use the options to accomplish these tasks.

Options for working with RESxml — summary

Option Parameter Description
-expfile filepath Create (export) a RESxml file
-impfile filepath Apply (import) a RESxml file
-detfile filepath Write Redax Box detail report to file
-detdtd   Write DTD for redax detail report
-detpage integer Page number for Redax detail report

Options for working with RESxml — details

expfile — create (export) a RESxml file

Creates a RESxml file based on the Redax box locations in a PDF file. The -expfile option must be followed by the desired file name for the RESxml file and then the file name of the PDF document.

$redaxserver -expfile <RESxml.xml> <input.pdf>

-impfile  apply (import) a RESxml file

Applies Redax boxes to a PDF document based on a RESxml file. The -impfile option must be followed by the RESxml file name and PDF output option (-o), and then the PDF input file name or directory:

$redaxserver -impfile <RESxml.xml> -o <output> <input>

-detfile <filename.xml>  Write Redax Box detail report to file

Contains additional information not present in the -expfile option. You cannot use the -redact or -rmarkup option with the -detfileoption.

$redaxserver -detfile <detfile.xml> <input>

-detpage <page>  Page number for Redax detail report

Limits a detail report to a specific page. You cannot use the -redact or -rmarkup option with the -detpage option.

$redaxserver  -detpage -detfile <detfile.xml> <input>

-detdtd  Write DTD for redax detail report

Includes a DTD as part of the detail report file (as generated by -detfile). You cannot use the -redact or -rmarkup option with the -detdtd option

$redaxserver  -detdtd -detfile <detfile.xml> <input>

Creating RESxml

To create RESxml from a PDF document, enter the following command:

$redaxserver -expfile <RESxml.xml> <input.pdf>

The input.pdf file should be marked up, as described in Marking Text for Redaction

A RESxml file is created.

Example: Use the marked-up sample_form.pdf file, located in the samples directory, as the source for a template called my_RESxml.xml to be created in the samples directory.

In Windows:

>redaxserver -expfile samples\my_RESxml.xml samples\sample_form.pdf

In UNIX:

$redaxserver -expfile ./samples/my_RESxml.xml ./samples/sample_form.pdf

Applying RESxml

You can apply a RESxml file to mark up or redact a document.

Using a RESxml file for markup

To mark up a PDF document based on a RESxml file, enter the following command:

$redaxserver -impfile <RESxml.xml> -o <output> <input.pdf>

The RESxml file is applied to the input.pdf file, and the results are saved to the specified output file or directory. The input.pdf file is not changed.

Example: Apply the sample_RESxml.xml file, located in the samples directory, to sample_multiple_forms.pdf, also in the samples directory. Save the output to template_markup_results.pdf in the samples directory.

In Windows:

>redaxserver -impfile samples\sample_RESxml.xml -o samples\template_markup_results.pdf samples\sample_multiple_forms.pdf

In UNIX:

$redaxserver -impfile ./samples/sample_RESxml.xml -o ./samples/template_markup_results.pdf ./samples/sample_multiple_forms.pdf

Using a RESxml file for redaction

To redact a PDF document based on a RESxml file, enter the following command:

$redaxserver -impfile <RESxml.xml> -redact -o <output> <input.pdf>

The RESxml file is applied to the input.pdf file, a redaction is performed, and the results are saved to the specified output file or directory. The input.pdf file is not changed.

Note: Active form fields must be flattened in the file. Redax Enterprise Server cannot redact text in active form fields. There are several ways to flatten form fields:  use FDFMerge or FDFMerge Lite or if you have Redax Plug-in 5.0, select the option Remove All Form Fields from the Redax Menu.

Example: Apply the sample_RESxml.xml file to sample_multiple_forms.pdf (both in the samples directory), and redact the results. Save the output to template_redaction_results.pdf in the samples directory.

In Windows:

>redaxserver -impfile samples\sample_RESxml.xml -redact -o samples\template_redaction_results.pdf samples\sample_multiple_forms.pdf

In UNIX:

$redaxserver -impfile ./samples/sample_RESxml.xml -redact -o ./samples/template_redaction_results.pdf ./samples/sample_multiple_forms.pdf