Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
3

Add an FDF file inside a PDF automatically

Community Beginner ,
Jul 13, 2023 Jul 13, 2023

Is it possible to add an FDF file inside a PDF automatically using python or javascript?
The FDF file is the file with the comments of a PDF. It is NOT for filling in a fillable PDF.

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 13, 2023 Jul 13, 2023

You can import an FDF file using JavaScript, yes. See the documentation of the importAnFDF method of the Document object.

The question remains what you mean by "automatically", though. Something has to trigger this action.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 13, 2023 Jul 13, 2023

using the importAnFDF method is it possible to import an FDF like the attached one?
What I find is how to import FDF to fill in autofillable PDFs.
I uploaded it as .txt because it wouldn't let you upload .fdf, but it really is a .fdf, you just have to change the extension.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 13, 2023 Jul 13, 2023

It didn't upload, but if you mean one that creates comments, then yes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 13, 2023 Jul 13, 2023

Exactly, a comment file (text box, text box with callout...)
Could you give me a link where I can see how to do this?
Can it be done with any python library?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 13, 2023 Jul 13, 2023

You can find the documentation of this method in the Acrobat JS API Reference, which is a part of the Acrobat SDK, but the basic command is very simple, since it only takes one input parameter:

 

this.importAnFDF("/C/My Files/Data.fdf");

 

You can also specify a relative path, if the FDF is in the same folder as the PDF file, for example:

 

this.importAnFDF("Data.fdf");

 

I don't know about Python.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 14, 2023 Jul 14, 2023
LATEST

The best way to generate an FDF containing Annotations is to use the "doc.exportAsFDF()" function to export an FDF containing annotations. Open the FDF in a text editor to see how it all works. You'll find the FDF specification as a sub-section in the PDF specification.  

 

An FDF can also be loaded from the command line or as a query parameter in an URL. 

https://community.adobe.com/t5/acrobat-reader-discussions/opening-pdf-with-parameters/td-p/10146246

 

It can also be loaded as the response from a submitForm action. 

 

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines