It's possible, but not like that. First of all, you're not defining the page range, and you're using two print commands, for some reason.
But more importantly, this can't be done just from a script that is located in the file itself. That would be a huge security issue if a PDF could just start printing itself without any user confirmation.
That's why it can only be done silently from a trusted context, e.g. a folder-level script that's installed on the user's local machine.
Thanks very much for your help. It is much appreciated.
What if I had a button that prints a page range to a specific printer. Is that possible?
Id rather the printer dialogue box didn't appear however if it needs to due to security it would be fine.
I think I have managed it thanks to this post that I struggled to find, and reworking the code.
It seems to be working great, just need to find out now how to have the two pages print on two sides. I think this is called duplex printing and Acrobat supports this is the printer does.
The code working for me is
var pp = this.getPrintParams();
pp.printerName = "EPSON XP-442 445 Series";
pp.firstPage = this.pageNum-1;
pp.lastPage = this.pageNum;
pp.interactive = pp.constants.interactionLevel.silent;
Add this line of code:
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipShortEdge; // or DuplexFlipLongEdge