-1

I would like to know how I can take an existing PDF with multiple pages, and I need to print every page multiple times.

For example I have a 3 page PDF. I need the output to be 111 222 333 and not just 3 copies (123 123 123).

What exactly is the way to approach something like this? Where do I start?

Thanks.

master2080
  • 366
  • 3
  • 15

1 Answers1

3

You can do this in multiple ways. I would suggest using Ghostscript's ps2write device, this creates a level 2 PostScript program from a PDF file, recent versions allow you to inject specific PostScript at the document or page level.

If you insert <</NumCopies 3>> setpagedevice at the document level, then a conforming level 2 printer should produce multiple copies of each page.

Complicating the issue is the Collate page device parameter. If the device can handle collating, then this parameter determines whether multiple page copies are delivered as 123, 123, 123 or 111, 222, 333.

Simplest solution is to set it to false, that way if it respects collating then you will get 111, 222, 333. If the device doesn't respect collating then you will still get that ordering.

So, with a very recent version of Ghostscript I believe that:

./gs -sDEVICE=ps2write -sOutputFile=out.ps -sPSDocOptions="<</NumCopies 3 /Collate false>> setpagedevice" <input.pdf>

Will produce a PostScript program which will do what you want.

You could also, for example, use the ps2write device to create one output file per page:

./gs -sDEVICE=ps2write -sOutputFile=out%d.ps

You could then copy each output page the required number of times and cat them into the correct order.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • Thank you for your answer, can you please tell me how I can use the command? If i try running that with the gswin64c it tells me that the syntax of the command is incorrect. What if I have additional features that I require? Where can I find more? – master2080 Jun 01 '17 at 18:58
  • I got the command to work, but I am getting an empty postscript file. What could be the issue? – master2080 Jun 01 '17 at 19:31
  • Hard to say, you haven't told me if you got anything printed out (such as an error message), what version of Ghostscript you are using, or given me a file to look at. What do you mean by 'additional features' ? For Ghostscript you can read the supplied documentation, or look here : https://www.ghostscript.com/doc/9.21/Readme.htm – KenS Jun 01 '17 at 19:51
  • Sorry, I'm learning this on the fly as I go along. I got a result when using GSView, but I can not get the same result when using the command line. I get a blank postscript file with no errors from the program. I am using the latest GhostScript. – master2080 Jun 01 '17 at 20:02
  • GSView is not Ghostscript (despite the name). The only way I can likely help you is if you post a file to experiiment with, and a the command line you are using. – KenS Jun 02 '17 at 23:35