The following processing is used for command-line and FFEXTERN-invoke normal and wordmerge conversions:

Preparation

The parameters are obtained either from the command line or from FFEXTERN IPC.

The file type and processing method are obtained using standard functions shared between all DC components.

CoInitialize/CoUninitialize surrounds the detailed processing steps

Environment variable CVT_GLOBAL_NAMESPACE, if not empty, selects the Windows Global namespace

Variables passed from FFEXTERN are used to override DEFAULT_CONVERTER_RES and DEFAULT_CONVERTER_PAGE

CVTOPTS environment variable is used to augment the option parameter letters.

If the command-line output file has .PDF extension, it is used to set the NeedPDF flag

For conversion methods IE and HTTPinternal, the margin strings are set up.

Star Office, Open Office Libre Office or Acrobat are located if specified by the conversion method

For HTTP files to be downloaded, the source timestamp is obtained if available, unless IgnoreLM is set

Conversion fails (-3) if the source file is not present

The requirements flags (needTIF, needPDF, needWMDOC, needInterPDF) are obtained from FFEXTERN, or derived from command-line filenames.

Additional target filenames are formed from the target filename for PDF or DOC files if required.  The target filename is always supplied as TIF, except when PDF is specified on the command line.

Time Testing

If the needTIF or needInterPDF flag is set, then if the target is later than the source, the needTIF and needInterPDF flags are cleared, and the number of pages in the existing target file is recorded as the result.

If the needPDF flag is set, then if the target PDF is later than the source, the needPDF flag is cleared, and the number of pages in the existing target file is multiplied by 1000 and added to the result.

If there are no 'need' flags set, processing ends and the result is returned.

Print Driver Preparation

The print driver is required if and only if the needTIF flag is set and the conversion method is not Ghostscript, QPDF or ConvertTIF.

If the print driver is required but environment variable NO_CV_PRINT is not empty, conversion fails (-25).

The remainder of this subsection applies only if the print driver is required for the conversion

If the destination file is not local, a temporary filename is created instead which will receive the output, and which will be moved after the conversion is complete.

If the resolution-conversion driver is selected (option E) but not installed, conversion fails (-26)

The selected printer is set as the current printer.

FFVCRT.exe is killed if still running, and then the shared memory and event is re-initialized for communication with FFCVRT.

Conversion Selection

If the source document is DOC or RTF its signature is checked unless it is a Wordmerge RDS document or OverrideDocCheck is set under the FXCVRT registry key, and the conversion fails (-11) if the document is not valid.

If the source document is PDF then for Adobe and Ghostscript conversions its signature is checked unless OverridePDFCheck is set under the FXCVRT registry key, and the conversion fails (-23) if the document is not valid.

If the conversion method is HTTPInternal but the source filename contains non-ASCII characters (not supported by the internal converter), the conversion method is changed to IE.

If the conversion method is Ghostscript, QPDF or ConvertTIF, the conversion is done and processing is compete, returning the page count.

The remaining conversion methods may use the printer driver:  if so, the conversion is initiated and then waits for FFCVRT to notify completion by means of a Windows event.

The conversion fails (-17) if no installed and supported conversion method is found

Ghostscript

GS_DLL is located through the Software registry keys GPL Ghostscript, AFPL Ghostscript or Aladdin Ghostscript.

See Using Ghostscript for details of the processing

Faxable TIF convert

For 'nearly faxable' files, the file is loaded and then saved from the internal functions which handle Faxable TIF files.

QPDF

This converter uses the Debenu QuickPDF library to convert to TIF without using the printer driver

QPDF_OPTIONS are obtained from parameters passed by FFEXTERN or from the command line.

The file is opened and checked for the presence of the %PDF signature in the first 300 bytes.  If the signature is more than 12 bytes from the start of the file, the file is loaded and the bytes preceding the signature are discarded from the stream.  This allows processing of certain 'Jetform' files which have a binary block before the signature (and after the %EOF also, but that does not disrupt the Debenu library).

The file is processed page by page.  For each page:

The page width and height and rotation is determined, and if the page has a media box defined its dimensions are saved

The page size is tested for A4, B4, and US Letter.

If the page has a media box it is changed to be a crop box of suitable dimensions and position to extract the page content.

Rotation is set for Landscape non-rotated pages and Portrait rotated pages so that the outcome of rendering is a portrait-mode bitmap.

The page is rendered to a full-color bitmap.

Edge, Sharpen, Gamma and Brightness transforms are applied in the sequence specified, using functions from the Envision graphics library.

