Reading PDF metadata in PHP

后端 未结 6 1521
你的背包
你的背包 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条回答
  •  感情败类
    2020-12-08 18:21

    I was looking for the same thing today. And I came across a small PHP class over at http://de77.com/ that offers a quick and dirty solution. You can download the class directly. Output is UTF-8 encoded.

    The creator says:

    Here’s a PHP class I wrote which can be used to get title & author and a number of pages of any PDF file. It does not use any external application - just pure PHP.

    // basic example
    include 'PDFInfo.php';
    $p = new PDFInfo;
    $p->load('file.pdf');
    echo $p->author;
    echo $p->title;
    echo $p->pages;
    

    For me, it work's! All thanks goes solely to the creator of the class ... well, maybe just a little bit thanks to me too for finding the class ;)

提交回复
热议问题