Reputation: 3
I have a PDF composed of multiple pages which the user can choose to print. The user chooses using a set of tick boxes on the first page (i.e. theMRI, theEEG, etc).
There is a PRINT button that then sends whichever pages were ticked to the nearest printer. I'm wondering whether it would be possible to adapt this script to extract those same pages instead to a PDF saved locally on the users computer.
Is that possible?
var theMRI = this.getField("MRI").value;
var theEEG = this.getField("EEG").value;
var theMGL = this.getField("MGL").value;
var theCyto = this.getField("Cytogen").value;
var theMito = this.getField("Mitogen").value;
var theOutpt = this.getField("Outpt_Lab").value;
if (theMRI != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 3});
if (theEEG != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 4, nEnd: 4});
if (theMGL != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 5, nEnd: 5});
if (theCyto != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 6, nEnd: 7});
if (theMito != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 8, nEnd: 9});
if (theOutpt != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 10});
Upvotes: 0
Views: 797
Reputation: 4917
Using Adobe Reader? No. Adobe Reader can't modify the pages or page content of a PDF. However. If the user has Adobe Acrobat Standard or Pro, a JavaScript can extract pages to a new PDF using something like the code below. PDF page numbers are zero-based so the first page is 0. The third parameter is the file name for the extracted pages.
this.extractPages(startPageNum, endPageNum, "extractedPages.pdf")
Upvotes: 1