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):
Default value: the value specified in |
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 |
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:
|
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 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: |
5 | Bool | Boolean value determining whether the print is in landscape format ("Landscape") Default value: |
6 | Text | Paper format for page-by-page printing The following values are permissible:
|
7 | Text | The width of the margins Numerical values with a unit of measurement, e.g., |
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. |
4 | Number | Color depth Default value: |
5 | Number | Resolution in DPI, if it is to be changed Default value: |
6 7 | Number | Absolute image width and image height in pixels, if these are to be changed Default value: 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 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: 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):
Default value: the value specified in |
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: |
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:
|
4 | Text | Language of the OCR dictionary to be used (e.g., The appropriate dictionary file must be available in the program directory for the respective language (e.g., |
5 | Bool | Boolean value determining whether OCR is executed in parallel across multiple pages via multithreading Default value: |
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:
The |
4 | Number | Resolution (dpi) of the target pages Default value: |
5 | Number | Color depth (bpp) of the target pages:
|
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:
|
4 | Text | Language of the OCR dictionary to be used (e.g., The appropriate dictionary file must be available in the program directory for the respective language (e.g., |
5 | Bool | Boolean value determining whether OCR is executed in parallel across multiple pages via multithreading Default value: |
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: |
5 | Text | XSL processor used The following XSL processors are available:
|
Examples
TransformXml("test.xml", , "C:\\transform.xslt", "html") converts an XML file into an HTML file test.html using the stylesheet file transform.xslt.