Skip to main content

xSuite Interface Windows Prism 5.x – Online Help

Conversion of Formats

ChangePdfVersion()

This function converts a PDF file into a PDF file of a different PDF version. The target file is the modified PDF and has the default name %FileBaseName%.versionChanged.pdf.

The functionality is similar to the functionality of the ConvertPdfToPdfA() macro. However, the ChangePdfVersion() function is not restricted to PDF/A as the target format. This function allows any conversion between two PDF versions, within the scope of what is technically possible.

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Specification of the PDF version to convert to (optional):

  • PDF_A_1a (PDF/A-1a)

  • PDF_A_1b (PDF/A-1b)

  • PDF_A_2a (PDF/A-2a)

  • PDF_A_2b (PDF/A-2b)

  • and others up to PDF_A_4f (PDF/A-4f)

  • PDF1_0 (PDF 1.0)

  • PDF1_1 (PDF 1.1)

  • and others up to PDF2_0 (PDF 2.0)

Default value: the value specified in General.FileMacroOptions.PdfALevel

4

5

Text

Specification of a lower limit and/or an upper limit for a permissible version of the source PDF file (optional)

If the source PDF file is in the specified range, no conversion will take place. The values must be specified in the same syntax as the value of the third parameter. The PDF versions have an internal ranking, with an order corresponding to the list of PDF versions in the third parameter.

For example, all PDF versions from 1.5 to 2.0 can be defined by the lower limit PDF1_5 and the upper limit PDF2_0. One of the two limits can remain open so that all older or newer versions are implicitly included in the range. For example, to convert all PDF files with a version that is not at least 1.5 to 2.0, the third parameter must be set to PDF2_0 and the fourth parameter to PDF1_5.

Examples

ChangePdfVersion("test.pdf", , "PDF2_0" , "PDF1_5") converts a PDF file to version 2.0 under the name test.versionChanged.pdf if the original version is lower than 1.5. If the original version is higher than 1.5, an unchanged copy of the original file is created under the new name.

ConvertAny()

This function is a general conversion function for converting various source formats to one of the target formats PDF or TIFF. The default name for the target file is %FileBaseName%.%FileExt%, where the file extension %FileExt% refers to the target format.

Deviating from the standard behavior of a file macro, no target file is generated if the source file already exists in the target format – not even as a copy of the source file.

The conversion is performed using a universal conversion function of the GdPicture graphics library, which supports the following source formats:

  • Microsoft Office: DOC, DOCX, XLS, XLSX, PPT, PPTX

  • OpenDocument: ODT

  • Text: TXT, RTF

  • E-Mail: MSG, EML

  • PDF

  • HTML

  • Common raster image formats (e.g., BMP, GIF, JPEG, PNG, TIFF)

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Target format of the conversion:

  • PDF (default value)

  • TIFF

Examples

ConvertAny("test.docx", , "PDF") converts a Word file into a PDF file test.pdf.

ConvertHtmlToPdf()

This function converts an HTML file into a PDF file using the print function of a locally installed Google Chrome browser. The default name for the target file is %FileBaseName%.pdf.

Parameter

Data Type

Description

1

Text

2

Text

3

Text

File path of the application file chrome.exe of the browser (optional)

The browser must be installed separately. By default, in Windows, the program will attempt to determine the browser independently via the corresponding registry entry.

4

Bool

Boolean value determining whether possible background graphics will also be printed

Default value: TRUE

5

Bool

Boolean value determining whether the print is in landscape format ("Landscape")

Default value: TRUE

6

Text

Paper format for page-by-page printing

The following values are permissible:

  • Letter

  • Legal

  • A4 (default value)

7

Text

The width of the margins

Numerical values with a unit of measurement, e.g., 1 cm (default value) are permitted.

Examples

ConvertHtmlToPdf("test.html", , , , TRUE) converts an HTML file into a PDF file test.pdf in landscape format.

ConvertImage()

This function converts an image file in a common raster image format to another image format. In addition, it may change properties such as color depth and resolution of the image.

The default name of the target file is %FileBaseName%.converted.%FileExt%, in which the file extension %FileExt% refers to the target format.

Conversion of multi-page TIFF files is also supported, but if the target format is different, only the first page will be output again.

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Format of the target file in the form of the relevant file extension (e.g. JPEG or TIFF), if the format is to be changed (optional)

4

Number

Color depth(1, 8 or 24), if this is to be changed

Default value: 0 (no change)

5

Number

Resolution in DPI, if it is to be changed

Default value: 0 (no change)

6

7

Number

Absolute image width and image height in pixels, if these are to be changed

