Skip to main content
Known Participant
December 6, 2021
Question

Extract One Page With The Same Phrase In Multiple PDFs

  • December 6, 2021
  • 2 replies
  • 623 views

Does anyone know how to extract one page in multiple pdfs with the same phrase?
The page this phrase is on varies in each PDF. Which means we cant extract it by page number.


[[----Attached is the script I have to extract the first page of the PDF----]]


<</Commands [/c << /0 [/c << /Config [/c << /UIPolicy [/i 3]
>>]
/HandlerName [/a /JavaScript]
/Params [/c << /ScriptCode [/t (this.extractPages\({nStart:0, cPath: this.path.replace\("/.*\\/|\\.pdf$/ig", ""\)+"_P1"+".pdf"}\);\r\n)]
/ScriptName [/t ()]
>>]
/Title [/t (Execute JavaScript)]
>>]
>>]
/Input [/c << /FileVariation [/i 2]
/SourceFileOptions [/c <<>>]
>>]
/Output [/c << /AddToBaseName [/b false]
/Compatibility [/i 5]
/DontOverwrite [/b false]
/FileVariation [/i 2]
/InsertAfterBaseName [/t ()]
/InsertBeforeBaseName [/t ()]
/OptimizePDF [/b true]
/PDFOptimizerAcroscanQlty [/i 50]
/PDFOptimizerCCmprs [/b true]
/PDFOptimizerCCmprsFmt [/i 1]
/PDFOptimizerCCmprsQlty [/i 2]
/PDFOptimizerCSample [/b true]
/PDFOptimizerCSampleAbove [/i 225]
/PDFOptimizerCSampleAlgo [/i 2]
/PDFOptimizerCSampleRes [/i 150]
/PDFOptimizerCmprsFlate [/b true]
/PDFOptimizerCmprssFile [/i 1]
/PDFOptimizerDoAcroscan [/b false]
/PDFOptimizerFlattenDoc [/b false]
/PDFOptimizerGCmprs [/b true]
/PDFOptimizerGCmprsFmt [/i 1]
/PDFOptimizerGCmprsQlty [/i 2]
/PDFOptimizerGSample [/b true]
/PDFOptimizerGSampleAbove [/i 225]
/PDFOptimizerGSampleAlgo [/i 2]
/PDFOptimizerGSampleRes [/i 150]
/PDFOptimizerLZWToFlate [/b true]
/PDFOptimizerLinearize [/b true]
/PDFOptimizerMCmprs [/b true]
/PDFOptimizerMCmprsFmt [/i 2]
/PDFOptimizerMCmprsQlty [/i 0]
/PDFOptimizerMSample [/b true]
/PDFOptimizerMSampleAbove [/i 450]
/PDFOptimizerMSampleAlgo [/i 2]
/PDFOptimizerMSampleRes [/i 300]
/PDFOptimizerRmComments [/b false]
/PDFOptimizerRmEdge [/b false]
/PDFOptimizerRmExRefs [/b false]
/PDFOptimizerRmFormActions [/b false]
/PDFOptimizerRmImgAlts [/b true]
/PDFOptimizerRmInvLBs [/b true]
/PDFOptimizerRmJSActions [/b false]
/PDFOptimizerRmPieceInfo [/b false]
/PDFOptimizerRmStructure [/b false]
/PDFOptimizerRmThumbnails [/b false]
/PDFOptimizerRmUnusedNDs [/b true]
/RunPDFOptimizer [/b false]
>>]
>>

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
December 6, 2021

This is not a script, but the complete XML code of the Action.

Is this "phrase" more than one word? Can it appear on multiple pages?
I recommend you use the Search & Remove Text command to locate the phrase. It will add a Redaction annotation to all the instances of it in your file. You can then search the file for those annotations and extract the pages they're on (deleting the annotations before you do, so they're not present in the extracted pages).

ET2021 ETAuthor
Known Participant
December 6, 2021

The phrase is a combination of numbers and letters at the bottom of the page. For example: ABC123

We need to extract the page and save it as its own .pdf to be processed because its a form that needs to be filled out and sent back. The attached XML takes out the first page and saves it as its own pdf, which is how we want to save the page with the phrase in it. 

ET2021 ETAuthor
Known Participant
December 6, 2021

I forgot to mention, this is an Action Tool in Acrobat