Dynamic PDF as background image with multiple pages

Can anybody help i’m a bit stranded here.
For input to PP Connect datamapper/designer I use a XML file - which gives me X number of records.

Each record holds a Pagelayout and a path for a background pdf file o nthe harddrive.

Now i need Designer to place:
Page 1 from the pdf file located on a harddrive as a background on the same page where record 1 is,
Page 2 from the pdf file located on a harddrive as a background on the same page where record 2 is,
etc.

The PDF page on the harddrive always has the same number og pages as there is records in the xml fil.

Tried the script below - but it is not working as expected.
If the XML has 9 records the PDF has 9 records. The script gives me 9 x 9 pages = 81 pages - only wanted 9 pages

Any hints ?

Tried this script:
var section = merge.template.contexts.PRINT.sections[‘A4_Portrait’];
var prefix = "file:///";
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 = true;
section.enabled = true;

Now this would work if I made a split on the background pdf file into single pages before and wrote the single pages into the records with different names. But there must be an easyer way than doing this split pdf before.

Hi

Instead of section.background.allPages = true; try this:

section.background.allPages = false;
section.background.start = record.index;
section.background.end = record.index;
1 Like

Of cause.
Already tried the start and end - but did not set allPages to false
Thanks

This is a know issue (setting start and end should set allPages to false) and will be solved in 2019.1 (it missed the cut for 2018.2) [internal ref SHARED-65680]