Hi,
I have a PDF file (800 pages). These are 4-page documents. I need to make a dynamic background for each section.
I need it to work like this:
Section 1 : 1st page from pdf (1st record in database)
Section 2 : 2nd page from pdf (1st record in database)
Section 3 : 3rd page from pdf (1st record in database)
Section 4 : 4th page from pdf (1st record in database)
Section 1 : 5th page from pdf (2nd record in database)
Section 2 : 6th page from pdf (2nd record in database)
Section 3 : 7th page from pdf (2nd record in database)
Section 4 : 8th page from pdf (2nd record in database)
Section 1 : 9th page from pdf (3rd record in database)
Section 2 : 10th page from pdf (3rd record in database)
Section 3 : 11th page from pdf (3rd record in database)
Section 4 : 12th page from pdf (3rd record in database)
You can make use of a Control Script like the following for “Section 1 : 1st page from pdf (1st record in database)” for example:
Name: Example
var background = merge.template.contexts.PRINT.sections["Section 1"].background;
background.source = BackgroundResource.RESOURCE_IMAGE;
background.allPages = false;
background.start = 1; // Start page of the the PDF background
background.end = 1; // End page of the PDF background
background.url = "images/example.pdf";
In this example, I have assumed that the PDF file is added to the Images folder (shown in the Resources pane of the Connect Designer).
When this control script is applied, the first page is assigned to the first record.
Now I need this:
Section 1 : 1st page from pdf (1st record in database)
Section 2 : 2nd page from pdf (1st record in database)
Section 3 : 3rd page from pdf (1st record in database)
Section 4 : 4th page from pdf (1st record in database)
Section 1 : 5th page from pdf (2nd record in database)
Section 2 : 6th page from pdf (2nd record in database)
Section 3 : 7th page from pdf (2nd record in database)
Section 4 : 8th page from pdf (2nd record in database)
Section 1 : 9th page from pdf (3rd record in database)
Section 2 : 10th page from pdf (3rd record in database)
Section 3 : 11th page from pdf (3rd record in database)
Section 4 : 12th page from pdf (3rd record in database)
is it possible to do via script?
Before, I did this with a control script like this, but in this example i must split every pdf on pages 1, pages 2, pages 3, pages 4.
var section = merge.template.contexts.PRINT.sections[‘Section 1’];
var prefix = “images/Pages1.pdf”;
var filePath = record.fields.background;
var resourceURL = prefix + filePath;
section.background.source = BackgroundResource.RESOURCE_PDF;
section.background.url = resourceURL;
section.background.position = MediaPosition.FIT_TO_MEDIA;
section.background.allPages = false;
section.background.start = record.index;
section.background.end = record.index;
section.enabled = true;