I need to write a program that can set metadata on PDF file (File --> Document Properties --> Summary) using a program. Metadata that needs to be set is Title, Author, Subject and keywords. Can someone help? Is there any sample code that I could start with?
You need to get Adobe Acrobat/PDF product line of SDKs to do this. You can use XMP Tool Kit only in your program to embed XMP metadata in PDF, but it is not recommended because of the complication of PDF structure (see http://support.adobe.com/devsup/devsup.nsf/docs/52016.htm knowledgebase article). There are three ways to do this with Acrobat/PDF Library SDKs:
1. write a Acrobat plug-in with Acrobat SDK. After you become a ASN (Adobe Solution Network) member, it can be downloaded from https://partners.adobe.com/asn/acrobat/ free of charge.
2. license to PDF Library and integrate the library into your application. You can download it from the same web site.
Sample code and technical documentation are available in SDKs.
Have you tried the Java utility, basically an XMP parser at
The author mentioned there were two limitations:
"The Java XmpParser doesn't know anything about the document format, therefor all binary files can be used. But for writing new metadata to a file a XMP packet must already exist in this file and the size of the new metadata is limited to the original size of the XMP packet
XMP metadata written into PDF files can't be seen/edited in Acrobat (bug of Adobe) "
You may make it better based on the guideline for embedding XMP metadata in PDF" at http://support.adobe.com/devsup/devsup.nsf/docs/52016.htm
Thanks for your response. I did download Acrobat SDK and read the IAC reference. I also referred setinfo method in that. However, before I execute any of the sample VB codes, it gives an error because I need to create a project reference to some TLB file, which comes with full install of Acrobat. I also referred to Developer FAQ and the impression I got was that one needs to have full Acrobat Install before using SDK.
I need to write a program that can embed metadata to PDF files (Title, Author, keywords, etc.) on the server, which will have Acrobat Reader only. Basically, I need to create an executable that would take input as "Path to PDF", Title value, Subject value, etc. and set these values on PDf as specified in Path.
How to get the metadata information from a pdf file using c or c++.
we have pdf library and Acrobat5.0 SDK. Without using tlb(which is used in VB sample program in Documentation). i need sample code how to retrieve metadata information. Thanks in advance
Actually i need to index image pdf files for searching through our application.so i need to give the content of the doucment by OCR plus metadata to the search engine what i am using.So here we don't at all open the acrobat application.
The acrobat SDK has the following API which gives the metadata of the pdf document which is given in the example under Plugin samples\Metadata\DocumentMetadata under the function getDocMetaData()
I need to use this function under my application using c\c++.Could you please give a sample program in c\c++ using PDDocGetXAPMetadata().
So that it will be very much useful to me.
IAC is the only way to use this API in your application, which requires a full version of Acrobat. I am afraid this API doesn't work for for your case.
You can use the XMP packet scanner in the XMP Toolkit to extract the PDF metadata. However, you may get multiple metadata packets, you need to select the one which has the latest ModDate timestamp. To use the XMP Toolkit, you need to build the library and load the library into yuor application. The XMP Toolkit supports all Windows, Mac and Unix three platforms.
you can use other classes. Let me check what I used com.drew.imaging.jpeg.JpegMetadataReader but it is not very complete
I think you could do something with imageIO.
If you don't want to spend to much time looking around I suggest you to use exiftool and find a good setup for performance management around PERL, with IIS server you can use PERL as an ISAPI filter for example but this is an other conversation.
Let me know if you find some good java package that manage XMP or other meta.
Maybe Adobe to promote XMP will provide good java classes that could manage XMP for several file formats.