4D View Pro: Manage Printing and PDF export

With the VP PRINT and VP EXPORT DOCUMENT commands, you can now print a document or create a PDF version of it. However, in order to create an appealing document for your customer, you not only need to print a document, but also add headers, footers, define the zoom, define the paper orientation, and so on. With 4D v18, it’s all possible thanks to the VP SET PRINT INFO command that allows you to define these attributes and more in your document!

HDI 4DVP PDF export and printing

Print info

You can define specific printing options for each sheet with VP SET PRINT INFO. These attributes are used to prepare the document before a PDF export or printing. Of course if you save your document, they’re saved with it.

$printInfo:=New object
$printInfo.headerCenter:="4D View Pro"
$printInfo.footerRight:="This is page &P of &N pages."
$printInfo.orientation:=vk print page orientation landscape
$printInfo.centering:=vk print centering horizontal
$printInfo.showRowHeader:=vk print visibility hide
$printInfo.showColumnHeader:=vk print visibility hide
VP SET PRINT INFO ("ViewProArea";$printInfo)

Export into PDF

You can now export a document in PDF format with the VP EXPORT DOCUMENT command. This export uses the information from VP PRINT INFO and automatically embeds all of the fonts used in your document into the PDF file to ensure a correct and similar rendering. As for .xlsx exports, you can pass an optional formula that will be called once the export is finished.

$options:=New object
$options.formula:=Formula(AfterPDF )
VP EXPORT DOCUMENT ("viewProArea";"C:\\tmp\\order.pdf";$options)

Print a document

To allow the end user to print a document, use the VP PRINT command.

VP PRINT ("ViewProArea";vk current sheet)

This feature is the first step toward printing 4D View Pro documents. Other features are coming soon. Stay tuned!
In the meantime, you can test exporting PDFs and document printing with the HDI above.


Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.