Reversing Page Order in document set

Hello just trying to figure out where i can reverse the page order in a document set when i send it to print.

Our mail inserter requires the pages in a document set to be fed reversed, so for example in a document set there is 3 pages, I need the printed output to be Page 3 -> Page 2 -> Page 1

Many Thanks

1 Like

What type of output do you produce? PDF, PostScript, PCL…?

PDF, as these documents all need to be barcodes and matched with a seperate document order is very important so I would prefer to do it in program. Right now I’ve done it a few times simply reversing the entire job (multiple sets) in reverse but that is opposite of our normal sorting order.

Thanks for your help!!

Ok, one way to achieve this would be to split your PDF per set in the Output Preset with the “Separation” option. Then once you have the PDF for each set, use a PDF API script in the Workflow to reverse the page order in each of the set. If this is a workaround you can consider, then I can provide an example script.

That will be great Rod, I’m new to scripting and this software, so any advice I can get will be terrific! But just to understand this workflow, essentially in creating the PDF file into seperate document sets to the output folder?

Is this then followed by a new workflow with the PDF API script to reverse the pages? With a new input and output folder?

Many thanks rod

In this case, proceed as follow:

  • Create a Job and Output preset which splits your output per set and write the files onto a folder. https://learn.objectiflune.com/en-gb/planetpress-connect/howto/splitting-job-file-per-document-or-document-set
  • In the Workflow, the “Create Output” should be done with the “As defined by Output Preset” option. This means the output folder must be defined in the Output Preset
  • You could start a new Process which picks the PDF from the above Output folder, goes through the Run Script action to reverse the order of Page in each PDF

VBScript Version:

Dim inputPDF, pageCount, lastPage, i

Set inputPDF = Watch.GetPDFEditObject

inputPDF.open Watch.GetJobFileName,false

pageCount = inputPDF.Pages.Count

lastPage = pageCount - 1

For i = 0 To PageCount - 1

inputPDF.Pages.Move 0, 1, lastPage

lastPage = lastPage - 1

Next

inputPDF.Save false

inputPDF.close

JavaScript Version:

var inputPDF = Watch.GetPDFEditObject();

inputPDF.Open(Watch.GetJobFileName(),false);

var pageCount = inputPDF.Pages().Count();

var lastPage = pageCount -1;

for(var i =0; i <= pageCount - 1;i++) {

inputPDF.Pages().Move(0, 1, lastPage);

lastPage -=1;

}

inputPDF.Save(false);

inputPDF.close();

The PDF Alambic API reference :

http://help.objectiflune.com/files/EN/alambicedit-api/AlambicEdit.html

Thank you for your detailed response!

Greatly appreciated

Please test and confirm whether this works and mark as Answer so other users benefit from this thread.

An alternative to this that requires no scripting:

Use a Connect Output Preset and set it to separate at every page. Then use the following Job Output Mask to a temp folder

page_${(‘00000’+file.nr).slice(-4)}.pdf

This will output each page individually to your temp folder named by the page number like so: page_0001.pdf

Finally, use the Merge PDF Files plugin on that temp output folder using a descending sort order. It will pick them up in reverse order and merge them, resulting in the output being inverted.

Thank You for your help!

we came into the same dilemma with the inserter, and we have to output to AFP format. Should i go through all the steps above and then convert the final PDF to AFP or there are more efficient way to do it ?