Default value: 0 (no change)

The aspect ratio of the image is basically preserved (i.e., only one of the two values is used and the other is calculated dynamically). If one of the two values is 0, the other value will be used; if not, then what will be used is the smaller of the two values in relation to the actual dimensions of the image in question.

Changing the image size also causes an implicit change in resolution independent of parameter 5 provided for this purpose.

8

Number

Relative image size in percent, if this is to be changed, related to the length of the edge of the image

Default value: 0 (no change)

This parameter can only be used as an alternative to the absolute size specifications in parameters 6 and 7.

Examples

ConvertImage("test.tif", , "JPEG", 8, 300) converts a TIFF file into a grayscale JPEG file test.converted.jpeg with a resolution of 300 dpi.

ConvertImageToPdf()

This function converts an image file in a common raster image format to a PDF file. The default name of the target file is %FileBaseName%.pdf.

The conversion is supported only for single-page image files. For multi-page TIFF files, use the specialized function ConvertTiffToPdf().

Parameter

Data Type

Description

1

Text

2

Text

Examples

ConvertImageToPdf("test.jpg") converts a JPEG file into a PDF file test.pdf.

ConvertMsExcel(), ConvertMsOutlook(), ConvertMsPowerPoint(), ConvertMsWord(), ConvertPdf()

These functions convert a file in a Microsoft Office format or PDF format to one of several possible target formats.

Depending on the source format, the following target formats are supported:

  • MS Excel: PDF, HTML, MHTML, JPEG, PNG, TIFF

  • MS Outlook: MSG, EML, PDF, DOC, RTF, HTML, MHTML, JPEG, PNG, TIFF

  • MS PowerPoint: PDF, HTML, JPEG, PNG, TIFF

  • MS Word: PDF, RTF, TXT, HTML, MHTML, JPEG, PNG, TIFF

  • PDF: DOC, DOCX, XLSX, TXT, HTML, XML, JPEG, PNG, TIFF

The default name of the target file is %FileBaseName%.%FileExt% or %FileBaseName%.page.%FileExt% if the target format supports only single pages and therefore a separate target file is generated per page. The file extension %FileExt% refers to the target format. The conversion is performed using universal conversion functions of the Aspose graphics library, but it cannot be guaranteed that every individual source file will lead to the desired conversion result, especially as far as the original layout is preserved.

The ConvertMsOutlook() function accepts as source the file types .msg and .eml, and can also convert between them. The ConvertMsWord() function can also be used to convert other readable file types than just the native Word formats (e.g., .rtf, .txt, .html, and .odt).

Parameter

Data Type

Description

1

Text

2

Text

3*

Text

Format of the target file (characteristics according to the source formats above)

Examples

ConvertMsWord("test.docx", , "PDF") converts a Word file into a PDF file test.pdf.

ConvertMsWord("test.docx", , "JPEG") converts a Word file into multiple JPEG files (one file per page). By default, the target files have the same name test.page.jpeg. For unique naming, the target file name %FileBaseName%.%FileNo%.jpeg can be defined, for example, to number the files in the form test.1.jpeg, test.2.jpeg.

ConvertPdfToPdfA()

This function converts a PDF file to the PDF/A standard.

The target file is the modified PDF and has the default name %FileBaseName%.converted.pdf. Depending on the PDF source version and the PDF target version, this may require removing unsupported PDF elements or converting them to another format (e.g., fonts to vector or raster graphics).

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Specification of the PDF/A version to convert to (optional):

  • PDF_A_1a (PDF/A-1a)

  • PDF_A_1b (PDF/A-1b)

  • PDF_A_2a (PDF/A-2a)

  • PDF_A_2b (PDF/A-2b)

  • and others up to PDF_A_4f (PDF/A-4f)

Default value: the value specified in General.FileMacroOptions.PdfALevel

4

Bool

Boolean value determining whether a conversion will be forced if the source file does not match the specified PDF/A version

Default value: false (no conversion if the file already corresponds to any PDF/A version)

Examples

ConvertPdfToPdfA("test.pdf", , "PDF_A_2a") converts a PDF file into a PDF/A file named test.converted.pdf. If the source file already complies with a PDF/A version, an unchanged copy is created under the new name.

ConvertPdfToPdfOcr()

This function performs OCR processing for all images contained in a PDF file, generating a full text layer for these images.

The target file is the modified PDF file and has the default name %FileBaseName%.converted.pdf.

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Pages included in the OCR:

  • First: first page only

  • Last: last page only

  • All: all pages (default value)

  • Free specification of individual page numbers or page ranges (e.g., 1;2;3 or 1-3)

