gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-10-31 23:07:58 25 4
gpt4 key购买 nike

如何使用 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"
}

关于php - 如何使用 PHP 从 PDF 文件访问元数据信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12392207/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com