mPDF error: Unable to find xref table

你。 提交于 2019-12-08 19:04:27

This can be caused by PDF files of a version incompatible with the mPDF you're running. You can often circumvent the problem by regressing the source PDF files.

For instance, for mPDF v6.0 try brining your PDFs down to at most v1.4 using something like Ghostscript. (Where old.pdf is you're sourcefile)

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -o new.pdf old.pdf

Ghostscript won't write to the file it's reading so if you're doing this inline you'll have to dance;

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -o new.pdf old.pdf; mv -f new.pdf old.pdf

The version of FPDI in the offical repo of mPDF is very old. You may try to update to the latest version. Or you simply use the official version of FPDI which uses FPDF.

If you get a message about "unssported compression" you may check out the FPDI PDF-Parser add-on. Notice that there's a license incompatibility to mPDF.

This can be caused by the PDF file version that is incompatible with mPDF. You would better regress the PDF file version.
If you extracted a page from a file, you may have used an Adobe software. Just use pdftk or pdfchain on Linux platform to solve the problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!