问题描述
我正在使用Smalot / pdfparser lib从PDF文件获取图像。 问题是如何使用它处理平面解码图像。
我的一部分代码:
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('documents/document5.pdf');
$xobjects = $pdf->getobjectsByType('XObject');
foreach( $xobjects as $xobject ) {
$content = $xobject->getContent();
if ('FlateDecode' === $xobject->getHeader()->getElements()['Filter']->getContent()) {
$content = zlib_decode($content);
}
file_put_contents('mydir/file.png',$content);
}
我已经使用过zlib_decode,gzuncompress,gzinflate。
相同的错误:
Message: zlib_decode(): data error
Message: gzinflate(): data error
Message: gzuncompress(): data error
需要帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)