Skip to main content
Participating Frequently
September 4, 2024
Question

Acrobat Pro Javascript to Import Data File from Comments section

  • September 4, 2024
  • 1 reply
  • 652 views

Hi All, 
Am looking for a JavaScript script to import comments from a different PDF document using the "Import Data File" option in Adobe Acrobat Pro. The script I have works to open the dialog box, but it does not allow for the selection of PDF files or import comments from a different file. This isn't the whole process. Prior to this, there is a resizing of the documents is step 1, which I have worked on and it is working fine.

Kindly help me out to open the dialog box from comments section "Import Data File..."

var cPathToFile = "/path/to/your/comments.fdf";
// Replace with the actual path to your FDF/XFDF file

this.importAnFDF(cPathToFile);

 

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
September 17, 2024

First, you don't need a script for any of this.

Next, you'll notice that when you select the "Import Data File" option from the drop down menu in the Comment Toosl, it displays a FileOpen dialog for selecting a file. And the file type that it wants is "fdf". this is the only type of file that can contain comments.

 

So, you have to save the comments from the other file into an FDF. This is done from the same menu with the "Export All to Data File..." option. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
VenkatMPAuthor
Participating Frequently
September 18, 2024

Thank you for your response. I want to create using the guided action in Acrobat to streamline our workflow. Specifically, I need to automate the following steps:

  1. Resizing the document: Adjusting the existing document by adding equal spacing on both sides to accommodate comments.
  2. Importing data from another document: Ensuring the imported document is of the same size so that annotations align perfectly.
  3. Adding a red box with text: Inserting a red text box in Arial to allow for additional annotations when necessary. This feature is typically required in most cases, although not always.

    And somehow to could achieve step 1 and Step 3 only step 2 is not happening.

Automating these steps would significantly enhance our productivity, as we handle a large volume of documents regularly in the pharmaceutical industry. Your guidance on how to proceed would be greatly appreciated.

Looking forward to your support.

Thom Parker
Community Expert
Community Expert
September 18, 2024

There are a couple of ways to transfer comments from one PDF to another using an automation script. 

In both cases, both the source PDF and the destination PDF have to be open in Acrobat. 

 

Method #1:  Export comments from the source to an fdf file. Then import the fdf into the target PDF. 

                      Use the doc.exportAsFDF and doc.importAnFDF functions 

 

Method #2:  Loop through all the annotations on the source PDF. Acquire a "properties" object from each annotation and use it to re-create the annotation on the target PDF. 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often