user2146944
user2146944

Reputation: 51

Editing an existing pdf file's metadata

I have some PDF files, on pdf version 1.6.

i have been trying the following libraries to edit the metadata of these pdf files:

  1. Zend_Pdf class: which worked nicely for pdf version 1.5 or less. but had an error on parsing pdf of version 1.6
  2. pdflib: not sure how i can edit an existing pdf file.
  3. tcpdf: same problem that i couldn't find the functions for editing the existing pdf
  4. someone also suggested just edit the pdf file by adding the following(for an example, title) to the end of the pdf file: /Title (Title Text)

i would still wish to be able to do it using pdflib or some free source php libraries to achieve this.

Upvotes: 4

Views: 4792

Answers (1)

rjs
rjs

Reputation: 86

PDFlib cannot edit an existing file, but you can copy the content of an existing file to a new file and read the metadata from the import document, change it and then write it to the new document.

http://www.pdflib.com/pdflib-cookbook/document-interchange/import-xmp-from-pdf/php-import-xmp-from-pdf/

is an example showing parts of this approach.

Upvotes: 3

Related Questions