4D allows you to print directly to a PDF file with the command SET PRINT OPTION:
For example, this would send the print job to a PDF file at the location contained in $path:
SET PRINT OPTION(Print Destination;3;$path)
However a common issue with this feature, especially when deploying an application to multiple machines or when using 4D Client, is that no PDF file appears on the disk.
If this happens, the first suspicion should be a permissions issue. Be sure to check the 4D has write access to the location to which the PDF file will be saved.