Configuring image formats
- 3 minutes to read
You can specify which file formats are allowed to be uploaded to the Preflight Tool in the uploader.fileTypes array. By default, the Preflight Tool uploads only PDF files. However, you can add other image formats to this array to support any combination of:
- AI
- BMP
- GIF
- EPS
- JPG
- JPEG
- PNG
- PSD
- TIFF
If you want to support other formats, then you can apply converters as described below.
Microsoft Office converter
If you have installed Microsoft Office on the same server as the Preflight Tool, you can use it to convert office files. The Preflight Tool will automatically find Microsoft Office and will convert the files with it. To do so, add the DocConverter
key with the MicrosoftOffice
value to AppSettings.config.
<add key="DocConverter" value="MicrosoftOffice"/>
After that, add the required format to the fileTypes
array.
"uploader": {
"fileTypes": [".pdf", ".doc", ".docx"],
"multiple": true
},
...
In this mode, files of the following types will be supported:
- MS Word:
DOC
,DOCX
,RTF
- MS Excel:
XLS
,XLSX
,XLT
- MS PowerPoint:
PPT
,PPTX
,PPTM
- MS Publisher:
PUB
Warning
Using Microsoft Office in this mode may require a special type of license: Unattended license. Please contact your Microsoft license provider to learn how to properly license Microsoft Office for these scenarios.
LibreOffice converter
As an alternative to the Microsoft converter, you can use LibreOffice in the case that you do not have the appropriate Microsoft Office license. LibreOffice is open-source software that uses its own engine to work with Microsoft Office documents. Note that when this software converts the documents to PDF, the result may differ from how they look in Microsoft Office.
You can install a portable version of LibreOffice and add the following keys to AppSettings.config.
<add key="DocConverter" value="LibreOffice"/>
<add key="LibreOfficeExecutablePath" value="D:\LibreOfficePortable\App\libreoffice\program\soffice.com"/>
<add key="LibreOfficeEscapeSpacesForSoffice" value="true"/>
Here, we enable the LibreOffice converter and specify the path to its executable file. In case the file path may contain spaces, we enable escaping.
Important
The application pool in which the Preflight Tool is running must have access to the folder that contains the executable file. You must also grant the Modify permission to the TempDataDirectoryPath folder to this pool.
After you have defined these keys, add the required format to the fileTypes
array.
"uploader": {
"fileTypes": [".pdf", ".odt", ".odp"],
"multiple": true
},
...
In this mode, files of the following types will be supported:
- MS Word:
DOC
,DOCX
,RTF
- MS Excel:
XLS
,XLSX
,XLT
- MS PowerPoint:
PPT
,PPTX
- OpenOffice:
ODT
,ODP
,ODS
Note
The file conversion to PDF is carried out by LibreOffice itself, not the Preflight Tool. In the case of an incorrect conversion, contact LibreOffice support.
Warning
We have tested this functionality with LibreOffice 7.1.8 and 7.2.4 Portable. Use newer or older versions at your own risk.
CLI converters
If you have a CLI tool that can convert other formats to PDF, you can use it through the mechanism of convertors. On the back end, you must configure such converters in the Converters.config file.
For example, you can use the Ghostscript utility to convert an ESP format to PDF. To set up this utility, you can specify the path to its executable file and pass the command-line parameters as follows:
<Aurigma.DesignAtoms.Converters>
<Converters>
<Converter name="epsgs"
format="eps"
executable="D:\ghostscript\gs9.27\bin\gswin64c.exe"
args="-dPSFitPage -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFitPage -r300 -sOutputFile=%OUTPUT% %INPUT%"
timeout="30" />
</Converters>
</Aurigma.DesignAtoms.Converters>
Important
The command-line arguments must contain variables for the input and output file names, %INPUT% and %OUTPUT%.
Let's look at these parameters in more detail.
Parameter | Description |
---|---|
name | The unique converter name. |
format | The file format that requires the conversion. |
executable | The path to the executable file of the converter. |
args | Command-line arguments. The Preflight Tool uses the %INPUT% variable for the input file path and file name of the original image. %OUTPUT% contains the file path and file name of the converted image. |
timeout | The time limit for the conversion. The default value is 30 seconds. |
In the same way, you can use other command-line utilities if you have the appropriate license.