From: james@freelancepropaganda.com (James Howison) Newsgroups: comp.text.pdf Subject: Edit Document Information Fields via C-library NNTP-Posting-Host: 24.58.114.130 Message-ID:Posted by james at October 22, 2003 02:32 AMHi, I can do this in Perl but can't find an open source C, C++ or ObjC library that can help me do this inside another programme. PDFlib doesn't allow the import of existing PDF files (not without PDI which means that it ain't open source anymore), clibpdf also doesn't (and at least they say that nicely on their front page). So is there another pdf library that could help me do this? Or does someone immediately see that this is very easy and could be done manually in C? Basically I want to open an existing PDF and edit the Document Infomation dictionary object (metadata) or, if there isn't one, add one. I'll obviously need to read that as well and then save the pdf to disk. I'm banging on about this at http://shangorilla.syr.edu/themp/ In perl I can do it with the following, but how to do it in C? ----------------------- #!/usr/bin/perl -w use PDF::API2; $pdf = PDF::API2->open('testcase.pdf'); my %docInfo = $pdf->info; my $bibtex = q( @unpublished{howison03metadata, Author = {James Howison and Abby Goodrum}, Month = {December}, Title = {Why can't I manage academic papers like MP3s? The evolution and intent of Metadata standards}, Url = {http://freelancepropaganda.com/themp/}, Year = {2003}} ); $docInfo{"Keywords"} = $bibtex; #Stick bibtex entry into Keywords field $pdf->info(%docInfo); #add changed hash to pdf $pdf->saveas("testcaseWithBibtex.pdf"); #save the changed pdf file. ------------- Any ideas? And before someone says, "Use XMP to properly store metadata for PDFs, have a look at this rant about that basically requiring one to use the Acrobat commercial API here: http://shangorilla.syr.edu/archives/themp/000203.html And if I'm wrong about that please let me know ;) Thanks, James
Hello-
Have you looked at the iText PDF library for modifying PDF?
I have recently demonstrated how to link the iText (itext-paulo) Java PDF library to a stand-alone C++ program, using GCJ and CNI. This little app. creates new PDF from existing PDF:
http://www.AccessPDF.com/pdftk/
I would be interested to hear of your success; I'll follow the thread on your Themp site. Contact me if you need help.
Sid
Posted by: Sid Steward at October 22, 2003 06:58 PMIf you haven't given up on Perl completely, I have a script that fetches metadata from PubMed and adds it to the InfoDictionary of a PDF (using Win32::OLE).
You might also like to have a look at PDF Explorer: http://rtt.planetaclix.pt/