Adding metadata to PDF via PHP

一曲冷凌霜 提交于 2019-11-28 01:34:50

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/3060078/adding-metadata-to-pdf-via-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!