Need to print section 1 then add pdf's then print section 2

Hi - this is new one for me. I have a template with two print sections. One ‘Confirmation’ the second ‘Signature’. I need to always print the Confirmation page first. Then I have pdf’s I am merging in the middle then need to print the Signature page last. My workflow is pretty simple right now (was just asked to make this change). I currently have it set up so that it creates the print sections, goes into a merge folder then goes to another folder and based on a number picks up the pdf’s. Now I need to change that to just print the confirmation page first, pick up the pdf’s then print the signature page. I can make two templates but was wondering if there was a way to use the one template.

Thank You

Hi ahaddad,

what about using 3 sections in you design template?
Section 1 = Confirmation page
Section 2 = PDF (as dynamic background) pages
Section 3 = Signature page

Maybe I missunderstood your requirements. So you have to explain it a bit more in detail.
What do you have as input file?
Do you have the middle pdfs before executing the template?

Hi - I thought of that but there are 8 different pdf’s that are about 25 pages each. My input file is a .csv. Right now I create the confirmation page and signature page and put them in a merge folder. Then I pick up the pdf’s and put them in a merge folder. I rename the pdf’s 1_#### and the other one 2_#### so they get picked up with the signature page last.

Thanks

ok - I thought about what you said and I added a folder called PDF’s. I placed the 8 pdf’s in the folder. Example of what they are labeled - 865027.pdf, 865031.pdf and so on. I added the script below. This works in the template however when I run it through debug it brings in ALL the pdf’s. What I mean ‘works in the template’ is that the section 1 changes with the data. In my data I have a ‘plan #’ so if it is plan 865027, in the template it shows only the pdf for 865027. When run through workflow it picks all 8 pdf’s.

var field, result = “C:\Users\loon\Documents\ConnectDesigner_Work\IRARewards_Signature\PDFs\”;

field = record.fields.ToPlan;
if (field !== “”) result += field + “.pdf”;

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

Are you using the same data file as input in both cases?

I assume that you have applied the JavaScript code you shared to a Control Script, is that correct?

Are you also getting the same result after applying the following JavaScript code instead?

var field = "",
	result = "C:/Users/loon/Documents/ConnectDesigner_Work/IRARewards_Signature/PDFs/";

field = record.fields.ToPlan;

if (field !== "") result += field + ".pdf";

var background = merge.template.contexts.PRINT.sections["Section 1"].background;

background.source = BackgroundResource.RESOURCE_PDF;
background.url = result;
background.allPages = true;

Tip: The above JavaScript code is partly based on the JavaScript code example available on the help webpage Control Script: Setting a Print section’s background.