What if I told you that with 4D v18 R4 you can export 4D Write Pro documents directly to PDF format (on both macOS and Windows), without needing to install any printer drivers or additional software? Now you can … and that’s not all! You’re also able to set several options for both the form and the content. Keep reading to learn more!
Exporting in PDF format can be done in two ways:
- To a document on your hard drive or
- To a BLOB variable that can then be exported, archived, sent as an email attachment, etc.
You can also define a number of options in order to specify precisely what should be exported and how.
- Does your document have headers and footers that don’t belong in your PDFs? No problem! Don’t export them.
- Need control over images because your documents can be printed, but your PDFs are only intended to be previewed on screen? Choose the screen-optimized option.
- Don’t need to export background images? Great! Your generated PDFs will be lighter!
- What about links to bookmarks and external URLs? Worry not, they’re maintained.
Here’s some code to show you how easy setting up these options can be:
var $options : Object
var $Path : Text
$Path:=Get 4D folder(Database folder)+"Test.pdf"
$options[wk visible background]:=False
$options[wk visible headers]:=False
$options[wk visible footers]:=False
$options[wk optimized for]:=wk screen
WP EXPORT DOCUMENT(WPsample;$Path;wk pdf;$options)
Something else worth mentioning, the command is thread-safe, so if you are handling multiple documents, the export will be faster since all the cores will be operational.
More information is available in the doc center. Happy exporting!