Printing Duplex..Insert blank page(s)

I have an input PDF that has the following structure:

Pages 1 to n (variable number of invoice pages) printed simplex
followed by at least 2, but up to 7 generic pages to be printed duplex

If I set the document to duplex it will print the invoice part duplex, but as mentioned this needs to be simplex

Obviously some blank pages need to be inserted. Can anyone help with how to do this?

Is there any clear indication of when a page should be simplex or duplex? If so, you have various options. Some possible ways:

  • Add the required blank pages in the workflow with a scripting solution via the Alambic library (advanced skills required).
    AlambicEdit API reference
  • Split the PDF in the workflow into several PDFs and save them in a directory. At the same time, save the information on the split PDF files (e.g. path and file name in a variable as JSON). Transfer the information on the stored PDF files to the Designer (e.g. as a JSON string) and load the PDF files there as a dynamic background in different sections. The duplex settings can be set individually for each section.
  • Use trigger areas to find out which page areas of the PDF file are simplex/duplex and save this information (e.g. as JSON in a variable). Here, too, you transfer the information to the Designer, where you load the PDF as a dynamic background in different sections, using the determined page ranges for the background PDF in the extended script.
    Control Script: Setting a Print section's background

There are certainly other options. Which way would fit depends on the data and the requirements.

OK. Different scenario…

Invoice is 2 pages (blanks inserted for only single page invoice) and can be printed duplex, but the following generic 1 to n pages must always start on the front side of a new page

The invoice has a unique client number on the 1st page only for single page invoices, but on each page for 2 page invoices.

How can I split the records using the unique client number, as currently the data mapper thinks the blank page is a new record

I don’t get it to 100%. I’m confused about the invoice part and the following pages part. How does your pdf file looks? Do you have one pdf with one invoice and some following pages? Or do you have multiple invoices with following pages per invoice in one pdf and you have to split it into single records (per invoice with corresponding pages)?

For the Datamapper part:
If every page for one record/document holds the same customer number (or that area is empty) you can use a boundary script to check on change (and not empty).

Example:

var region_static = boundaries.get(region.createRegion(131,78,155,82));
	logger.info("region_static:" + region_static[0]);
	var customer = boundaries.get(region.createRegion(156,78,193,82));
	logger.info("customer:" + customer[0]);
	
	if(region_static[0] != undefined && region_static[0].trim() != '')
	{
		if(boundaries.getVariable("lastCNR") != null)
		{
			
			if(customer[0] != boundaries.getVariable("lastCNR"))
			{
				boundaries.set();
			}
			
		}
		boundaries.setVariable("lastCNR",customer[0]);
		//boundaries.setVariable("lastCNR",customer[0].trim());
	}

https://help.uplandsoftware.com/objectiflune/en/olconnect/2024.2/datamapper/Scripting/Boundaries_JavaScript.html?Highlight=boundary

For the Designer part:
If you know that the invoice has always 2 pages you can set two sections. One for the invoice and another for the following pages.
In both sections you can set the background to “From PDF DataMapper input”.
In the invoice section you set the background pages range: 1 To 2
In the other section you set the background pages range: 3 To 999
You can set the duplex option individual per section via the “Sheet Configuration”.

Hope that helps in any way. :slight_smile:

Thank you for you help this far. The pdf is say 300 pages, 1st 2 pages are invoice pages the second being blank if no content. Followed by n to 7 generic pages of content. Then next record starts with a new invoice so you have assumed correctly. The customer number only appears on the invoice page(s) if they contain content.

I’m having trouble setting the region coordinates however. It seems to correctly determine the end of the invoice pages, but then splits each generic page following into a separate record. The customer number sits at 180mm in from the left, 23mm down from the top,10mm in from the right and 274mm up from the bottom. Are these placed on the “static” region or the “customer” region in your code?

Also, are the data extract coordinates different from region coordinates