4

Text

Language of the OCR dictionary to be used (e.g., German [default value] or English); if required, multiple other languages, comma-separated

The appropriate dictionary file must be available in the program directory for the respective language (e.g., deu.traineddata or eng.traineddata). These two files are supplied with the program. Further dictionary files can be provided on request.

5

Bool

Boolean value determining whether OCR is executed in parallel across multiple pages via multithreading

Default value: false (sequential OCR over the individual pages)

Examples

ConvertPdfToPdfOcr("test.pdf", , "1-3", "German") reates an OCR layer on the first 3 pages under the new file name test.converted.pdf.

ConvertPdfToTiff()

This function converts a PDF file into a (multi-page) TIFF file. The default name of the target file is %FileBaseName%.tif.

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Working mode for PDF pages that consist entirely of a raster image:

  • RenderNew (default value) and ExtractNew: image pages are converted to the desired resolution/color depth

  • RenderOriginal and ExtractOriginal: image pages are left in their original resolution / color depth

The Render*** and Extract*** modes differ in their internal operation: In Render*** mode, PDF pages are converted directly to the target format. In Extract*** mode, the image files are extracted first and then converted. For native PDF pages, conversion to the resolution / color depth configured always takes place, even in ***Original modes.

4

Number

Resolution (dpi) of the target pages

Default value: 300

5

Number

Color depth (bpp) of the target pages:

  • 1: black and white (default)

  • 8: grayscale

  • 24: color

Examples

ConvertPdfToTiff("test.pdf", , "ExtractNew", 200, 8) converts a PDF file into a grayscale TIFF file test.tif with a resolution of 200 dpi.

ConvertTiffToPdf()

This function converts a (multi-page) TIFF file to one PDF file.

The default name of the target file is %FileBaseName%.pdf.

Parameter

Data Type

Description

1

Text

2

Text

Examples

ConvertTiffToPdf("test.tif") converts a TIFF file into a PDF file named test.pdf.

ConvertTiffToPdfOcr()

This function converts a (multi-page) TIFF file into a PDF file and generates full-text layers over the page contents via OCR processing.

The default name of the target file is %FileBaseName%.pdf.

Parameter

Data Type

Description

1

Text

2

Text

3

Text

Pages included in the OCR:

  • First: first page only

  • Last: last page only

  • All: all pages (default value)

  • Free specification of individual page numbers or page ranges (e.g., 1;2;3 or 1-3)

4

Text

Language of the OCR dictionary to be used (e.g., German [default value] or English); if required, multiple other languages, comma-separated

The appropriate dictionary file must be available in the program directory for the respective language (e.g., deu.traineddata or eng.traineddata). These two files are supplied with the program. Further dictionary files can be provided on request.

5

Bool

Boolean value determining whether OCR is executed in parallel across multiple pages via multithreading

Default value: false (sequential OCR over the individual pages)

Examples

ConvertTiffToPdfOcr("test.tif", , "First", "German") converts a TIFF file into a PDF file named test.pdf and creates an OCR layer on the first page of the PDF file.

ConvertToPdf()

This function is a general conversion function for converting various source formats to the target PDF format. The default name of the target file is %FileBaseName%.pdf.

This is a parent function housing all other functions for PDF conversion, specialized for a particular source format.

By forwarding the call to the function that matches the format, the ConvertToPdf() function relieves you of having to configure a separate function call for each format when dealing with multiple source formats. The specialized functions are used preferentially here. Only if there is no function that matches the source format will the universal function ConvertAny() be called.

Notice

The ConvertToPdf() function does not allow specific parameters to be passed. The conversion functions are only called with default values. Therefore, a direct call to the relevant function is still required for certain source formats.

Parameter

Data Type

Description

1

Text

2

Text

Examples

ConvertToPdf("test.docx") converts a Word file into a PDF file named test.pdf.

TransformXml()

This function performs an XSL transformation for an XML source file using a stylesheet file. The default name for the target file is %FileBaseName%.%FileExt%. The file extension %FileExt% corresponds to the configured target format.

Parameter

Data Type

Description

1

Text

2

Text

3*

Text

Complete file path of the stylesheet file in XSLT format

4

Text

Target file format created by the transformation in the form of the file extension

Default value: html

5

Text

XSL processor used

The following XSL processors are available:

  • Internal: .NET internal processor (only supports XSLT 1.0)

  • Saxon: external Saxon processor (also supports basic functions of XSLT 3.0) (default value)

Examples

TransformXml("test.xml", , "C:\\transform.xslt", "html") converts an XML file into an HTML file test.html using the stylesheet file transform.xslt.