Organize PDFs in a PDF repository based on the PDF producer or author information

Managing files in a storage pool can be a big task without a document management system, especially if you have a large number of files coming through from different sources and users. For PDFs, you can accomplish some of your document management needs by creating actions in Acrobat. In this post, we will show you can create an action in Acrobat to organize PDF files based on the information available in PDF Producer or Author document properties.

So if you were opening each PDF in Adobe Acrobat or Acrobat Reader, selecting File > Properties to view the contents of PDF Producer or Author document properties (or pressing Ctrl + D), and then manually organizing your PDF files, read on. We will simply create an action with a JavaScript command to check the PDF Producer or Author information for a set of PDF files and copy PDFs to folders for the different PDF producers. For example, if the PDFs are produced in Microsoft Word, Microsoft PowerPoint, and OpenOffice Draw, the Acrobat action will copy the PDFs to three different folders, each storing the PDFs produced from the same app.

Write a script

In JavaScript, write the commands to read the this.creator or this.producer, property of the active PDF and copy the PDF to a specified folder.

if(this.creator.match("Word") || this.producer.match("Word"))
{
    this.saveAs
    ({
        cPath: "/C/Word/" + this.documentFileName,
        bCopy: true,
        bPromptToOverwrite: true
    });
}
else if(this.creator.match("PowerPoint") || this.producer.match("PowerPoint"))
{
    this.saveAs
    ({
        cPath: "/C/PowerPoint/" + this.documentFileName,
        bCopy: true,
        bPromptToOverwrite: true
    });
}
else if(this.creator.match("OpenOffice") || this.producer.match("OpenOffice"))
{
    this.saveAs
    ({
        cPath: "/C/OpenOffice/" + this.documentFileName,
        bCopy: true,
        bPromptToOverwrite: true
    });
}

Create an Acrobat action

To create an action in Adobe Acrobat with the script, follow the steps below:

  1. Launch Adobe Acrobat.
  2. Go to Tools and click on Action Wizard under Customize section.

Alternatively, you can type action in the search tools box.

  1. Click New Action.

  1. Go to More Tools and click Execute JavaScript.

  1. Click Specify Settings.
  2. In the JavaScript Editor window, copy and paste the above sample script.
  3. Click OK.
  4. Deselect the Prompt User checkbox.
  5. Click Save.

  1. Enter a name and description for the Action and click Save.

Now the new action is listed in the Actions List.

Run the action

To run the action:

  1. Select the action you created.
  2. Choose the input folder or files.
  3. In the C:\ directory, create the following folders:
    • Word
    • PowerPoint
    • OpenOffice
  4. Click Start.

Notice that all the PDF files that were produced in Microsoft Word, Microsoft PowerPoint, or OpenOffice Draw applications have been copied to the Word, PowerPoint, and OpenOffice folders, respectively.