在我的PHP代码中从上传的PDF元数据文件获取页面大小
这里我使用了一个PDF解析器PHP库:在我的PHP代码中从上传的PDF元数据文件获取页面大小,php,pdf,metadata,pdfparser,Php,Pdf,Metadata,Pdfparser,这里我使用了一个PDF解析器PHP库: <?php include 'vendor/autoload.php'; // Parse PDF file and build necessary objects. $parser = new \Smalot\PdfParser\Parser(); $pdf = $parser->parseFile('ss.pdf'); // Retrieve all details from the PDF
<?php
include 'vendor/autoload.php';
// Parse PDF file and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('ss.pdf');
// Retrieve all details from the PDF file.
$details = $pdf->getDetails();
var_dump($details);
// Loop over each property to extract values (string or array).
foreach ($details as $property => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
echo $property . ' => ' . $value .' -|- ';
echo "\r";
}
虽然我试图从中获取元数据,但结果如下:
'Author' => string 'Adrien LORENZI' (length=14)
'Creator' => string 'Microsoft® Word 2010' (length=21)
'CreationDate' => string '2019-12-18T11:42:02+01:00' (length=25)
'ModDate' => string '2019-12-18T11:42:02+01:00' (length=25)
'Producer' => string 'Microsoft® Word 2010' (length=21)
'Pages' => int 6
Author: Adrien LORENZI
Creator: Microsoft® Word 2010
Producer: Microsoft® Word 2010
CreationDate: Wed Dec 18 11:42:02 2019 CET
ModDate: Wed Dec 18 11:42:02 2019 CET
Tagged: yes
UserProperties: no
Suspects: no
Form: none
JavaScript: no
Pages: 6
Encrypted: no
Page size: 595.32 x 841.92 pts (A4)
Page rot: 0
File size: 436449 bytes
Optimized: no
PDF version: 1.5
Page size: 595.32 x 841.92 pts (A4)
这就是我想要的元数据。如何使用PHP从元数据中找到它