1

这里我使用了一个 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 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

虽然我试图从https://www.pdfyeah.com/view-pdf-metadata/获取元数据,但它给了我这个结果:

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 从元数据中找到它?

4

0 回答 0