Batch sequence to remove document JavaScript

Does anyone know of a batch sequence that can remove the document JavaScript from a group of Acrobat 9 Pro PDFs?

If the doc-level Javascript names are not known in advance, then the only way I found to remove all of the Javascripts is with doc.extractPages(), which will create a new doc object, and then newDoc.saveAs() followed by newDoc.closeDoc().
I don't do this in a batch sequence but in a .Net app, so I'm not entirely sure how you would write this in a batch sequence.  Here's a code snippet that shows the basic logic:
                object AcroJS = AcroPDDoc.GetJSObject();
                string PdfFullPath = "C:\\filename.pdf";
                Type T = AcroJS.GetType();
                object newDoc = T.InvokeMember("extractPages", InvokeMethodFlags, null, AcroJS, null);
                AcroJS = null;
                AcroPDDoc.Close();
                object[] saveAsDataParam = { PdfFullPath };
                T.InvokeMember("saveAs", InvokeMethodFlags, null, newDoc, saveAsDataParam);
                T.InvokeMember("closeDoc", InvokeMethodFlags, null, newDoc, null);
                newDoc = null;
                AcroPDDoc.Open(PdfFullPath);
                AcroJS = AcroPDDoc.GetJSObject();
This can also be used to create a new doc GUID.
Bill

