There are a few ways to programmatically print to PDF in 4D. In a printing procedure (before using commands such as Print form, Print object, etc.) use SET PRINT OPTION and set the Destination option to the value 3 (PDF file). Note that on Windows, the PDFCreator Driver must be installed first, unless the OS version is Windows 10 and above, in which case the native Microsoft PDF Driver can be used.
When working with 4D Write Pro, use WP EXPORT DOCUMENT with the “format” parameter set to the constant wk pdf. This constant is available starting in v18 R4.
When working with 4D View Pro, use VP EXPORT DOCUMENT and set the “format” property of the “paramObj” parameter to the constant vk pdf format. This command is available starting in v18.
Note that printing to PDF with either 4D Write Pro or 4D View Pro does not require a print driver to be installed.