• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 582
  • Last Modified:

Adobe Acrobat sequ file, loop folder using variable

Hi there,

We are trying to achieve the following using Adobe Acrobat sequ file:
- loop a folder with a few thousand PDFs
- for each file check the file name for the language (e.g. the English file names always end in _en.pdf, the Spanish file names always end in _es.pdf)
- combine 2 files, one of the 7000 above with an language ending and then a standard disclaimer, 6 diclaimer files are available, one for each language. These files have a fixed path.

How can you achieve this using 6 or even better 1 sequ file?

Any help appreciated.
0
riffrack
Asked:
riffrack
1 Solution
 
RobOwner (Aidellio)Commented:
Do you have anything to go on?  Have you read the manual? http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/batch_sequences.pdf

I can help you work through this but it would be good to go with some code if you've got it.
0
 
Karl Heinz KremerCommented:
Unfortunately the reply provided by tagit was not very helpful. Here is some code that you can use as the basis for your experimentation.

To do this, bring up the Action Wizard, and move the "Execute JavaScript" processing step in the "More Tools" category to your action:

Screen shot
Then, use this code:

// this is the base file name of the language specific files that we are adding to the 
// documents that are getting processed
var baseName = "/c/temp/DetectLanguage/info";   // we will add e.g. _en.pdf to this string

// get the filename of the current document
var thePath = this.path;

// the path looks like this: /c/directory/name_en.pdf - to get the language, we are looking for 
// _en.pdf, _de.pdf and so on at the end of the string

var re = /_(\w\w).pdf/;

var match = re.exec(thePath);

if (match != null) {
    var insertFile = baseName + "_" + match[1] + ".pdf";
    this.insertPages( { nPage:this.numPages-1, cPath:insertFile });
}

Open in new window


You will have to modify the way the language is stored (I assume a two letter language code at the end of the filename, just before the extension), and where our disclaimer files are stored and what they are named.

As usual, the Acrobat JavaScript reference document is your friend, if you run into problems, try to find the function that is causing the problems in the reference and make sure that you are passing the right information to the function.

Hope this helps.
0
 
riffrackAuthor Commented:
Thanks for the help, works perfectly.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now