Extract multiple PDF pages - Javascript.

Hello

Relatively new to javascript in acrobat but have managed use a slightly modified script (below) of this Web site to run a batch script in acrobat professional to extract all pages in a multi page PDF. The only problem I have is that, as with javascript, infact 1 page numbered as page 0. Is it possible to modify this script to extract pages from the numbering as page 1? I know this is probably a fairly basic solution, but any help would be greatly appericated.

Thanks in advance!

/ * Extract Pages to the file * /.

A regular expression to get the base name of the file.

var re = /. * \/|\.pdf$/ig;

var filename = this.path.replace(re,"");

Try

{

for (var i = 0;  I < this.numPages;. i++ )
this.extractPages

({

Start: 0,

cPath:filename + "-" + 0 + x + '.pdf '.
});

First, you use a variable called x, when in fact you must use

I have.

To answer your question, you just need to change it to i (i + 1), like this

(I removed the zero. If you want to add a zero extra, you must place

inside the quotes):

cPath: filename + '-' + (x + 1) + ".pdf".

Tags: Acrobat

Similar Questions

  • How can I extract individual PDF pages?

    How can I extract individual PDF pages?

    Hi heidih30527428,

    You will need Acrobat free trial download Adobe Acrobat application | Acrobat Pro DC to extract pages from a PDF, see this document KB Split a PDF | Adobe Acrobat DC tutorials.

    Is not possible with the free player application.

    Kind regards
    Nicos

  • Extract multiple PDF files in the form of PDF files in a folder

    I looked, but have not found a way to do this. I have a table (let's call it TSTATEMENTS) in which a column is a blob that contains a pdf file. In another column is a name for this PDF. I want to run a query on tstatements of filtering on the other columns of tstatements. For example:
    SELECT FILE NAME, PDF_BLOB,

    OF TSTATEMENTS

    WHERE rep_name = 'Joe Smith';

    ----------------------------------

    FILE NAME |   PDF_BLOB |

    ---------------------------------

    G23.PDF | (HUGEBLOB) |

    G77.PDF | (HUGEBLOB) |

    L4G.PDF | (HUGEBLOB) |

    ----------------------------------

    Then, I want to say SQL DEVELOPER to write these HUGEBLOBs to 3 files in a windows folder so that I find myself with

    3 PDF files named g23.pdf, g77.pdf, L4G.pdf. I can do this in TOAD, but we cannot afford to buy another copy of TOAD just for this one function.

    Thank you!

    Mike


    The answer is, no, not currently Developer SQL to retrieve several blobs (PDF files in my case) with a single command. You can extract one at a time.

    I write this for future readers so that they can come directly to the answer and without having to sift through a large number of positions. Thanks to everyone who answered me. I appreciate your time and efforts.

    Mike

  • Extract PDF Pages based on content

    Every fall and winter, I have to work with PDF files are hundreds of pages. Last fall, I came across a java script that I was able to run and it worked perfectly. Last year, I lost more than brain cells or acrobat dc does not work just like acrobat x. I need to find a way to extract the pages based on a word search and save these pages in another file. I would like suggestions. Also, I added the java script that was used last year. Thanks in advance for your help.


    Iterates over all the pages and find a given string and all extracts

    the pages on which this string is found in a new file.

    pageArray var = [];

    var stringToSearchFor = 'Total ';

    for (variety p = 0; p < this.numPages; p ++) {}

    iterate over all of the words

    for (var n = 0; n < this.getPageNumWords (p); n ++) {}

    If (this.getPageNthWord (p, n) == stringToSearchFor) {}

    pageArray.push (p);

    break;

    }

    }

    }

    If (pageArray.length > 0) {}

    extract all pages that contain the string in a new document

    var d = app.newDoc (); This will add a blank page, remove that once we are done

    for (var n = 0; n < pageArray.length; n ++) {}

    d.insertPages ({}

    nPage: d.numPages - 1,.

    cPath: this.path,.

    Start: pageArray [n].

    nEnd: pageArray [n].

    } );

    }

    delete the first page

    d.deletePages (0);

    }

    I guess you are running the script as an Action in Acrobat XI (as described in my blog). You can do the same in Acrobat DC. Just download again the GL ENTRY file (here: extract of Pages PDF-based content - KHKonsulting LLC)-then make sure that the file name is ExtractPagesWithString.sequ (when I download the file using Safari on a Mac, it will add .xml to the end - in this case, just rename the file so that it has the .sequ extension once again). Now you should be able to drag & drop the file on the new Acrobat DC icon or in the application window. You should get get a confirmation dialog box (or two). Once the Action is imported, you should be able to run it. To find the interface Actions, type 'Action' in the Acrobat search toolbar. You will find that in the top of the pane and right at the top of the collection of tools when you click on tools on the left side of the Acrobat window, or you can try to find the wizard 'Action' on the Tools page and click on it. You can now run the Action on one or more files, but still just, it will search the string that I put in the code. To change this. Select this option to change the Action. Suppose that you click the Action Wizard on the Tools page. You should now see the following:

    Click on the button "Manage Actions" and select "Extract Pages with String" then click on the button "Edit":

    The next thing you will see is this:

    When you click on 'Execute JavaScript', this follow-up activity will be expanded and will look like this:

    Make sure 'Interrogate the user' is checked.

    Now, you can save your modified Action. When you run the Action, you can see the JavaScript editor pop up:

    You can now change the variable "stringToSearchFor" and set it to any string of text you want to search or split the document to.

  • A script that will count the total number of pages into multiple PDF files in a batch file?

    Is there a script I can use ExtendScript Toolkit that will count the total number of pages into multiple PDF files in a batch file?

    In another discussion I showed a JavaScript that you can use to write the number of pages to the console in a batch sequence. You would do exactly the same thing in Action, so the action would consist of a simple JavaScript (more tools > run JavaScript) which includes the code.

  • Extract only last page of the PDF - batch document

    Hello

    I need to extract the last page of about 100 documents in a batch process.  I need only the last page, and the number of pages in each document varies (i.e. can be 30, it could be 200).

    Is it possible to do this without having to enter each document and extracting the last page?

    On discussion forums, I found a javascript script to enter the Action Wizard, allowing you to delete the last page, but not to extract it or remove the pages in front of her.

    Thank you!

    No, you can't do it. You cannot replace a file with a file you are currently editing.

    What you can do, however, is to remove all other pages of the file, and then save it under the same name.

    To delete all the pages, but the last, you can use this code:

    this.deletePages (0, this.numPages - 2);

    Then just add a step to Save your action and you're done.

    Just keep in mind that this process is NOT reversible. Then maybe make a backup of your files before you run it.

  • I have two docs pdf I used Acrobat to convert word documents.  How can I extract a single page of a doc to be inserted into the other doc?

    I have two docs pdf that I converted into Word using Acrobat Pro documents.  How to extract a single page of the first RFSO and insert it into the second doc?  When I "select all" he seized the entire document.  I need to take pages, other pages and change some of the text.

    HI djlarp,

    Try to triple - click the text you want to select - it can sometimes be difficult to select text in a document converted. If this does not work, it could be that the PDF document is created from a scanned document and OCR is not enabled when you converted the document. (However, OCR is activated by default when converting via ExportPDF site.)

    If you are unable to select text by triple-click, let us know. I'd be happy to look more closely at your files.

    Best,

    Sara

  • How can I extract a single page in pdf in a larger PDF format?

    How can I extract a single page in pdf in a larger PDF format?

    Hi extract 1 page,

    To retrieve a page of a PDF document, you must use Acrobat. If you do not have Acrobat, you can try it free for 30 days. See www.adobe.com/products/acrobat.html for more information.

    Best,

    Sara

  • How to extract non-consecutive pages of a pdf document. I can highlight in thumbnails but only extract consecutive.

    How to extract non-consecutive pages of a pdf document?

    I see its easy to do with the consecutive pages highlighting the thumbnails can "extract", but this does not allow for non-consecutive pages.

    Thank you

    After you select the pages, you can drag and drop them somewhere,

    as on the desktop, and a new file will be created with only the pages.

    Highlighting the pages if not achievable, or too complicated to do, then a

    script can be used where you specify which pages from script

    extract them to a new file.

  • Save a pdf file showing multiple work plans into a SINGLE pdf PAGE

    Hello

    How can I save my pdf so my 4 work plans presents a single PDF PAGE? (I don't want to merge 4 rebounds in a single pdf FILE, but I want to be able to see all the work plans of the 4 side by side in a single file pdf.)

    Can I choose when opening the pdf file, or what I need to record a special way in Illustrator, to have my 4 work plans?

    Cordially Grimkarklud

    What you want to do is to convert your work plans by plowing the pages. I tried with CS4 (saving up to CS), and the main problem I've had is having to close the gap that has been previously between work plans.

    Help Adobe seems to imply that the CS5 works better

    If you save a document Illustrator of multiple-work plan in a previous version of Illustrator, such as CS3, you can choose to save each work plan in a separate file, as well as a master file that includes all the merged work plans. »

    If you try CS5 save up to CS3.

    Once you get pages of tiles, then when you make a PDF file, all your pages will be on a single page pdf.

  • Problems with the export of PDF to TIFF (a PDF page export also several images in TIFF format)

    Using Acrobat X professional, I'm trying to convert a PDF to multiple page in multiple TIFF files - that is, each page of the PDF file is converted to a TIFF file (for example, a PDF file with 50 pages would cause 50 TIFF).

    I created a remedy so that I can possibly process batches of PDFs. My action in two stages:

    (1) flatten layers

    (2) export all images as TIFF

    -the files are exported to a folder on a network drive

    -file settings are: Monochrome = CCITT G4 / grayscale = LZW / color = LZW

    -color management: RGB = off / off = CMYK / grayscale = off

    -conversion: color space: determine automatically / resolution: 300 pixels/inch

    -extraction: exclude the lower images: no limit

    My PDF is searchable (OCR has been applied). I checked the file to see if it has all the layers - this isn't. The file was created with InDesign.

    Basically, once the action performed there are several exported for each page - TIFF files and when I open the TIFFs they are parts of each PDF page. For example, if a single PDF page has three images on it then three TIFFs are exported for each image instead of a TIFF that is identical to the single PDF page. Then, when I try to treat a PDF with 50 pages that I'm left with is a folder with 150 TIFF files (and not 50 TIFF files - a TIFF for each page of the PDF).

    Here is an example of how files are renamed due to export:

      • HD_08_Issue2_E_Page_02_Image_0001.tif
      • HD_08_Issue2_E_Page_02_Image_0002.tif
      • HD_08_Issue2_E_Page_02_Image_0003.tif
      • HD_08_Issue2_E_Page_02_Image_0004.tif
      • HD_08_Issue2_E_Page_02_Image_0005.tif

    I tried to use the action on a PDF file that had not been OCR'ed and I had no such problem. The only thing I can think is that it is the OCR which is the origin of each page of the file PDF to split into multiple images? The majority of the files that I need to convert PDF to TIFF had applied OCR.

    Any ideas? Thanks in advance!

    In a Save command, you can use the export to TIFF in the output Format.

  • Merge multiple PDF in c# using Acrobat 7.0 files

    I'm trying to merge multiple PDFs into a single pdf file. Does anyone have sample or pseudo code for this?

    Basically, it has hardly changed since version 5 you can use also. 8 SDK / section IAC.

    The command to use is "insert", where the first page must be opened and the other pages will be inserted.

    If you use google for PdDoc.insert you can get tons of examples and perhaps also in C.

    If you use the Acro-Javascript via IAC you can find an example directly in the help file AcroJs.

    HTH, Reinhard

  • get the number of real page of pdf pages...

    Hello world

    I developed the script to extract a single page pdf pdf pages. I need to put the actual number in the pdf file name prefix.

    I tried several ways but could not get the real page number.

    Here is my script:

    for (var i = 0, j = this.numPages - 1; I < this.numPages; i += 1, j = 1) {}
    var pgNum = this.pageNum;
    this.extractPages({)
    Start: I,.
    nEnd: I == numPages - 1? I: i + 0,.
    cPath: name + "_" + j + "_" + pgNum + ".pdf".
    });
    }

    Can someone help me get there.


    Thanks in advance

    Indana

    Locate the getPageLabel method in the Javascript API reference.

  • Can not put multiple PDF files into a single document no more.

    I was able to scan multiple PDFs into one document on my desktop. I can no longer. I have a printer Photosmart HP 6515 and Windows7 OS.  PS. just the other day I had someone remotely access my computer to fix a problem with MagicJack (computer phone) and who knows what they might have done. Thank you to everyone.

    Nice day

    Here are a few screenshots I took it to give you an example of how to do to scan several pages in the scanner software. Make sure that the option is disabled for the creation of a separate file for each scanned page. Subsequently, click on the 'Destination' tab above and save it to any folder you want on your desktop or elsewhere.

    This should help, good luck

    Have a great weekend!

  • Can I put multiple PDFs into a single pdf file?

    Original title:

    PDF to PDF

    Can I put multiple PDFs into a single pdf file?

    I have a lot of files that consists of 1 page. Is it possible so that I can put them together and print them out?

    Otherewise I have to press the button print 60 times.

    You will need a software to do this. If you haven't already, Google for «combining PDF» There are also sites that allow you to do this online.

Maybe you are looking for

  • iPad Air crashes all the time

    I have been using my iPad Air since the day wherever she launched and I have had no problem, however, in my overall experience. But about a week ago my iPad started to be slower and slower and it crashed all the time to reach a State where it is now

  • Best settings (channel) for AE Gen3, for Time Warner cable?

    Best settings (channel) for AE Gen3, for Time Warner cable?

  • Can I get my bios to recognize a hard 3 TB?

    The system is HP Pavilion Media Center m8430f desktop PC The version of the bios is 5.43 It keeps reading the drive as only 750g I have the new firmware for the drive. The hard drive is a Seagate Barracuda ST3000DM001

  • Compaq presario v 3780TU: Base System Device Driver missing

    product compaq presario v 3780TU problem - the two driver missing basic systems, audio device does not not only integrated speakers work not, works of headphones problem when I upgraded to the Windows OS 10 first base h/w device id is PCI VEN_1180 &

  • can ping but cannot browse after you update to SP3 of XP

    Hello I use a computer connected wireless to a DSL modem. There are also three other computers connect to the same ADSL router wirelessly and they work fine. The problem machine running Windows XP SP2 with automatic updates enabled. The computer conn