Consulting

Results 1 to 2 of 2

Thread: VBA scripting for PDF

  1. #1

    VBA scripting for PDF

    Hi,


    // Iterates over all pages and find a given string and extracts all // pages on which that string is found to a new file.
    
    var pageArray = [];
    
    var stringToSearchFor = "Total";
    
    for (var p = 0; p < this.numPages; p++) {
        // iterate over all 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 into a new document
        var d = app.newDoc();    // this will add a blank page - we need to remove that once we are done
        for (var n = 0; n < pageArray.length; n++) {
            d.insertPages( {
                nPage: d.numPages-1,
                cPath: this.path,
                nStart: pageArray[n],
                nEnd: pageArray[n],
            } );
        }
    
        // remove the first page
        d.deletePages(0);
         }

    I have the adobe pro version, but i want to use this code thru VBS and not from adobe. How to modify this to give a path to a file and run?

  2. #2
    HTML Code:
    https://forums.adobe.com/external-link.jspa?url=http%3A%2F%2Fkhkonsulting.com%2F2014%2F04%2Fextract-pdf-pages-based-content%2F
    Original code posted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •