Batch Scripting to Automate PDF Combination/Bookmark Creation

I have a number of PDFs where some represent emails and some represent attachments to those emails. Currently they are all saved as separate PDF files; what I would like to end up with is a single PDF per email, where each attachment has been inserted after the last email page and a bookmark has been created called the name of the attachment, which is dynamic and not related to the file name.
I have a list of which PDF attachments would need to be added to which PDF emails, including the name of what each bookmark would be. I have used this list to auto-create a javascript that I thought would do the trick. Here is a sample of what I created:
/* Combine Files */
//Open first PDF email and create a bookmark to mark the email
varMyDoc = app.openDoc("/Z/Projects/IMG_0001/S-00001.pdf")
varMyDoc.bookmarkRoot.createChild("057-063_Fw _59.msg", "varMyDoc.pageNum=0", 0)
varPage = varMyDoc.numPages
//Insert pages from the attachment PDF after the last page of the email and create a bookmark to mark the attachment
varMyDoc.insertPages ({nPage: this.numPages-1,cPath: "/Z/Projects/MG_0001/S-00002.pdf"})
varMyDoc.bookmarkRoot.createChild("20060329092508655.pdf", "varMyDoc.pageNum=" + varPage, varPage)
//Save the new combined PDF to a new location and close it
varMyDoc.saveAs("/Z/Projects/IMG_0001/S-00001.pdf");
varMyDoc.closeDoc(true);
My plan was to create a batch sequence to run this and copy/paste the entire script into the script window. However, I now realize that my script is really not a batch sequence. I can run the first execution (above) as a batch sequence if I have that one file open in Acrobat, but as soon as I try to add in opening the next file, the script stops.
I don't need to run the exact same commands for every file in a directory, which is what the batch sequence wants to do; I want to simply run the script and have it open, insert pages, make changes, and save the files according to the way the commands are laid out.
I also tried to save the script with a .js extension and put in the JavaScripts directory, but I get an error in the debugger saying that my variable bookmarkRoot has no properties... the script seems to run differently this way than it does through a batch sequence and my syntax or usage is no longer correct.
Is there a way to use Acrobat this way? I would try automating this from VBA or something, but it looks from the developer's guide like bookmarks can't be created using that method. I'm basically trying to automate Acrobat from an external script the way you can automate Excel or Word using vbscript; you just make object representing an instance of that application and then you can use methods and properties just like you would if you were scripting inside that application natively. Can an instance of Acrobat be pulled up from just running an external .js?

Can you be more specific?
Something like this;
http://forums.adobe.com/message/1097409

