如何使用PHP从PDF文件访问元数据信息?

如何使用 PHP从PDF文件访问元数据(XMP)信息?我需要文件的高度和宽度.

解决方法

似乎 ImageMagick understands PDF’sImagick::identifyImage()返回一个包含大量信息的数组.

这个片段:

$img = new Imagick('test.pdf');
var_dump($img->identifyImage());

生成此渲染:

array(9) {
  ["imageName"]=>
  string(9) "/test.pdf"
  ["format"]=>
  string(30) "PDF (Portable Document Format)"
  ["geometry"]=>
  array(2) {
    ["width"]=>
    int(596)
    ["height"]=>
    int(843)
  }
  ["resolution"]=>
  array(2) {
    ["x"]=>
    float(72)
    ["y"]=>
    float(72)
  }
  ["units"]=>
  string(9) "Undefined"
  ["type"]=>
  string(14) "TrueColorMatte"
  ["colorSpace"]=>
  string(3) "RGB"
  ["compression"]=>
  string(9) "Undefined"
  ["fileSize"]=>
  string(7) "37.6KBB"
}

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...