cnv.ConvertDocument

This job converts one or more document files of the specified format into one or more PDF or TIFF files. Accordingly, arbitrary input and output formats are also possible depending on the respective configurations.

The following classes of transformations are possible:

  • Bitmap format (JPG, TIF) → PDF

  • Singlepage TIFF → Multipage TIFF

  • ASCII-COLD (.asc) → TIFF / PDF

  • XSL:FO (.fo, .xml) → PDF

  • Office documents (.ps, .doc, .xls, .ppt, .txt, .rtf, .pdf, .ima) → PDF

For bitmap formats and ASCII-COLD documents, Flags can be used to control whether a separate output file should be created for each input file or whether the individual pages should be consolidated into a single document.

Format specifications are expected in lowercase (e.g. pdf instead of PDF).
If ObjectID and ObjectType are passed, conversion is performed via OS RenditionPlus (___ren.bat). The target format can then additionally be SLIDE for preview generation or TXT for text recognition. The size of the generated preview can be specified with Height and Width.

1. Input Parameters

Name Type Required Description

Flags

INT

Yes

0 = one output file is created for each input file
1 = all input files are written to one output file
2 = one output file is created for each input file; temporary files created by the server are not deleted
3 = all input files are written to one output file; temporary files created by the server are not deleted

SourceFormat

STRING

Yes

Format of the source file

DestinationFormat

STRING

Yes

Format to convert to

[Timeout]

INT

No

Maximum time in milliseconds that a conversion by external programs may take. Considered for XSL:FO and office format conversions.

AddAnnotations

INT

Yes

1 = public slides are burned in

[ConvertEqualFormat]

INT

No

Default 0. If set to 1, a conversion is attempted even if source and destination format are identical (e.g. PDF → PDF/A).

[Watermark]

INT

No

Default 0. If set to 1, a generated PDF document is provided with headers and footers. Appearance and content are configured by the administrator. See enaio® Administrator Guide → tab Print Marking.

[dwObjectID]

INT

No

Document object ID for use in watermarks. Only relevant when Watermark=1 and print watermarks are configured to output the document ID.

[ProtectPDF]

INT

No

Default 0. If set, a generated PDF document is protected — printing and copying of text passages is then not possible.

[ObjectID]

INT

No

ID of the document (alternative to file list)

[ObjectType]

INT

No

Type of the object (alternative to file list)

[Digest]

STRING

No

Hash value of the document (only when passing ObjectID/ObjectType)

[Height]

INT

No

Height of the preview when destination format is SLIDE

[Width]

INT

No

Width of the preview when destination format is SLIDE

2. Input Files

Name Description

[File List]

Path and name of files to be converted (alternative to ObjectID/ObjectType)

3. Output Files

Name Description

File List

Path and name of converted file(s)

4. Return Value

(INT): 0 = Job successful, otherwise error code.

See also: cnv.CreateSlide

5. Using XSL:FO

  • For converting FO files (Formatting Objects), the Apache FOP processor must be installed. This requires a Java runtime environment 1.6 or higher. The path to the FOP batch file (Windows) or FOP shell script (Linux) must be stored in the registry via the Enterprise Manager. Additionally, a timeout can be defined after which the conversion process is aborted.

  • If an XML document is passed to FOP, an XSLT document must be passed as a second file in the input file list to transform the XML into an XSL:FO document.

  • If images are to be included in the resulting PDF, they must be referenced in the XSL:FO file via a URL accessible to the application server.

  • Only one FO or XML document can be processed per job.

Example: cnv.ConvertDocument with XSL:FO (SourceFormat: XML, DestinationFormat: PDF, Flags=0)
  1. Input file — XML file with arbitrary input information:

    <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
    <?xml-stylesheet type="text/xsl" href="example.fo"?>
    <persons>
      <person age="42">Max Mustermann</person>
      <person age="37">Denise Musterfrau</person>
    </persons>
  2. Input file — XSL file for converting to an XSL:FO file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
  <xsl:template match="persons">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master page-master-name="one" page-height="29cm" page-width="21cm"
                               margin-left="2cm" margin-right="2cm">
          <fo:region-body margin-top="50pt" margin-bottom="50pt"/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:block text-align="center" font-size="24pt" font-weight="bold"
                lineheight="28pt" space-after="10mm">
        <xsl:apply-templates/>
      </fo:block>
    </fo:root>
  </xsl:template>
  <xsl:template match="person">
    ...
  </xsl:template>
</xsl:stylesheet>