Similar Messages

  • Batch Sequence with JavaScript

    Hi Guys,
    I have a batch sequence that won't save the original files. I'm getting a message "The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder."
    However, another batch sequence that runs on the same file saves it fine so I know that noone else has it open and that and I know I have rights to that folder.
    The sequence that won't save the file sets the open optons and has JavaScript in it that collapses the many bookmarks.
    Is there something about having JavaScript in the batch sequence that's not allowing this to save?
    Many thanks,
    Ken

    You rock!! That made it all go.
    I was mistaken befeore thought, its the JavaScript Editor that's coming up on the screen when I run the sequence. I have to close it with the OK button before the sequence finishes. It comes up for each file I process. Trouble is I can't imagine what I've changed that would cause that to start happening.
    The code looks like this:
    //Collapses all bookmarks and shows the bookmarks panel
    function BookmarksCollapse(bkm, nLevel)
    var s = "";
    for (var i = 0; i < nLevel; i++);
    bkm.open=0;
    if (bkm.children != null)
        for (var i = 0; i < bkm.children.length; i++)
            BookmarksCollapse(bkm.children[i], nLevel + 1);
    BookmarksCollapse(this.bookmarkRoot, 0);
    //app.execMenuItem("ShowHideNavigationPane");
    //app.execMenuItem("ShowHideBookmarks");
    this.saveAs(this.path);

  • Javascript in batch sequence

    I've done some Acrobat scripting but mostly through VB and I'm able to write what I need but I want to have it as part of my operator's Acrobat instead of the of separate program. That said, I want to write a Java script that I can include in batch sequence.
    I need to add a page to the start of a document and I want to have that page be nubered "a" without disturbing the numbering else where in the file. By simply adding the page at the start with the batch sequence it adopts the numbering of the first page. So if the first page is numbered as "i" then the new inserted page gets numbered "i" and the rest of the numbering changes, what was i becomes ii, what was ii becomes iii, and so on. I'm able to script this in VB by adding the page at the end, renumber them using the SetPageLabels from a Javascript object, then moving the page to the beginning.
    Is there any documentation on using Javascript within a batch sequence?
    Thanks,
    Ken

    Well, hacking along here working in the console pasting my code in.
    The script adds a single page from another Acrobat file to the start of the open PDF. I need the page that goes in at the front to be numbered "a" and NOT effect numbering in the rest of the pages. Some files work fine, other files not so much, like the Javascript API reference PDF as well as other PDFs we've created here form InDesign.
    The script inserts a page at the end of the PDF and numbers that page "a" then moves it to the start of the document. The problem occurs when the page is moved to the start, it changes the number of all the other pages to follow page "a" which is a bit of a silly thing to have to send my clients. I decided to compromise and if the first page (before I insert the anything) was numeric I would simply try changing things to start page 1 after my inserted page "a".
    My code looks like this:
    var NumPages = this.numPages
    var PgLabel = this.getPageLabel(0)
    this.insertPages(NumPages-1, "/F/TNTSTUFF/Disclaimers/HUP_ProofNotice.pdf")
    this.setPageLabels(NumPages,["a", "", 1]);
    this.movePage(NumPages, -1)
    if (PgLabel.match("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) {  
            this.setPageLabels(1, ["1", "", 1]);  
    However, the setPageLabels command is causing this error:
    RaiseError: The base pages object is missing or invalid.
    Doc.setPageLabels:7:Console undefined:Exec
    ===> The base pages object is missing or invalid.
    I'm not sure it is relavent, but on the files that work the numbering in Acrobat looks like this with the parentheical numbers:
    Files that DON'T work look like this, with NO parenthetical:
    Even if I manually renumber the pages starting with 2 to make the numbering in the 2nd file look more like the numbering in the first file, I still get the error.
    Is there a way I can overcome this with Java code and what the heck is it?
    Thanks again to anyone who can help.
    Best,
    Ken

  • Javascript in batch sequence stopped working

    The following javascript used in a batch sequence is causing Acrobat to stop working. It was working fine, this problem has happened sometime in the last 2 weeks. This has affected all of our PCs regardless of Acrobat update version. We are running Acrobat 8 (8.15, 8.17, 8.21, 8.25). The only update common to all PCs is Windows Update.
    /* Extract single pages to c:/Adobe */
    // Regular expression used to acquire the base name of file
    var re = /\.pdf$/i;
    // filename is the base name of the file Acrobat is working on
    var filename = this.documentFileName.replace(re,"");
    try {for (var i = 0; i < this.numPages; i++)
    this.extractPages({
    nStart: i,
    cPath: "C:\\Adobe\\"+filename+"_" + i +".pdf"
    } catch (e) { console.println("Aborted: " + e) }
    Any Clues?

    Thanks for the speedy response. I tried this and the problem is still there.
    I did some further testing and the original script, and the new one modified to include your correction, both work if the PDF only has one page.
    With more than one page Acrobat 'has stopped working'

  • Batch Processing, Security Removal

    I am attempting to OCR large batches of documents with Adobe Acrobat 9. Some of the documents have security settings which make them un-editable. Is there any way to use a batch process to remove these settings?
    Thanks!

    To change "password security" to "none" in a sequence you need to set the appropriate preferences first to do that.
    In 'Edit -  Preferences ...' chose Batch processing and set Security Method to Password Security.
    After that there will be a password request every time before you run a sequence, but now it's possible to run sequences with protected files.
    Norbert

  • Batch Sequence Problem

    I am using Acrobat 9.4. I have a JavaScript that runs a batch sequence to create pop-up tool tips for certain words and phrases. The sequence works properly on most PDF files. I have a problem that on one basic PDF file the batch sequence properly creates the pop-ups but in the process converts the file to a PDF Form. The JavaScript author believes the problem must be that Acrobat adds Form Fields to the basic PDF file during the sequence operation and then thinks the file is a PDF Form. Is there any way to stop this from happening?

    Technically, a document with just a single button is a form. If you mean that the Forms document message bar appears, then that's a known problem. There is a user preference that controls whether the message bar is shown, but it's up to the user to set it.
    Without seeing the code, it seems apparent that it does add some type of form fields to the document to implement the tooltips and that is indeed the reason you're seeing the mesage bar.

  • Batch Sequence Page Scaling

    I have a few hundred PDFs that I need to change the page scaling on, hopefully using a batch sequence or another automated method. I know I can change a single PDF in Acrobat by going to the Advanced tab on the Document Properties and setting the Page Scaling to Default, but I do not want to change hundreds of PDFs manually. I have also tried creating a PDF package and changing the document properties, but it only affects a single PDF in the package.
    I am really looking for a JavaScript code to use in a batch sequence that will change the page scaling to either "fit to printable area" or "shrink to printable area" and save the document with that setting so I can distribute them to others with the page scaling already set and ready from them to print.

    I have been able to use code in Acrobat 6 Standard (Advanced - JavaScript - Document Actions - Document Will Print) to change the page scaling on documents, but it only saves the action in Acrobat 6 and does not save the print setting when the PDF is opened in Reader or Acrobat 8. I tried copying the full acro_script from Acrobat 6 to 8 using a batch sequence in 8, but it does not work.
    Code used in Acrobat 6:
    var pp = this.getPrintParams;
    pp.Handling = pp.constants.handling.shrink;
    Is there a way to convert this code to work in 8? And is there somewhere else in Acrobat 8 (I have Pro) to enter JavaScript besides in a batch sequence?

  • Possible to do make Batch Sequence Searchable by date?

    I want to know if it is possible to edit/create new script to Edit Batch Sequence - Searchable, recognize text Using OCR, but to only do it for a date range? How would I go about doing this.
    Right now it takes multiple screens and clicks to make documents searchable, I would like to create a script that tells you the last time you did a batch searchable request, allows you to select a date range, folder would ideally be built in - so I do not have to select it everytime and then on selection of date range, it runs and completes the request. Is this possible? Where do I start?
    Thanks,
    haleygurl86

    Date of what? Do you mean the file's creation date?
    If so, that's not possible. You can access the file's creation date in a script, but a script can't OCR a file.
    The best way would be to create an input folder and paste into it the files you want to OCR.

  • Acrobat 9.4.4 crashes when running batch process to remove metadata

    I am attempting to run a batch process to remove metadata from all documents within a folder. Only one or two documents will process before Acrobat crashes. Any suggestions?
    Thank you.

    There may be a corrupted video or image file on your iPad.
    Try to download from the iPad using Image Capture instead and save the photos to a folder. If that succeeds, you can check the files for corruption before importing them to iPhoto.

  • Running a batch sequence in Acrobat 11

    Hi All:
       I am running a batch sequence in Acrobat 11 on the Mac and as quickly and conciesly as I can, I want to outline the steps in the process:
    1.)  Select the batch sequence to be run.
    2.)  Select the files upon whic to run the batch sequence.
    3.)  Click Start.
    4.)  The text of the script appears on the screen, highlighted.
    5.)  Click OK to close the script editor and run the script on the first file.
    6.) The text of the script appears on the screen, highlighted.
    7.)  Click OK to close the script editor and run the script on the first file.
    8.) The text of the script appears on the screen, highlighted.
    9.)  Click OK to close the script editor and run the script on the first file.
    <continue the last two steps for each document you process>
    If the user has selected thirty documents to process in this sequence run, then she must see the script apear thirty times, and must press the OK button thirty times to actually run the script on the next Acrobat document.  Ditto for sixty and ninety documents.This is cumbersome and tedious not to mentionn dangerous to the script.  Im ny preactice run I accidently tapped teh spacebar and completely wiped the script!.  Is there any way to tell the program to skip displaying the script at the start of each cycle and just move on to the next job?

    Click the commands you added to the Action and make sure that none of them has the "Prompt User" check-box underneath it ticked.

  • Using Batch sequences in Acro Xi Mac

    Hello Everyone:
       I have a couple of scripts heavily in use that required they be built as part of a batch sequence, as they deal with multiple PDFs.. 
       These scripts are fairly large (one about 1000 lines, one in excess of 3000 lines) with the potential to get even larger. 
       Additionally, several requests for scripts are rolling down the line that look to be of similar or greater size. 
       The Adobe Acrobat editor is just not a good fit for building such large scripts.  I have switched the editor to UltraEdit, which is a much more capable editor.
       However, the problem comes when a new version is finished and I need to install it in other computers.  It seems that the only way to do this is to copy the script into a text file, take that text file to the next computer in line, open it up in a text editor, copy the script to the pasteboard, open up the batch sequence, open up the execute Javascript command, open up the script and copy the new code on top of the old code.  If this needs to be done on multiple machines, it becomes, ahem, tedious.
       Is there any way to save the script to a XXX.js file and just copy the new js file over the old XXX.js file?  I've looked at addscript but was not reassured by its examples in the Batch Sequence PDF that it could do the job I need it to do..

    Gilad:
       Thank you.  Though I would have preferred something a bit simpler, the import/export method you suggest is indeed simpler than the process I was using.  It still has its warts and wrinkles, but with practice I am sure I can find ways to minimize those minor irritants.
    R,
    John

  • Using "automating batch sequence" query

    Hi,
    I am trying to add text content to an area of the page in a group of pdf files without having to open each file. I am not replacing existing text. After checking,  I could not find a batch sequence to do this in Acrobat v7.1. Could this feature be available in Acrobat v9.?  and/or would I have to use the (acrobat v7.SDK) to create a script and plug in to do this? or if not, in Acrobat v.9, use the SDK to create the script and plugin?  I would appreciate any information.
    thanks,
    je112

    It's not possible to just add running text to a PDF using a batch process or a script. What you can do is insert a field with text and then flatten it.
    This will have a result similar to adding text to the document, but it will not be an integral part of the running text (ie the text you add will not "push" the rest of the text forward).

  • Batch sequence memory leak?

    I wrote a JavaScript batch sequence and ran it in Acrobat 9 Pro on a folder of PDFs. Acrobats memory use steadily increased until it hit 1.1 GB. Then an Acrobat dialog said no files were processed, the memory use dropped back to normal and the CPU usage dropped to zero. So it looks like the problem includes a memory leak. As a test, I replaced my batch sequence with a simple, one-line test:
    var r = test;
    It has the same behavior. Any ideas?

    thanks for your reply.
    i have gone through those APIs you have mentioned and understood that we can run any custom command or existing global command using those APIs.
    my requirement is to launch the sequence file created. is there any way to directly launch the sequence file or else do i need to process the sequence file to know the command and parameters?
    if i need to process the sequence file, it will be always "Recognize text using OCR" and parameters may differ. for this, what is the command i need to execute?
    i am new to this environment, please dont mistake me.
    thanks in advance.
    regards

  • Can a batch sequence add a simple button?

    Can anyone tell me if a batch sequence can be used to add a "close document" button to a group of Acrobat documents? I have 75 PDF documents that all need a button added. If I can do it using a sequence it will be a huge time saver.
    Thanks.

    Sure.
    The following includes some smaple code for something similar: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.435.html
    You just need to edit it so you only add one button, so get rid of the loop, and set the setAction code would be:
    f.setAction("MouseUp", "closeDoc()");

  • [svn] 3347: -remove the javascript directory since it is getting cleaned and recreated during the build process .

    Revision: 3347
    Author: [email protected]
    Date: 2008-09-25 06:27:28 -0700 (Thu, 25 Sep 2008)
    Log Message:
    -remove the javascript directory since it is getting cleaned and recreated during the build process.
    -this should make SVN happy and get the builds working again
    Removed Paths:
    flex/sdk/trunk/frameworks/javascript/FABridge/samples/srcview/source/fabridge/javascript/

    - Where? That depends upon what you what. But, going by the letter of what you asked, you shouldn't deploy any applications or packages if you want them on your newly images systems, you should make them a part of the TS using Install Software and Install
    Application tasks.
    - How many times? You should only need one although depending upon what you are deploying and if you are using offline updates, some folks add more. I typically use two one right after the Setup Windows and ConfigMgr task (just like the task sequence wizard
    builds for you) to update the OS and "things" in the image and one at the end to catch additional updates for apps and components added during the TS. Note that you also have to initiate an update scan cycle for additional install update tasks to work. Do
    this by adding a run-command line task before the second Install Updates task with the proper WMIC incantation.
    - Offline Updates only injects CBS updates into the image which are typically just core OS updates. You should also update your image though to include non-CBS updates. Using a build and catpure task sequence makes this easy.
    Jason | http://blog.configmgrftw.com

Maybe you are looking for

  • Docoment size query?

    How large a .PDF file can be converted to MS word .doc?

  • Emailing Generated PDF Document as Attachment - Error

    Hi Forum, A custom Print Form was developed using SFP Transaction and trying to send the Form to the vendors using an email attachment. 1. Used cl_bcs class for sending email. Attachment data(Generated PDF Output) was moved to solix_tab . 2. In the e

  • Dreamweaver CC fluid grid site, how do I give user the option to view desktop version on mobile?

    Hi all,  I've just built my first fluid grid site with Dreamweaver CC, just wondering what is the easiest way to give an option to the user to view the desktop version on a mobile device (so they can zoom-in and pinch around and get to see what would

  • Won´t boot

    Hi I bought some new parts this week (K8T Neo-FIS2R, AMD64 3200+), but I´m having some problems with it. When I try to boot, the power and fans works, but the screen won´t come on, the CD is "locked", and I can´t do anything... From what I have have

  • Flash video with too wide a frame when uploaded

    Hello, I have a short flash movie (.swf) having a width of 320px and a height of 240px. It works as expected locally (when I open the page with dreamweaver and FF2 or IE7) but as soon as I have uploaded the file to my website the movie gets a much sm