OL Learn

Create print section and media dynamically with dynamic page size

Hello,

another great feature would be the possibility to create print sections and the matching medium with an individual size.

Examples:

  • I have a PDF datamapper configuration where the input PDFs can have different sizes (also in special formats). I can already determine the dimensions via script. Based on these dimensions I want to create a suitable print section and place the datamapper pdf as background.
  • I have a data field in which the dimensions for a component are specified. Also positions, sizes and contents of the frames to be placed are given in data fields. Based on the dimensions, I want to create a suitable print section. Per script I then create the individual content frames on the new print section.

Regards,
Thomas

Hi Thomas,

You can use a Control Script like the following when you’ve access to the width and height values of a DATAMAPPER_PDF by a record field value:

var field = "";

field = record.fields["dimensions"]; //"10in;10in"

if (field != "") {
	var dimensions = field.split(";");
	var width = (dimensions.length > 0 ? dimensions[0] : "");
	var height = (dimensions.length > 1 ? dimensions[1] : "");
	
	if (width != "" && height != "") {
		var printSection = merge.template.contexts.PRINT.sections["sectionName"];
		printSection.width = width;
		printSection.height = height;
	}
}

Please search for ‘height, width’ on the documentation page ‘Control Scripts - PlanetPress Connect 2020.2 User Guide (link)’, because there is a note about using the width and height values.

1 Like

Hi Marten,

thank you for your feedback. That was my mistake. I have tried it only in version 2020.1, because all our project customers still use the old version.

Sometimes it helps to read the release notes more carefully. :see_no_evil:

Thomas

1 Like