Similar Messages

  • Batch script to print PDF files to press quality

    Hello, I'm looking for a way to print PDF files to the Adobe PDF driver with "Press Quality" setting.   Ideally I could also save any file attachments first and then reattach them after printing to new files.
    I've been experimenting with the batch sequence feature but I am not getting very far.   Are there any sample scripts that do something similar to this?   I appreciate any guidance you can offer.
    Thanks
    LLL

    No, I do not have access to the original files that went into making the source PDFs.
    I've looked at PDF Optimizer but it does not shrink the file size nearly as much as printing the file through the Adobe PDF print driver with "Press Quality" setting.   I suspect this has to do with font consolidation.   PDF Optimizer seems to let you unembed fonts from the file but that's not what I'm looking for.  I need to have all fonts embedded.
    I appreciate the feedback.  Anyone else have ideas here on the original issue?  Thanks.

  • Looking for Scripts that Replaces Text and Master Pages (Batch Missing Files and PDFs)

    I have just found the Script Library panel in FM 10. (Always used InDesign before.)
    I'm up to replace a text string and two master pages in 100+ documents. Tried to google for some nice solutions to make this automatically but cannot find any scripts/macros to FM at all.
    Do you have som tip where to find such scripts/macros?
    To facilitate my work I also look for a batch script that automatically updates the image pathes in each framemaker file (image folder has been renamed).
    And at a last FrameMaker -> PDF Batch converter.

    100 is a small enough number that no time may be saved writing a script (assuming none exist for the purpose).
    I'd be tempted to ...
    Create a sourcing file that has the new MPs needed (and safe versions of MPs "Left" and "Right")
    Create a new Book file.
    Add to it all 100 of the files needing update (this is the only tedious part).
    Use Find/Replace from the Book menu to fix the text string.
    Select all book component files:
    File > Import > Formats
    Import from Document [MPsourcefilename.fm]
    [Deselect All]
    [*] Page Layouts
    [Import]

  • How do I turn off automatic bookmark creation when combining multiple PDFs into one?

    When I combine multiple PDFs into one, I need Adobe to use the CUSTOM bookmarks I created in the original PDFs. I do NOT want the additional PDF name as a bookmark in this instance. Is there a way to turn this option OFF in Acrobat Professional? I have version 9.

    You can not automatically turn off this action nor can you remove the 'file_name.pdf' heading, but you could add a button or menuitem to remove the 'file_name.pdf' from the bookamarks. Yes, it is one more step to perform when combining PDFs, but is you want until you have all of the PDFs combined you only need do it once.
    Removing filename bookmarks created by Acrobat by Sean Stewart
    From the above article:
    "With the release of Acrobat 6 came the ability to create a composite (binder) document from multiple files, (i.e. File > Create PDF > From Multiple Files.) When this is done, Acrobat automatically inserts a new top level bookmark at the start of each new file. The bookmark title will correspond to the source filename of the source file. While this level of separation can be helpful, it is counterproductive when the user wants the bookmark tree in the merged document to be continuous.
    "Here's a sample JavaScript to remove the top level bookmarks from the bookmark tree. This script will look for a ".pdf" extension to decide whether to remove the bookmark."
    With some additional coding you can add menu item or toolbar button.

  • Is it possible to automatically generate a bookmark when batch scanning to pdf?, Is it possible to automatically generate a bookmark when batch scanning to pdf?

    Hi,
    I'm scanning hardcopy documents in to electronic PDF format at work for archiving.
    I'm allowed to scan several hardcopy documents into one electronic PDF file, to save time (these files are no longer required but for legal reason we should keep backed up, so I don't have to be perfect).
    I thought perhaps there was a way to automatically generate a bookmark at certain points in the PDF?
    For example;
    - I have three documents to be scanned into one PDF file.
    - I use the 'document feeder' on my scanner to scan mutiple pages at a time (batch scanning)
    - Each scanned 'batch' is then appended to a PDF file, creating a single PDF document from multiple scanned batches.
    Is there a way to automatically generate a bookmark at the beginning of a batch scan?
    So that I could have three bookmarks in the PDF file for easy navigation to the beginning of each document?
    Keep in mind, sometimes I might need to do six batch scans to create the single PDF file (as the three documents need to be split in half because they are quite large). So I'd only need to select 'create a bookmark' on every second batch scan.
    However, creating a bookmark at every batch scan is better than nothing at all so if that's the only way to do it, then its still very helpful.
    Note:
    I don't require the bookmarks to be labeled (default labeling is fine).
    I don't want to manually create bookmarks in preview, acrobat. I want the bookmark to be generated automatically before/after I press 'scan'.
    I may be using the incorrect term ('bookmark'), perhaps its document 'sections' but hopefully my situation is still understandable.
    Any ideas/ help would be greatly appreciated.
    Kind Regards
    Sachi

    You could try to use a motion sensor - in a do-it-yourself store you can buy motion sensors that turn on the lights when a burglar approaches the property. Connect this sensor to the remote control of your camera instead of to a light.
    Probably you can buy ready-made motion sensitive remote controls, the photographers here will know. You would need this kind of remote control for wildlife photography.

  • Save as pdf deleted bookmarks when combining pdf-files

    Hello,
    when I save several books each to a pdf-file with save as pdf (or printing to .ps and converting afterwards), the bookmarks are deleted when I combine the pdf-files with Acrobat. Only one bookmark for the 1st. file exists in the new pdf-file.
    The reference of the bookmarks in the original generated file is e.g. "g3.619626".
    These references are not anymore available in the combined files.
    I've tried several settings before saving as pdf but nothing helped.
    Ther are no problems of combining ordinary pdf-files with bookmarks if they are generated by other programs then Framemaker.
    I need to combine files as well within a book, as "save to pdf" is not able, to generate one file with different pages sizes. I then need to generate a separate pdf-file of the pages with the for e.g. bigger page size and combine it afterwards.
    In that project I'm working there will over all something between 1000 and 1500 pages from maybe 10 books with hunderts of bookmarks plus additionally separete pfd files to combine. So it's not an option to treat every bookmark before combining the pdf-files.
    My system is FM11.02.384 / Acrobat Pro 11.0.3 / Windows 7 64 Bit

    Never having had a need to do it, and Adobe documentation for Acrobat being what it is, I can't tell if AcroPro is supposed to be able to merge bookmarks when merging PDFs. It would be an unsurprising feature, and you do say it works on PDFs generated by means other than FM.
    Here's a hack that might work, if the variable-page-size rendering turns out to be out of reach. You can batch* this.
    Open each component PDF and re-save it with some otherwise harmless optimization (or even none). This will probably cause AcroPro to re-write the internal structures of each PDF, which might then be amenable to merged bookmarks when you re-open them for merging.
    * We do a similar thing for a slightly different problem. We have a software-in-a-box XML publishing app that, at just some seats, is generating PDFs that are tagged for byte serving (fast web view), but are not in fact encoded for it. This causes AcroReader plugin and entire browser crashes for web end users. The s/w vendor can't even tell us where the option is for controlling that feature, because they get the PDF gen code from some other 3rd party. So we routinely batch process all generated PDFs, with, oddly enough, NO "commands" selected. The re-save alone fixes it.

  • Need  Bookmark creation script in indesign cs 6

    Dear All,
    we create bookmark creation script in CS 6, please any one help me.
    Thanks,
    Rajaraman

    Your workflow contains a very critical error: YOU SHOULD NEVER USE PREVIEW FOR VIEWING PDF FILES IN A PROFESSIONAL ENVIRONMENT!
    This is only one of many instances where Preview provides substandard preview of PDFs. In fact, if you're working with PDF forms, Apple Preview can actually corrupt the forms.
    You're seeing the results of these poor previews. You should be getting people to use the free Adobe Reader instead.
    It has been proven by international organizations like the widely admired VIGC that many PDF readers (Preview is an example) are incapable of displaying a print-ready file in the correct way.
    Here's a link to their PDF checker tool:
    http://www.vigc.org/vigc-pdf-viewer-check/

  • Need  Bookmark creation script for Paragraph style. Anybody can help me pl?

    Need  Bookmark creation script for Paragraph style. Anybody can help me pl?

    Hi hasvi,
    I wrote a similar script which creates a bookmark on each page in the "main" text frame at the begining of the frame (the 1st insertion point). Here I attached the script and a couple of sample documents: before and after. It's more complex than what you want but you can use it as a starting point. In fact, you have to find a certain paragraph style, loop through every found item and insert a bookmark, say, at the beginning of the found text.
    The dialog box
    Bookmarks added
    Regards,
    Kas

  • Automatic Selection for Combination Order Creation

    Hi
    We are working with MTO scenario where production orders are created against sales order. Production orders will be combined for common items from two sales orders. We have activated the SAP MILL Products DIMP, for this functionality.
    But in MILL_OC, we need to manually input the production order numbers, which we want to combine. Our client's requirement is that the system should select the production orders of common items and combine them automatically (Input will be only 2 Sale order numbers)
    As per below mentioned link, it is possible using a function module MILL_OC_ORDER_MERGE.
    http://help.sap.com/erp2005_ehp_05/helpdata/EN/d2/c79af5651811d385db0000e8200b4c/frameset.htm
    What we are not able to understand is the input required for this FM. Can anyone help?
    If not this, is there any other way, to achieve, automatic selection & combination of common item production orders?

    Hi
    We have resolved this problem by creating a BDC.
    Thread Closed.
    Edited by: OmKarP on Nov 19, 2011 7:49 AM

  • Need script to automate creation of AD sites,subnets and site links

    Hello,
    I have a requirement to create hundreds of sites and thousands of subnets in AD and also site links. I have an excel file with the details. 
    Can somebody help me with a vbscript/powershell script to automate this and create all the AD sites, subnets and site links
    Any help will be highly appreciated.
    BR,

    Hi AD-learner,
    As Santhosh said, you can get the scripts from the Script Center.
    I have made a quick search for you on the scripts for importing AD sites, subnets and site links.
    Checkout the below link on the powershell scripts to import, 
    AD Sites from a CSV file
    AD Subnets from a CSV file
    AD Site links from a CSV file
    Regards,
    Gopi
    www.jijitechnologies.com

  • Can you help add a split page operation to my batch script?

    Below is my batch script to create a bookmark on each page of a pdf.  It takes all the text from the current page and adds it to a variable then checks the variable for the string "SASID:"    It then takes the 10 digits following the "SASID:" string and creates a book mark with the 10 digits as the name.   I am looking to use the extract page method to extract each page to a new file.  Each new file should have the name of the string on that page.  So.  I think I need to add something like this.extractPages({nStart: i,cPath : filename + i + ".pdf"})   Either directly  before or after this line root.createChild(PageText,"this.pageNum=" + i, i); and the filename should be the variable that holds the 10 digit string.  I do beleive "newWord" contains the 10 digit number. Thank you!
    var root = this.bookmarkRoot;
    var RegularExpression  =  new RegExp(/\n|\r|\t|\s/);
    for (var i = 0; i < this.numPages; i++)
            numWords = this.getPageNumWords(i);
            var PageText = "";
    var FoundSASID = 0;
    for (var j = 0; j < numWords; j++) {
                var word = this.getPageNthWord(i,j,false);
    PageText += word;
    var strMatches = PageText.match('SASID:');
                 if (strMatches != null) {
    // Found text SASID: So reset the PageText to nothing and set the FOundSASID to 1
    FoundSASID = 1;
    PageText = "";
    var newWord = PageText.match(RegularExpression);
    var foundSpace = PageText.match(' ');
    if (newWord != null || foundSpace != null) {
    if (FoundSASID==1) {
    root.createChild(PageText,"this.pageNum=" + i, i);
    FoundSASID = 0;
    if (FoundSASID==0) {
    PageText = "";

    Guess no one wanted to help.
    I found a solution. I added this before the root.createChild line. 
    this.extractPages({nStart:i, cPath: PageText + ".pdf"});

  • LOG FILE for batch scripting in MAXL

    Hello,
    I just wanted to know how to create a LOG FILE for batch scripting.
    essmsh E:\Batch\Apps\TOG_DET\Scripts\unload_App.msh
    copy e:\batch\apps\tog_det\loadfile\gldetail.otl e:\hyperion\analyticservices\app\tog_det\gldetail /Y
    essmsh E:\Batch\Apps\TOG_DET\Scripts\Build_Hier_Data.msh
    REM
    ECHO OFF
    ECHO Loading GL actuals into WFS \ Combined......
    E:\HYPERION\common\Perl\5.8.3\bin\MSWin32-x86-multi-thread\PERL.EXE E:\Batch\Apps\WFS.COMBINED\AMLOAD\WFSUATAMLOAD.PLX
    E:\HYPERION\common\Perl\5.8.3\bin\MSWin32-x86-multi-thread\PERL.EXE E:\Batch\Apps\WFS.COMBINED\AMLOAD\WFSUATAMLOAD.PLX
    Drop object d:\NDM\Data\StampFiles\STAMPLOADBKUP.csv of type outline force;
    Alter object d:\NDM\Data\StampFiles\STAMPLOAD_cwoo.csv of type outline rename to d:\NDM\Data\StampFiles\STAMPLOADBKUP.CSV;
    SET LogFile=E:\Batch\Apps\TOG_DET\Logs.log
    This file does not generate log file can any help me what might be the problem? Even though some of the steps above are not correct it should generate me log file atleast. I need syntax or whatever it is to generate Log file.
    Regards
    Soma

    I wanted to have a logfile of the following batch script regardless of whether the script is running or not.
    essmsh E:\Batch\Apps\TOG_DET\Scripts\unload_App.msh
    copy e:\batch\apps\tog_det\loadfile\gldetail.otl e:\hyperion\analyticservices\app\tog_det\gldetail /Y
    essmsh E:\Batch\Apps\TOG_DET\Scripts\Build_Hier_Data.msh
    REM
    ECHO OFF
    ECHO Loading GL actuals into WFS \ Combined......
    E:\HYPERION\common\Perl\5.8.3\bin\MSWin32-x86-multi-thread\PERL.EXE E:\Batch\Apps\WFS.COMBINED\AMLOAD\WFSUATAMLOAD.PLX
    Drop object d:\NDM\Data\StampFiles\STAMPLOADBKUP.csv of type outline force;
    Alter object d:\NDM\Data\StampFiles\STAMPLOAD_cwoo.csv of type outline rename to d:\NDM\Data\StampFiles\STAMPLOADBKUP.CSV;
    What I really want is I need a log file of the above batch script, how the above scripts are running. I do not care whether they are giving me positive results but I need to know what is happening in logfile. HOw will the log file be generated.
    Regards
    SOma

  • InDesign Export to PDF and PDF Destinations/Bookmarks

    Hello all,
    I am new to this forum and am not sure where the most appropriate location for this question is. But, here goes:
    We are adding Bookmarks to an InDesign Doc then exporting it to a PDF. In the Acrobat Reader and the IE Acrobat reader the bookmarks work just fine. Here his where the problem is. I have to link to the PDF's bookmarks from a web page. I have come to find out that I can't link directly to a bookmark but I have to link to a "Destination."
    The PDF Exporter or InDesign adds a Destination name that is not the same as the bookmark name. It includes the indd file name and the part of the sentience that the book mark is next to.
    I have used Adobe Acrobat Professional to create a custom Destination that is one word without spaces. I am able to link to that destination but I can't link to any of the destinations that either InDesign or the PDF exporter created.
    Does anyone know how to force the Destinations names to be set to the name of the bookmark that is being mapped to it? Or, how to link to a bookmark name rather then a Destination.
    I have also did some searching for some VB to Acrobat scripting and found that I can't edit Destination names.
    This is for an on going project that is sure to have a lot of updates. We do not want to have to goto Acrobat and fix the Destinations by hand for every update. Plus, we don't want to link to the page number because we are never sure when pages will change and again do not want to always fix the PDF or HTML index page every time.
    Thank you for your time,
    Michael Hamilton
    Learning Designs Inc

    Michael, I've got one solution that meets my needs but maybe only part of your needs:
    Buy AutoBookmark from Evermap:  http://www.evermap.com/autobookmark.asp#Creating%20Destinations%20From%20Bookmarks
    It's a plugin to Adobe Acrobat (not Reader), but it works only in MS Windows, not Mac.
    After you've installed that plugin, Acrobat's Plug Ins menu has a Destinations menu item with some choices you're going to use.
    Open with Acrobat, the PDF file that has the destination names that have that bothersome <filename>.indd prefix.  Use the Plug Ins > Destinations menu's item to export the destinations as a plain text file.
    Edit the resulting plain text file with any plain text editor.  Globally search and replace the filename prefix with nothing.  Save and close that file.
    Back in the Acrobat window of your PDF file, use the Destinations menu's choice to delete all destinations.
    Now use the Destinations menu to import the destinations file you just edited.
    Voila.
    BUT the part of your problem that this won't solve, is the presence of a portion of the sentence in the destination.  That's not a problem for me, because I'm creating all my destinations as parts of the sentence.

  • Batch Script to display last modified file from multiple directories

    Hello,
    I am trying to find the name of the latest file  or the last modified file from a set of given directories.
    I approached the problem by breaking it into two parts: a.  read all the directories from a .txt file and display the names of those directories and files under those directories.  b. Find the latest file present in any given directory and
    Upto this point all worked well, but when I am trying to combine both these batch scripts, I am unable to get the desired result.
    I am using BATCH SCRIPT only to complete this.
    My tried script is as below:
    a.  TO SEE ALL THE DIRECTORIES SPECIFIED IN "path_123.txt" FILE
    for /f "delims=" %%i in ('type "C:\Users\sonkar\Desktop\path_123.txt" ') do (set locall=%%i
    echo %locall%
    echo %%i
    b.  TO FIND THE LATEST FILE PRESENT IN THE DIRECTORY
    set BUILDDROP="E:\"
    for /f "tokens=*" %%a in ('dir /A:-D /B /O:-D %BUILDDROP%') do set NEWEST=%%a&& goto :next
    :next
    echo %NEWEST%
    But when combining both is not working at all.
    Any help is appreciated.

    Since batch files lack the ability to do date arithmetic you are pushing them well beyond their limits. Either VBScript of PowerShell could handle this type of task. Here is a VBScript solution. You must save the code in a .vbs file, then modify it to suit
    your exact needs.
    'Find the most recent file in a collection of folders
    '11 Sep 2014 FNL
    Dim dDate, dDate_, sFile, sFile_
    Set oFSO = CreateObject("Scripting.Filesystemobject")
    Set oList = ofso.OpenTextFile("C:\Users\sonkar\Desktop\path_123.txt", 1)
    aList = Split(olist.ReadAll, vbCrLf)
    oList.close
    dDate = cdate("01/01/2000")
    For Each sFolder In aList
        dDate_ = cdate("01/01/2000")
        ProcessFolder(sFolder)
        If dDate_ > dDate Then
            dDate = dDate_
            sFile = sFile_
        End If
    Next
    WScript.Echo "Most recent file: """ & sFile & """"
    WScript.Echo "File date: " &dDate
    Sub ProcessFolder(sFldr)
        If LTrim(sFldr) = "" Then Exit Sub
        WScript.Echo "Processing """ & sFldr & """"
        For Each oFile In oFSO.GetFolder(sFldr).Files
            If oFile.DateLastModified > dDate_ Then
                dDate_ = oFile.DateLastModified
                sFile_ = oFile.Path
            End if
        Next
        For Each oFolder In oFSO.GetFolder(sFldr).SubFolders
            ProcessFolder(oFolder.path)
        Next
    End sub

  • OS Command batch script issue (FTP)

    All,
    I am running into a problem (i think it's simple) which I just can't seem to figure out. I have a FTP command which is in a batch script and I can run it manually (Its run in an old enviroment with Informatica) and the ftp script works just fine. When I use the OS Command to launch the bat file, it accesses the bat file but in the ftp log all I see it doing is copying the local directory into the first line of the log and then just copying the rest of the ftp script. It does nothing else!!
    Does anyone have any ideas? I have copied the script and forced it into one bat file, tried running it from a local directory, running it from the server, combining everything into a single source for lcd and script, I am running out of ideas!!
    - Another point is that I have to use this process as I am moving files from a server to a mainframe environment and need the ascii translate function in FTP.
    Thanks,
    Abhi

    Update:
    After some searching (and soul searching;) ) I was able to find a way to call the FTP file through an shell batch. So for instance I have a shell script that calls the FTP script. This seems to work but now the log does not create correctly (the ftp script is creating the log) it seems to copy the script from the ftp file and paste it in the log file.

Maybe you are looking for

  • How do I add os x tiger to a partition on intel mac using os x lion?

    I'm trying to add os x tiger to a partition so I can dual boot between tiger and lion.  However, I'm not able to boot the computer using the tiger dvd by holding the c  button during start up.  Anyone know how to do this?

  • Which component do I need ?

    Which component do I need ? I want to connect my iPhone/iPad/iMac over wifi to a Bose dock system. Do I need a airport extreme or apple tv

  • Turning on/off airport with keyboard shortcuts

    i read about a method, in a book, to toggle airport on and off by inventing a shortcut for it. i think it was something like system preferences>keyboard and mouse>keyboard shortcuts>+. the book said type the command exactly as it appears in the menu

  • HT201401 My volume down button has stopped working. Help

    Need some help troubleshooting

  • Database reset alert

    I have been getting an annoying popup from iSync titled "Database Reset Alert", saying that "Inconsistencies in your sync information for Contacts and Calendars were detected and have been repaired". "The next sync for entourage 2008, address book, e