Need to resize a incoming pdf file in a designerdocument to 85% and place some text on the page from the local variables in the process and a barcode.
Tried to use the virtual stationary function, where the background was the incoming pdf file. But in this function the pdf cannot be resized. The only solution I can come up with, is to place all relevant data into a csv file, including temporary parking the incoming pdf file in a folder and then make a reference for the path + filename in the csv file.
Then afterword’s sending the csv file to the datamapper/designer, with the all the relevant data.
But how to I place the pdf file from the csv file in a dynamic picture, where page 1 in the design document is page 1 in the pdf file, record 2 in the csv file is page 2 in the pdf file?
You can dynamically set the background of a section via a Control Script. It utilizes the Background option found in the Section menu. Via this option you can set the background of a section to a PDF Data Mapper input or to an arbitrary PDF file. A page is inserted for each page in the PDF. A Control Script allows you to set this source dynamically.
var printSections = merge.template.contexts.PRINT.sections;
var resourceUrl = 'C:/mixed.pdf';
printSections['Section 1'].background.source = BackgroundResource.RESOURCE_PDF;
printSections['Section 1'].background.url = resourceUrl;
The Background dialog allows you to specify the position of the image but at this stage it doesn’t have an option to scale them. Luckily this can be achieved by adding a CSS rule to one of the stylesheets (for example the context_print_styles.css).
The following rule will scale the images to 85% and center them on the page.