Adding metadata to PDF via PHP
Asked Answered
E

1

6

I need to augment a PDF with a custom metadata field on download in PHP (5.3).

I have been looking at the pdftk library, but I can't get my head around how I would get PHP to interface with it on our (Ubuntu) web server.

The deprecated PDFInfo library seems like a dead end.

Is there a simpler/easier/better solution?

Thanks

Extraction answered 17/6, 2010 at 8:33 Comment(0)
P
7

You could use Zend_Pdf. It's from the Zend Framework but can be used as a standalone component. Adding metadata is as easy as:

  $pdf = Zend_Pdf::load($pdfPath);
  $pdf->properties['Title'] = 'New Title.';
  $pdf->save($pdfPath);
Ponce answered 17/6, 2010 at 8:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.