Rotate 2nd page of dynamic background

I’m using a 2 page pdf, named in the data, as a dynamic background. I’m having trouble rotating the image on just the second side of the template. I thought the sheet configuration, duplex:tumble = checked might do the trick for me, but it seems to make no difference in my output.

I have variable elements on the front of the document + p1 of the pdf as a background. On the back, I just have p2 of the pdf as the background. Where is the correct place to make this happen? I see the option for background.rotate = 180, but I need it to apply to only p2

My current control script for the dynamic background is:

//for images all stored in the images directory
var field, result = “d:\data\temp\images\”;

field = record.fields[“COLUMN12”];
if (field !== “”) result += field + “.pdf”;

var background = merge.template.contexts.PRINT.sections[“duplexPostcard”].background;
background.source = BackgroundResource.RESOURCE_PDF;
background.allPages = true;
background.url = result;

Thanks,
Jim

Hi Jim,

Would it be a matter of rotating the background image for the second page? There is no feature to achieve this but it is possible with some CSS magic. The following selects the background image of the second page and uses transform to rotate it:

.page_bleedbox:nth-child(2) img.ol_pdf_datamapper_input {
    transform: translate(-50%, -50%) rotate(-90deg) !important;
}

Admittedly not very elegant but it does the job.

Erik

Thanks, Erik. That did the trick for me.

@Erik or @jmdornbos How do I implement this CSS code?

I put that css information here:

Good to know, thanks!