Script for extracting multiple pages

Hi,
I'm working with the default "extract pages" script: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_A croJS.88.465.html
I want to modify it to extract 2 pages at a time.  For example, say I start with a 6-page document.  I would like the script to extract pages 1,2 as one document, then pages 3,4 and 5,6.
How would I modify the script to do this?
Thanks!

You could use a loop, but you don't need to for what you want. Do something like:
// Extract first two pages to a new file
extractPages({nStart: 0, nEnd: 1, cPath: "/F/temp/file1.pdf"});
// Extract 3rd and 4th pages
extractPages({nStart: 2, nEnd: 3, cPath: "/F/temp/file2.pdf"});
// Extract fifth and sixth pages
extractPages({nStart: 4, nEnd: 5, cPath: "/F/temp/file3.pdf"});
Obviously, you need to change the file paths.

Similar Messages

  • Script for combining multiple documents?

    hi there,
    well I think there's been a lot of discussion going towards this topic. My concerns aren't quite lining up with the topics. We using a script for placing images, and instead of going document to document...I would like to combine all the indd documents...there's usually at least 24...and to import NOT as pdf's, just as individual pages within the one document...insert my images using the other script...and then later choosing to re-export the pages as individuals. With ascending order of page numbers in the correct sequence they were brought in as.
    thanks for the help.

    -Printing by folder only helps when I need to run one copy of the files, typically I need to print multiple copies or save them for future printing.  Also I have had errors printing via that method before because it will sometimes overload the printer queue.
    -It would be great if clients always provided print ready documents, but that is usually not the case and I have to correct it which is why I am here asking how to do this.
    And if you can not do that then you need to insert a blank page into the files with an odd number of pages.
    Right.  That is what I am looking for; something to automate inserting a blank page into files that have an odd number of pages WITHOUT knowing the documents page counts before hand and WITHOUT having to manually insert blank pages.

  • Solution for scanning multiple pages from inside the form6i/10g

    Hi All,
    I need to scan multiple pages from Oracle forms (6i/10g) using a scanner which is scanning multiple pages per minute. Can any one post a solution for me.
    Hafeez

    here are the two ways I use to scan images.
    1) if the image is a single TIF image then d2kwutil can upload the image into a BLOB field on the database (but it is limited to only SINGLE-page TIFs).
    2) if the image is a single or multi-page PDF, then your forms client must copy the image to a filesystem location known by the database (where the filesystem location is a directory on the database), and then the database can import the image into a BLOB field within the database.
    either solutions work pretty fast for me (<10 seconds per image)
    Chris

  • Does anyone have a script to duplicate multiple pages in CS4?

    I know it can be done, but I'm not a programmer. What would be the script to duplicate a user defined number of pages after a user defined page in a mulit-page InDesign document? We have documents with up to 159 pages, but need to have pages within the documents duplicated right after a selected page, not to the end of the document.
    This is all I have of a script for this and I don't know how to make it work or make it user-interactive for page number input:
    --Duplicating more than one page at a time in InDesign CS4
    tell application "Adobe InDesign CS4"
        set mySourcePageNumber to UserInput1
        set numberOfPages to UserInput2
        tell application "InDesign 6.0.3"
            tell active document
                repeat numberOfPages times
                    set myNewPage to duplicate page mySourcePageNumber
                end repeat
            end tell
        end tell
    end tell

    This is a very basic script, just written for you on CS3 and totally untested:
    if (app.documents.length == 0){
        alert ("Please open a document, select an object, and try again.");
        exit();
    var myDoc = app.activeDocument;
    var myPage = myDoc.layoutWindows[0].activePage;
    var myPageId = myPage.id;
    var myDialog = app.dialogs.add({name:"Duplicate pages"});
    with(myDialog.dialogColumns.add()){
        with(borderPanels.add()){
            staticTexts.add({staticLabel:"Duplicate front-most page # " + myPage.name});
            var myIntBox = integerEditboxes.add({editValue:1, smallNudge:1, largeNudge:10});
            staticTexts.add({staticLabel:" times"});
    var myResult = myDialog.show();
    if(myResult == true){
        var myNumber = myIntBox.editValue;
        if (myNumber < 1) {
            alert(myNumber + " is invalid number.");
            exit();
        for (i = 0; i < myNumber; i++) {
            myPage.duplicate(LocationOptions.AFTER, myDoc.pages.itemByID(myPageId));
    myDialog.destroy();
    It duplicates the active (the front-most page) — its number you see in the bottom left corner of the document window. You can type a number or use up/down arrows to increment it by 1 (add shift key to increment it by 10).
    Hope it helps.
    Kasyan

  • Free script for replacing multiple footage files

    Hello!
    I made a simple script for easily changing multiple footage paths. I'm a 3D artist and found it a burden to replace all the vray render passes every time I rendered a new version. I'm sure it has other uses as well, like checking and setting which of your footage files are local and which ones are on a fileserver.
    You can also copy and move footage from one file to another with this tool.
    I'm not a professional scripter and would like some comments and crits. What would be the best place to publish something like this? For 3ds max there's scriptspot.com, is there something similiar for adobe scripts?
    Use at your own risk. Download here.

    looks useful for managing multipasses. Have a look at aescripts.com for publishing your script.

  • Script for extracting pages into separate documents?

    Hi,
    Using Acrobat 9 Pro on an XP machine, my job entails taking PDFs over 2000 pages long, sorting them into smaller documents based on their contents, and (once they are sorted) breaking down any documents longer than 25 pages into individual PDFs of 25 pages each. So, for instance, if I have a document of 110 pages, I end up with four 25-page documents and one 10-page document. Right now I do this by extracting pages 26-50 and deleting them from the original, then saving the extracted pages. Would it be possible to write a script that could accomplish the same end result? (I have CS4 Design Premium, so if anyone knows how to do this with another CS4 program, that would work also.)
    Thanks!

    Yes, it can done. If you want to do it yourself look in the JavaScript Reference file under the Document object, extractPages() method.

  • Script for moving multiple subtitle clips in the works - EXAMPLES NEEDED!

    Hi everyone!
    One severe deficiency of DVD Studio Pro is the inability to move multiple subtitle clips back or forward in a track by an arbitrary offset.
    I ran into this problem while I was creating a DVD from an EyeTV recording of a DVB broadcast, the subtitles from which have to be extracted to a SON file and a bunch of .bmp images with a separate piece of software, ProjectX. For some reason, ProjectX messed up the subtitle timecodes, so I had to move the entire track forward by a fixed amount. Unable to do this inside DSP, and unable to find tools that would do this for SON files, I set out to code my own tool with Python.
    Currently, I have a very simplistic working version of the script, which I successfully used to shift the timecodes of the aforementioned SON file.
    This got me thinking: I can't be the only one who has faced this problem. So, in the spirit of giving something back to the community, I thought I'd try my hand at turning this little script into a versatile tool for timescaling several different subtitle formats.
    If possible, I would like to receive real-life examples of several different plaintext (no binary formats, thanks) subtitle formats from you guys, both those that DSP supports and those that it doesn't.
    For now the tool only shifts entire tracks and works on the command line, but who knows, maybe I'll create a GUI at some point and add the ability to shift specific subtitle clips instead of whole tracks - time permitting, of course.
    If you think you might have some juicy subtitles laying around, please reply or contact me directly by e-mail: elamaton (at) nic.fi. Don't worry, I won't redistribute anything you send me, it will only be used as test data.
    iMac Core Duo 20"   Mac OS X (10.4.7)  

    Sounds like a very good idea... but have you seen Subtitler:
    http://www.versiontracker.com/dyn/moreinfo/macosx/26322
    Not to say you won't make a better version, and I'd be delighted if you did! Manipulating subs in DVDSP is not something I do any more - I use an external text editor for any job where more than a few subs are needed.
    The problem in DVDSP is that you cannot extract the subs directly, you have to export an track item description which has the subs and time code buried within the XML. You might find that PHP will give you a web based tool to extract the subs and time codes and write a text file, which you can then manipulate.
    In fact, wouldn't a web based tool be a good idea? People could upload the track description, it would export the subs and you could get it to adjust the timecodes and write a text file back in the correct format to import back in to DVDSP. Once the subs are in a text file it is a simple matter to manipulate them further...

  • Issue in FDM Import script for ading multiple amount columns.

    Hi,
    I am trying to import the Multiple amount columns to be addedd and imported as one amount column.Below is the script I am using for the same,script is getting verified in Script editor but When I am trying to Load the File I am gettig an error as below.
    ERROR
    Code............................................. 9
    Description...................................... Subscript out of range
    Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
    Component........................................ upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 8380
    Scirpt
    Function Import_YTD(strField, strRecord)
    'Set variables
    dim strCurmnth1
    dim strCurmnth2
    dim strCurmnth3
    dim strCurmnth4
    dim strCurmnth5
    dim strCurmnth6
    dim strCurmnth7
    dim strCurmnth8
    dim strCurmnth9
    dim strCurmnth10
    dim strCurmnth11
    dim strCurmnth12
    dim strCurAmount
    strCurmnth1 = Trim(DW.Utilities.fParseString(strRecord, 20, 9, ","))
    strCurmnth2 = Trim(DW.Utilities.fParseString(strRecord, 20, 10, ","))
    strCurmnth3 = Trim(DW.Utilities.fParseString(strRecord, 20, 11, ","))
    strCurmnth4 = Trim(DW.Utilities.fParseString(strRecord, 20, 12, ","))
    strCurmnth5 = Trim(DW.Utilities.fParseString(strRecord, 20, 13, ","))
    strCurmnth6 = Trim(DW.Utilities.fParseString(strRecord, 20, 14, ","))
    strCurmnth7 = Trim(DW.Utilities.fParseString(strRecord, 20, 15, ","))
    strCurmnth8 = Trim(DW.Utilities.fParseString(strRecord, 20, 16, ","))
    strCurmnth9 = Trim(DW.Utilities.fParseString(strRecord, 20, 17, ","))
    strCurmnth10 = Trim(DW.Utilities.fParseString(strRecord, 20, 18, ","))
    strCurmnth11 = Trim(DW.Utilities.fParseString(strRecord, 20, 19, ","))
    strCurmnth12 = Trim(DW.Utilities.fParseString(strRecord, 20, 20, ","))
    If strCurmnth1="" Then strCurmnth1="0" End If
    If strCurmnth2="" Then strCurmnth2="0" End If
    If strCurmnth3="" Then strCurmnth3="0" End If
    If strCurmnth4="" Then strCurmnth4="0" End If
    If strCurmnth5="" Then strCurmnth5="0" End If
    If strCurmnth6="" Then strCurmnth6="0" End If
    If strCurmnth7="" Then strCurmnth7="0" End If
    If strCurmnth8="" Then strCurmnth8="0" End If
    If strCurmnth9="" Then strCurmnth9="0" End If
    If strCurmnth10="" Then strCurmnth10="0" End If
    If strCurmnth11="" Then strCurmnth11="0" End If
    If strCurmnth12="" Then strCurmnth12="0" End If
    'Calculate the YTD Amount
    strCurAmount = CDbl(strCurmnth1) + CDbl(strCurmnth2) + CDbl(strCurmnth3) + CDbl(strCurmnth4) + CDbl(strCurmnth5) + CDbl(strCurmnth6) + CDbl(strCurmnth7) + CDbl(strCurmnth8) + CDbl(strCurmnth9) + CDbl(strCurmnth10) + CDbl(strCurmnth11) + CDbl(strCurmnth12)
    Import_YTD =strCurAmount
    End Function

    Hi,
    how many columns has your file?
    that error means you are trying to access an invalid position.
    Regards

  • Script for emailing multiple file types?

    Is there a script that will allow me to place a button on a form, that when clicked, will email the completed form in PDF format as well as in csv, or xml format?
    Thanks!

    Wow, thanks. That was extremely helpful, but I have a couple questions.
    First, is there a way to make it print to CUPS without opening the default application for the particular file first? For example, I used a .docx file, and it had to open microsoft word to send the job the print. This makers it very unpredictable to decide how much time the automator application will need to pause. If that file were for example, and adobe illustrator file, it would take an incredible amount of time just for illustrator to open. I don't really anticipate needing to do this a whole lot with anything other than text files and standard image types, but is that the only way for those other files to print? I figured that since OS 10.6 can do a quick look preview on just about any file type I use, that the OS would be able to do this without the application actually opening, but it seems not to be the case. Just wondering.
    The other issue is the only real problem, and it's one that I have had whenever I use automator to make PDFs. It always duplicates the job. So, I am getting a combined pdf, but it has the same file in there 2 or even 3 times.
    In automator, I used:
    get selected finder items
    then
    print finder items
    I have verified that it is printing everything multiple times because I see them going into the CUPS folder twice. Then, the final PDF sometimes even has the same doc or image in it 3 times. I have always had this problem with automator and PDFs, any idea how to solve that?
    Other than that duplication issue, this seems like it will work perfectly! Thanks for the reply here!

  • Script for switching master pages

    Would it be possible to write a script to do this: Replace one master page with another whenever a certain paragraph style appears? I'm looking for a quick way to replace my A Master (with running header and page number) with the None Master on pages where new chapters begin.
    Clark

    here you go (it also creates sections)
    var ProgressBar = function(/*str*/title){
         var w = new Window('palette', ' '+title, {x:0, y:0, width:340, height:60}),
              pb = w.add('progressbar', {x:20, y:12, width:300, height:12}, 0, 100),
              st = w.add('statictext', {x:10, y:36, width:320, height:20}, '');
         st.justify = 'center';
         w.center();
         this.reset = function(msg,maxValue)
              st.text = msg;
              pb.value = 0;
              pb.maxvalue = maxValue||0;
              pb.visible = !!maxValue;
              w.show();
         this.hit = function() {++pb.value;};
         this.hide = function() {w.hide();};
         this.close = function() {w.close();};
    function main(){
    var doc = app.documents.item(0);
    // Create a list of paragraph styles
    var list_of_paragraph_styles = [];
    var all_paragraph_styles = [];
    var list_of_masters_names=[];
    var list_of_masters=[];
    for (var i= 0; i<doc.masterSpreads.length;i++){
        list_of_masters_names.push(doc.masterSpreads[i].name);
        list_of_masters.push(doc.masterSpreads[i]);
    list_of_masters_names.push("undefined");
    doc.paragraphStyles.everyItem().name;
    for(var i = 0; i < doc.paragraphStyles.length; i++) {
               list_of_paragraph_styles.push(doc.paragraphStyles[i].name);
               all_paragraph_styles.push(doc.paragraphStyles[i]);
    for(var i = 0; i < doc.paragraphStyleGroups.length; i++) {
              for(b = 0; b < doc.paragraphStyleGroups[i].paragraphStyles.length; b++) {
                        list_of_paragraph_styles.push(doc.paragraphStyleGroups[i].name+"->"+doc.paragraphStyleGroups[i].paragraphStyles[b].name);
                        all_paragraph_styles.push(doc.paragraphStyleGroups[i].paragraphStyles[b]);
    // Make the dialog box for selecting the paragraph styles
    var the_dialog = app.dialogs.add({name:"Section start at paragraph style:"});
    with(the_dialog.dialogColumns.add()){
              with(dialogRows.add()){
                        staticTexts.add({staticLabel:"Find:"});
              with(borderPanels.add()){
                        var find_first_paragraph = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
    with(dialogRows.add()){
                        staticTexts.add({staticLabel:"Apply Master:"});
              with(borderPanels.add()){
                        var change_master = dropdowns.add({stringList:list_of_masters_names, selectedIndex:0});
                        staticTexts.add({staticLabel:"Select \"undefined\" not to change"});
    the_dialog.show();
    // Define paragraph styles
    var myParagraph = all_paragraph_styles[find_first_paragraph.selectedIndex];
    var myMaster=(list_of_masters_names[change_master.selectedIndex]!="undefined")?list_of_masters[change_master.selectedIndex]:null;
    app.findChangeGrepOptions.includeFootnotes = false;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    app.findGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.appliedParagraphStyle = myParagraph;
    var myFound=doc.findGrep();
    var i=myFound.length;
    var pBar = new ProgressBar("Sectioning");
         pBar.reset("Rabdare...", i);
    while (i--)
            pBar.hit();
            if (myFound[i].parentTextFrames[0].parent.constructor.name=="Character"){
                var myPage=myFound[i].parentTextFrames[0].parent.parentTextFrames[0].parentPage;}
            else{
         var myPage=myFound[i].parentTextFrames[0].parentPage;}
         var mySection;
         if (myPage.appliedSection.pageStart==myPage){mySection=myPage.appliedSection;}
         else{
         doc.sections.add(myPage,{pageNumberStart:1})};
        // mySection.pageStart=myPage;
         //mySection.pageNumberStart=1;
         if (myMaster) {myPage.appliedMaster=myMaster};
    alert("Acum e gata!!");
    app.doScript('main()',undefined,undefined,UndoModes.entireScript,'AutoSections');
    //main();

  • Script for printing changed pages only

    Does anyone know of a script that will allow the printing of only those pages that have had changes made to them since a previous save? I'm a typesetter doing work only on books and journals and sometimes it's a bit tedious to keep track of the individual pages one works on. thanks,

    Ok,
    Here is a raw code. All you need to do is edit the script to specify the printer preset you want to use. I don't have a printer my self to debug but I think it should work.
    Here is the idml to grab the object styles. Don't forget to apply on objects located onto the pasteboard. The script look for these objects and grab the page name next to them to finally print these pages.
    Hope it helps,
    Loic
    function main(){
              var doc,
              changedArray = [],
              changedStyle,
              unchangedStyle,
              i=0,
              max=0,
              found = [],
              pagerange = [];
              obj,
              vb,
              leftPage,
              leftPageBounds,
              rightPage,
              rightPageBounds,
              pagerange = "";
              if(!app.documents.length){ return; }
              var doc = app.activeDocument;
              changedStyle = doc.objectStyles.itemByName("changed");
              unchangedStyle = doc.objectStyles.itemByName("unchanged");
              if(!changedStyle.isValid ||  !changedStyle.isValid){
                        alert("Problem with object styles. Script requires both \"changed\" and \"unchanged\" styles.");
                        return;
              app.findObjectPreferences.appliedObjectStyles = changedStyle;
              found = doc.findObject();
              max = found.length;
              for(i=0; i<max; i++){
                        obj = found[i];
                        vb = obj.visibleBounds;
                        leftPage = obj.parent.pages[0];
                        leftPageBounds = leftPage.bounds;
                        rightPage = obj.parent.pages[-1];
                        rightPageBounds = rightPage.bounds;
                        if(vb[1]>rightPageBounds[1]){
                                  pagerange.push(rightPage.name);
                        else if(vb[1]<leftPageBounds[1]){
                                  pagerange.push(leftPage.name);
              app.printPreferences.activePrinterPreset = app.printerPresets.itemByName("my printer preset");
              var oldPrintPrefs = doc.printPreferences.pageRange;
              doc.printPreferences.pageRange = pagerange.join(",");
              alert("Gone printing");
              app.print();
              doc.printPreferences.pageRange = oldPrintPrefs;
    main();

  • Is there a script for scaling multiple precomps?

    Hi!
    Is there a script or another good way to scale tens of precomps in one go?
    I just noticed that I need to "grow bounds" to over 20 compositions in order to be able to use an effect on them. Do I need to manually go inside each precomp and change their comp settings for a bigger size or can this be done faster somehow?
    I tried the grow bounds effect, but could not get it to work. What I'm doing is simple: I'm blurring the layers to make them "glow" but for the blur to look nice the layers need to have bigger bounds.
    Any help will be appreciated!

    I used this After Effects Community Help search for 'script scale multiple compositions' and found this:
    http://www.aenhancers.com/viewtopic.php?t=701

  • I have an issue with a script that places multiple page PDF files...

    I'm using a version of "PlaceMultipagePDF.jsx" that I modified to use Media Box when placing the PDF file pages.
    That part was easy and works perfectly.
    The issue I'm having it that every time it places a PDF page, InDesign pops up a dialog saying that it's Importing pages from "file" and Creating preview with a progress bar. This dialog pops up once for each page, and the UI time it takes to do this is slowing down the import.
    So is there any way to turn off this feedback dialog?
    Note: I still need to see the dialogs to choose the PDF file and pick the document and page to start placing. I just want the one that displays for each page to not display...

    I found this in the Developer KB.
    But I can't find any of the functions in the Scripting Ref...
    How To: Suppress the progress bar when processing a command.
    Summary
    You can suppress progress bar display by turning it off before processing the command.
    Issue
    I use the IImportFileCmdData interface and pass kSuppressUI (do not display any UI) as UIFlags. When processing the command, I get a progress bar, which is called "Adobe InDesign Tagged Text Import Filter", whereas I expect no UI.
    Solution
    To suppress progress bars you should explicitly turn them off before you process the command (or commands).
    1. Get the interface IProgressBarManager (it's on kAppBoss, which you can get from gSession).
    2. Use IProgressBarManager::SuppressProgressBarDisplay() to turn off the progress bars.
    3 .Process the place command(s).
    4. Turn the progress bars back on when you're done.
    In InDesign 2.x and above, you can also use the SuppressProgressBarDisplay class (ProgressBar.h) class to achieve this. In order to use this class you just need to create an instance of the class on the stack as shown here:
    SuppressProgressBarDisplay suppress(kFalse);

  • Script for Linking multiple layers to a null layer

    I'm trying to link multiple layers to an animated null layer but I want each layer to start the animation from layer starting time.
    What would be the script I need to add instead duplicating null layer for every layers?
    I hope that question isn't too confusing to understand lol
    TIA
    W

    Sorry, I'm not good at explaining things though texts lol
    Hopefully this picture can explain better what I'm trying to achieve.
    I want to link the text layers to ROTATE null object but I want the keyframes to start at the beginning of each of text layer. This way, I won't need keyframes for each text layer and I can adjust the timing easier later. I know the script lines to link them to a null object but I can't figure out the line to tell the keyframes to start at the beginning of the layer instead the null object in the timeline.
    I think I just made this more confusing lol

  • I have a problem with a php script for loading dynamic pages using flash as menu bar, but the urls in the flash is not processed by the php script only in firefox

    '''php script:'''
    <?php
    $page = $_GET['page'];
    if ($page)
    include ("inc/".$page.".php");
    else
    include ("inc/home.php");
    ?>
    '''Action script 2.0 in flash:'''
    on(release){
    getURL("index.php?page=new");
    }

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.
    See http://forums.mozillazine.org/viewforum.php?f=25

Maybe you are looking for