Custom OEM options are processed to allow external processing of the bitmap

Colors are adjusted if the MAP sub-options are specified in QPDF_OPTIONS

The selected or default dither method is used to reduce the image to a bi-level (pf1bit) bitmap

The image is inverted to 1-bit equals black unless the CheckBlack option is present in QPDF_OPTIONS and the top and bottom few scan lines are predominantly the 'wrong' color.

The page is switched bottom-to-top to match the standard fax co-ordinate system

A despeckle transform is applied if specified in QPDF_OPTIONS

The page is converted to low-res if specified in QPDF_OPTIONS

The page is huffman-encoded with the compression specified in QPDF_OPTIONS and added to the output TIF file.

Adobe

If option K is specified, the paper-size of the first page is determined using the QPDF library

If option C is specified, the page is loaded using the QPDF library and checked for "this.print" Javascript, which is then removed if present.  The file is saved without the Javascript block as filename_NJ.PDF.

The automation of printing varies depending on the version of the Adobe product in use; see Using Acrobat and Adobe Reader.

Star Office, Open Office, Libre Office

The default paper size is always set

Automation is currently done using the command line and the -pt command-line option.

Word 2007 - 2016

The document is opened and conversion fails if the open timeout is exceeded

For WordMerge:

The (single row) Datasource is opened and the conversion fails if the open timeout is exceeded

The merge is executed to produce one new customized document (and the last section deleted unless NoStrip is set)

This document becomes the active document

If the needPDF or needInterPDF flag is set, the document saved as PDF

If the needTIF filag is set, the printer settings are set from the first page size if option W is set (otherwise set to the default size) and printing is initiated.

For WordMerge:

if the needDOC flag is set, the document is saved in Office DOC format

the single-row datasource file is deleted

The merged document is closed

The document is closed and the automation object is closed.  On completion of printing, any remaining Winword instance is killed.

Excel 2007 - 2016

If CVT_XLS_OPTIONS are specified, the document is preprocessed with the internal XLS handler in CF8EXCEL to determine the worksheet count and worksheet attributes.

The document is opened and conversion fails if the open timeout is exceeded.

The CVT_XLS_OPTIONS are processed, deleting sheets and changing visibility as necessary

If the needPDF or needInterPDF flag is set, the document saved as PDF.

If the needTIF filag is set, the printer settings are set from the first worksheet page size if option V is set (otherwise set to the default size) and printing is initiated.

The document is closed and the automation object is closed.  On completion of printing, any remaining Excel instance is killed.

PowerPoint 2007 - 2016

The document is opened.

If the needPDF or needInterPDF flag is set, the document saved as PDF.

If the needTIF filag is set, the printer settings are set from the first slide size if option U is set (otherwise set to the default size) and the colortype from the PPT_COLORTYPE variable is set. Printing is then initiated.

Snapview

The default paper size is always set

Snapview automation is opened, the document path is set, and PrintSnapshot is initiated.

TIF internal

The default paper size is always set

This conversion uses the Envision graphics library to load a TIF file and print it to the document converter printer.

If the resolution appears to match fax resolution it is printed at original size, otherwise it is scaled fit to page.

FireFox (deprecated)

The default paper size is always set

The Mozilla browser automation object is opened, and the navigation path set to the local pathname.  On navigate complete, printing is initiated.

Internal HTTP

The default paper size is always set

The margin, header, footer and text size settings are obtained from the parameters passed from FFEXTERN

The internal HTTP interface (implemented in CF8HTML) is opened and the navigation path set to the local pathname.  On navigate complete, printing is initiated.

Unicode pathnames are not currently supported by this converter

Internet Explorer

The default paper size is always set

The margin, header, footer and text size settings are obtained from the parameters passed from FFEXTERN

The IE automation object is opened, and the navigation path set to the pathname.  On navigate complete, printing is initiated.

Completion Operations

After a successful conversion, if the needInterPDF flag is set, the output PDF file is converted to TIF using the QPDF conversion, and the PDF file is deleted unless the needPDF flag is also set.

Successful conversions are then processed as follows:

If FFEXTERN has specified a timestamp for the output file, it is applied.

If the printer driver has been used, and the paper size was set to a B5 or A5 rotated format, the TIF file is rotated to landscape mode.

The result code is formed from the sum of number of TIF pages, the number of PDF pages times 1000, and 1000000 if a DOC file was created.

If the file was downloaded from an HTTP or FTP location, the downloaded file is deleted.