How to place dynamic PDF in Designer and resize it

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?

https://learn.objectiflune.com/qa-blobs/2628534788084135097.pdf

Hello Klaus,

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.

.page_mediabox img.ol_pdf_datamapper_input {
    transform: translate(-50%, -50%) scale(0.85, 0.85) !important;
}

Below a few links to the online Help on Control Scripts.

I hope this is of some help,

Erik

Control Scripts
http://help.objectiflune.com/en/planetpress-connect-user-guide/1.7/#designer/API/Control_Script_API.htm

Control Scripts - Sections
http://help.objectiflune.com/en/planetpress-connect-user-guide/1.7/#designer/API/section_Object.htm

Where is the documentation for the CSS classes and IDs used by Connect? How did you know that you could use:

.page_mediabox img.ol_pdf_datamapper_input
?
And what would one use for background PDF that isn't the data source (just a normal "image" in the template)?

Can you explain why the translate of negative 50 percent, centers the image?

Read an article on css-tricks.com:

Background information on some specific Connect selectors is found in the online help, check:
http://help.objectiflune.com/en/planetpress-connect-user-guide/2018.1/#designer/Scripting/Connect_Selectors.htm

Alternatively click the Preview HTML icon on the toolbar and use the Inspect option of your browser to scan the DOM.