The Create PDF file workflow component is found under Basic and create document. This component accepts an XML file as input. The component creates a PDF file and stores it directly in the file system. The output payload is the same as the input payload e.g. XML.
If you want to process the created PDF file instead of just saving it to the file system, then you should consider the alternative: Create PDF document.
Other components should be used, if you want to use advanced features for the PDF.
The create PDF file component has these parameters:
Template
The template (both InterFormNG2 and InterFormNG templates), with which the input file is merged with. The result of the merge is the PDF file.
Output directory
The output directory, where the PDF file will be created. The default directory is the outbox subdirectory to InterFormNG2_home. On the windows platform, that is (with default settings) inside C:\ProgramData\InterFormNG2\outbox. On the IBM i platform it is default: /iformng2/InterFormNG-shell/user/outbox.
Output file name
The name of the PDF file, that is to be created. It is default: default.pdf.
File name conflict resolution
With this you specify what the workflow should do, if the file already exists. The options are:
Overwrite (default). If you select this, then any existing file with the same name will be overwritten by the new file.
Append version. Select this to add a counter (in parenthesis) at the end of the new file name - prior to the extension. Please consider to append the timestamp (current-dateTime() ) and/or ng:uuid instead and read the warning below before using this option.
Rename existing. Rename the existing (old) file and add the timestamp to the file name. The old file will be rename similar to this: filename_20200812134611716.pdf.
Move existing. If you select this, then the original file will be moved to a subdirectory with the timestamp and the new file is created as requested.
Not only can you select one of the fixed values above for the file name conflict resolution, but you can also use an XPath expression to set a variable value e.g. depending on the input file. The XPath expression should return one of these values:
Overwrite
Rename
AppendVersion
AppendTimestamp
Unknown values will result in "Overwrite" being used.
The following values are also accepted (InterFormNG related values), BUT will result in a warning
append-version-number
rename-existing-file
overwrite-existing-file
Here is an important note/warning when it comes to use of the option: Append version for the file name conflict resolution. You should consider this option as the last resort to ensure a unique file name i.e. it is e.g. very bad practice to simply store MANY files with a fixed name in a folder and then expect InterFormNG2 to rename the output files automatically with the append version option.
If you choose to e.g. save 100.000 files in this manner, then each new file that is created will run through the existing 100.000 files with the same name (and a number at the end) until finally a free number has been found, which will take up a lot of unnecessary time. So it is best practice to try the best to ensure that the append version option is only triggered in a very unlikely situation. InterFormNG2 contains multiple functions, that can help you to build a dynamic, unique file name. You can consider to concat a fixed part of the file name with e.g. the timestamp or the UUID and either only use these or even combine them with a fixed part like the examples below: