Reading PDF metadata in PHP

后端 未结 6 1532
你的背包
你的背包 2020-12-08 17:55

I\'m trying to read metadata attached to arbitrary PDFs: title, author, subject, and keywords.

Is there a PHP library, preferably open-source, that can read PDF meta

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 18:07

    The Zend framework includes Zend_Pdf, which makes this really easy:

    $pdf = Zend_Pdf::load($pdfPath);
    
    echo $pdf->properties['Title'] . "\n";
    echo $pdf->properties['Author'] . "\n";
    

    Limitations: Works only on files without encryption smaller then 16MB.

提交回复
热议问题