Copy link to clipboard
Copied
While we are waiting to get Acrobat DC Pro, is there a way to extract every other record in a PDF file using Acrobat Pro 11 and save the one-page files idividually? Input PDF file is over 7,000 pages.
Thanks for the help!
Copy link to clipboard
Copied
The old version of Acrobat can also extract pages.
Copy link to clipboard
Copied
I just wondered if there was a way to extract all of the pages in an 8000 page pdf file to 4000 individual 2 page pdf files. I don't know how to extract two pages at a time. Each of the two page files extracted would contain a first page with a name and policy and a second page with a static notice to all policyholders. It would be great if the individual 2 page files could be created using the policy number for the name.
Thanks Bernd! Have a great weekend!!!
Ken K.
Copy link to clipboard
Copied
Hello @joken99
Is it possible for you to post an example file with a smaller number of pages to test with? Also can you tell us a bit more about the policy number for the naming...is it always the same format, i.e digits and characters and any special characters.
Regards,
Mike
Copy link to clipboard
Copied
Copy link to clipboard
Copied
hello @joken99
You didn't include any attachments and you didn't provide any details around the policy number.
Regards,
Mike
Copy link to clipboard
Copied
Files should be atttached now. Sorry about that!! The policy number is the number on every other page in the upper left corner starting with page 1.
[FILES REMOVED BY MODERATOR FOR CONTAINING PERSONAL INFO]
Copy link to clipboard
Copied
Paste the script below in the console, then select all and press the enter key of the numeric panel.
var noPN=[];
var nbFiles=0;
for (var p=0; p<this.numPages; p+=2) {
var OK=0;
var nbWords=this.getPageNumWords(p);
for (var i=0; i<nbWords; i++) {
var theWord=this.getPageNthWord(p, i, true);
var q=this.getPageNthWordQuads(p, i);
m=(new Matrix2D).fromRotated(this,p);
mInv=m.invert();
r=mInv.transform(q);
r=r.toString();
r=r.split(",");
if (r[0]>56 && r[1]>754 && /^\d{7}$/.test(theWord)) {
OK++;
nbFiles++;
try {
this.extractPages({
nStart: p,
nEnd: p+1,
cPath: "Policy Number #" +theWord+".pdf"
});
} catch(e) {}
break;
}
}
if (!OK) noPN.push(p+1);
}
var txt=nbFiles+" files have been created.";
if (noPN.length) txt+="\nNo policy number found on page(s) "+noPN;
app.alert(txt,3);
Copy link to clipboard
Copied
Hello @joken99
Give the below code a try. It worked for me on the test file First20.pdf extracting every two pages named by the policy#.
for (var p = 0; p < this.numPages; p=p+2) {
for (var n = 0; n < this.getPageNumWords(p); n++) {
cWord = this.getPageNthWord(p, n, true);
if (cWord.match(/\b\d{7}\b/)) {
var pdf_Name = cWord;
}
}
var newFilePath = this.path.replace(this.documentFileName, "");
this.extractPages({ nStart: p, nEnd: p+1, cPath: newFilePath + pdf_Name + ".pdf"});
}
app.alert("Done Extracting Pages!");
Regards,
Mike
Copy link to clipboard
Copied
Thanks Mike; but, How do I run javascript on my file?
Copy link to clipboard
Copied
It's explained in my answer (see my screenshot):
Open the console (ctrl J on PC and cmd J on Mac), then paste the script in the console, then select all the script and press the enter key of the numeric panel.
Both scripts assume the policy number has 7 digits.
Copy link to clipboard
Copied
Hello @joken99
You can run the code in a Action Wizard action.
1. Select the Action Wizard, then "New Action
2. In the Create New Action window on the left side go down to More tools > Execute Javascript add the tool to the right side
3. Click on Execute Javascript > specify settings, in the window that opens copy and paste in the code and save and name the action.
Be sure to uncheck the Prompt User check box.
The newly created action will appear under the Action Wizard in the action list. You can then run the action on the opened file and it will extract every two pages uniquely named.
Regards,
Mike
Copy link to clipboard
Copied
Copy link to clipboard
Copied
hell0 @joken99
Take a look at the link below...
https://acrobatusers.com/tutorials/how-to-create-and-share-actions-infographic/index.html
Regards,
Mike