Tech Tip: How to Programmatically Set Document Length for PDFs
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: August 26, 2024
When a developer is printing a PDF with repeating parts, the following code can be used to calculate and set the length of the document. This code should only be used if the PDF is not going to be a paper printout, as paper printout page sizes are defined by the size of the paper instead. The developer also must know the length of the repeating component in order to use this code.
SET PRINT OPTION(Paper option; 608; 160*10) // 160 pixel times 10 calls to Print form SET PRINTABLE MARGIN(0; 0; 0; 0) For ($i; 1; 10) Print form("FormToPrint"; Form detail) // The detail is 160 pixel in height End for |
This particular example uses 160 and 10 to set the height of the component and the number of repetitions. These numbers can be adjusted based on what the developer wants to print.