私はPDFファイルのメタデータを取得するために使用しました。私はSMALOT pdf ParserとTCPDF Parserを使ってファイルを解析しました。PHP PDFパーサーSMALOtとTCPDFパーサー
私はsmalot pdf解析を使用してpdfファイルを解析し、次にTCPDFパーサーライブラリを使用してpdfファイルのメタデータと内容を取得します。小さなpdfファイルのために働いていますが、10 MB以上のpdfファイルのメモリを解析したときにexhuastedが実行され、実行が停止してエラーが発生しません。私は1024Mメモリ制限を設定します。
public function parseFile($filename)
{
return $this->parseContent($filename);
}
public function parseContent($filename)
{
// Create structure using TCPDF Parser.
ob_start();
$parser = new \TCPDF_PARSER(file_get_contents($filename));
list($xref, $data) = $parser->getParsedData();
// print_r($tcpdf->getParsedData());
// $parser = new \TCPDF_PARSER(ltrim($content));
list($xref, $data) = $parser->getParsedData();
unset($parser);
ob_end_clean();
if (isset($xref['trailer']['encrypt']))
{
throw new \Exception('Secured pdf file are currently not supported.');
}
if (empty($data))
{
throw new \Exception('Object list not found. Possible secured file.');
}
// Create destination object.
$document = new Document();
$this->objects = array();
foreach ($data as $id => $structure)
{
$this->parseObject($id, $structure, $document);
unset($data[$id]);
}
$document->setTrailer($this->parseTrailer($xref['trailer'], $document));
$document->setObjects($this->objects);
return $document;
}
あなたの質問/問題は何ですか?そのコードのどの部分が意図したとおりに動作しないのですか? – cypherabe
私はsmalot pdf解析を使用してpdfファイルを解析し、次にTCPDFパーサライブラリを使用してpdfファイルのメタデータと内容を取得します。小さなpdfファイルのために働いていますが、10 MB以上のpdfファイルのメモリを解析したときにexhuastedが実行され、実行が停止してエラーが発生しません。私は1024Mメモリ制限を設定します。 – ankita