Hi All, I’m extracting the name and address from a PDF that contains multiple records - number of pages is variable per record. I’m then mail sorting the data and using this data in a Data Mapper. in the designer I’m using a control script to pull through the pages in the new sorted order
var pdfName,pageNum, totalPages, startNum, result = “images/”;
pdfName = record.fields[“PDF_NAME”];
pageNum = record.fields[“PAGE_NUMBER”];
totalPages = record.fields[“TOTAL_PAGES”];
startNum = record.fields[“STARTNUM”];
if (pdfName !== “”) {
result += pdfName;
}
else
{
logger.warn(‘NO PDF NAME’);
}
var background = merge.template.contexts.PRINT.sections[“FirstPage”].background;
background.allPages = false;
background.start = startNum;
background.end = startNum;
background.source = BackgroundResource.RESOURCE_PDF;
background.url = result;
background.position = MediaPosition.ABSOLUTE;
background.left = “0mm”;
background.top = “0mm”;
if(totalPages > 1)
{
for (let i = 2; i < totalPages; i++) {
startNum++;
var clone1 = merge.context.sections[“ContinuationPage”].clone();
var background = clone1.background;
background.allPages = false;
background.start = startNum;
background.end = startNum;
background.source = BackgroundResource.RESOURCE_PDF;
background.url = result;
background.position = MediaPosition.ABSOLUTE;
background.left = “0mm”;
background.top = “0mm”;
merge.context.sections[“FirstPage”].addAfter(clone1);
}
}
All works fine from what I can tell. I also need to add some of the text I have extracted to one of the following pages. Is there a way I can target a certain div box to print or not from within the
control scripts for loop?