OL Learn

Media Rotation in Sheet Configuration

What does the “media rotation” setting in the Sheet Configuration tab of the Section Properties actually do?

I have a job that requires commingling, checks with a corresponding remittance document. The checks output is portrait. The remits output landscape.

In Workflow, after I Retrieve Items, Create Job, and Create Output, the result is a PDF with some pages portrait and some landscape. I run a script that uses the PDF API to rotate the landscape pages. The resulting PDF is then used as a data file for a third data map and template to apply barcodes for a folder inserter.

The script to rotate pages takes extraordinarily long, running several hours.

I had hoped to modify the Remits template to output Portrait. I thought the “Media Rotation” in the Sheet Configuration would do this, but it apparently has no effect. I still get Landscape pages.

I could think of at least two ways to cope with this…

  1. Use a PDF splitter in Workflow, rotate with your script, do the data mapping, flag the records with a property (set property task) and then retrieve them, based in this property, to get all your records again …
  2. Check for landscape in the data mapper, add a field with the result (e.g. orientation = “L”) and than rotate the background in the template (control script), based on this field…
    best regards

Maybe I do not understand it correctly and I havent tested if its a faster appoach. So its only another approach.

Lets say you have one merged pdf with mixed orientations in the workflow as input data.

  1. Create a datamapper configuration for the pdf file. Use “On all pages” as trigger.
    1.1. Create one data field (e.g. named as “bg_pdf”) and set as javascript expression “data.fieldname”. So you have the temp filename of the pdf.

  2. Create a design template with the following control script to create one clone per pdf page and set the pdf page as background with or without rotation to the cloned section.

var printSections = merge.template.contexts.PRINT.sections;
merge.template.contexts.PRINT.sections[“A4”].enabled = false;
var bg_pdf = record.fields.bg_pdf;
var numClones = resource(bg_pdf).pages;

var arr_i = 0;
for( var i = 0; i < numClones; i++){
var page_start = i + 1;
var page_end = i + 1;
if(resource(bg_pdf,page_start).width > resource(bg_pdf,page_start).height){
addBackground(bg_pdf, page_start, page_end, 90);
} else {
addBackground(bg_pdf, page_start, page_end, 0);
arr_i += 1;

function addBackground(bg_pdf, page_start, page_end, orientation){
var resourceUrl = ‘file:///’ + bg_pdf;
var clone = printSections[“A4”].clone();
clone.name = “clone_” + i;
clone.background.source = BackgroundResource.RESOURCE_PDF;
clone.background.url = resourceUrl;
clone.background.start = page_start;
clone.background.end = page_end;
clone.background.rotation = orientation;
clone.enabled = true;

  1. In the workflow just use the connect plugins to output a pdf.
1 Like

This approach was much faster. It completed the rotation step in 1.5hrs for a 21,000 page PDF where about 2/3s of the pages were landscape and needed to be rotated. The Run Script/PDF API approach was at about 6 hours when I finally killed the process.

Update: it finally finished after 8.5 hours of processing. So going from 8.5 hours to 1.5 hours is a big, big win. Thanks so much.

For anyone interested, this is a commingling job. Checks and Remits. The Checks are portrait, the Remits are landscape and variable length.

One Data Map / Template pair for the Checks, a 2nd for the Remits. Commingle to produced a mix-plexed PDF. A new Data Map / Template to perform rotation per Thomas’ technique posted above. Then a last Data Map / Template to consume the rotated/fixed PDF and output PostScript with barcoding and media calls.

I am pleased that this approach was able to increase the speed so dramatically.

Of course, it depends very much on the performance of the computer (cpu speed, amount of cores) and a little bit on the license variant (output speed limit). But with this method you have the possibility to increase the power via different screws.