Hello,
i have searched the web and haven't found a solution for the following problem. I have also postes it on the official Acrobat Scripting Forum, but no one has a solution.
My Problem is simple: I want one or more buttons on a Page in my PDF File which prints the last three sites (the last page is the one with the button). And it should also be able to enable some print options like 2 pages on 1, duplexmode and grayscale. So my first solution was the following:
> this.print(true, this.pageNum -3, this.pageNum);
But it doesn't work, because in the print dialog (which is required to set the print options) the page range is set to, for example "2-3 - 2-5" and i alwas got an "invalid page range" error if i want to continue.
So my next idea was to call the print function silently and set the print options by calling "Print options" from the menu:
> app.execMenuItem("PageSetup")
> this.print(false, this.pageNum -3, this.pageNum);
It does work, but if i set the printer settings in the PageSetup Dialog, it doesn't apply to the following print command. I can set what i want in the PageSetup Dialog- the print() function will always ignore it.
Next idea was to extract the pages or temporarely rename the pages. Both isn't possible/ now allowed because the document is protected.
My last idea was to ask the user manually for duplex mode, 2 on 1 and grayscale and set it to the print params:
> var pp = this.getPrintParams();
> pp.colorOverride = pp.constants.colorOverrides.gray;
> pp.firstPage = this.pageNum;
> pp.lastPage = this.pageNum +3;
> pp.pageHandling = pp.constants.handling.nUp;
> pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;
> pp.nUpNumPagesV = 2;
> pp.nUpNumPagesH = 1;
> pp.nUpAutoRotate = true;
> pp.nUpPageBorder=true;
> pp.DuplexType = 1;
> pp.interactive = pp.constants.interactionLevel.silent;
> this.print(pp);
I have removed the user prompts app.alert() and set alle the settings a user can made. But only the "2 on 1" feature works, both duplex and grayscale doesn't work. Also this solution is a bit unflexible.
Does anyone has an idea, how to solve these problems?
Thank you in advance,
Dirk K.