Skip navigation
Currently Being Moderated

How to get and/or set metadata in PDF (File --> Document Properties --> Summary) using a Java or C o

Jun 24, 2003 12:10 PM

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?
 
Replies
  • Currently Being Moderated
    Jun 24, 2003 12:58 PM   in reply to (Pawanjit_Singh)
    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.

    3. if you don't have to use C or Java, you may get/set metadata through Acrobat JavaScript interface

    Sample code and technical documentation are available in SDKs.
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2003 1:46 PM   in reply to (Pawanjit_Singh)
    Have you tried the Java utility, basically an XMP parser at
    http://www.kegel-mediendesign.de/XmpUtil/?

    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
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 17, 2003 9:46 PM   in reply to (Pawanjit_Singh)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2003 8:01 AM   in reply to (Pawanjit_Singh)
    Ezhil,

    IAC only available with full Acrobat purchase. Can you write a Acrobat plug-in and distribute the plug-in to your end Acrobat users?

    Shulin
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2003 8:50 PM   in reply to (Pawanjit_Singh)
    Thanks for your response.

    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()
    PDDocGetXAPMetadata().
    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.
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 20, 2003 8:01 PM   in reply to (Pawanjit_Singh)
    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.

    Hope this helps. Good luck,
    Shulin
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 25, 2007 4:46 PM   in reply to (Pawanjit_Singh)
    hi,
    i want to extract metadata from a pdf file using java.Can anyone suggest how this can be done.
    Thanks
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 4, 2007 10:17 AM   in reply to (Pawanjit_Singh)
    You could use for PDF Itext classes with Java,
    check PdfReader and PdfStamper.

    I am looking for the same stuff for jpeg. Somebody know a jpeg XMP extractor ?
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2007 6:16 AM   in reply to (Pawanjit_Singh)
    hi, want to extract metadata from a jpeg/png file using java.Can anyone suggest how this can be done.

    thanks in adv.

    regards
    Narayana
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2007 8:02 AM   in reply to (Pawanjit_Singh)
    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.
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 28, 2008 11:58 PM   in reply to (Pawanjit_Singh)
    Hi,I want to copy apicture feom internet explorer to pdf.
    Manually I need to send that picture to clipboard and copy to the required doc.
    can anybody help me.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2008 5:39 PM   in reply to (Pawanjit_Singh)
    I have been able to extract XMP metadata from PDFs using the javascript interface, but have had no luck at all trying to write metadata with javascript. I'm using AppleScript to call the javascript code. It just doesn't work and no one will tell me the secret to make it work.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 14, 2008 12:24 PM   in reply to (Pawanjit_Singh)
    Hi Rob,

    If you are on an Apple, your best bet may be to drop the JavaScript and use Perl instead. ExifTool can be used to read/write XMP and native PDF metadata in PDF images:

    http://owl.phy.queensu.ca/~phil/exiftool/
     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2008 10:38 PM   in reply to (Pawanjit_Singh)
    Try PDFBox, it is quiete good http://www.pdfbox.org/
     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2008 1:28 PM   in reply to (Pawanjit_Singh)
    Hi, do you think we can apply this Web Deployment Tool to one of our web sites? http://calinsurancequote.com/
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2008 11:00 PM   in reply to (Pawanjit_Singh)
    how to get metadata from pdf in php using fpdf
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)