Lossless merging of PDFs (PHP)

故事扮演 提交于 2019-12-22 01:32:26

问题


Currently I am using ImageMagick to merge multiple PDFs into one in a PHP script on my Linux system. However, the resulting PDFs are of very low quality. I have stumbled across pdftk which seems to have a better quality after the merging, but I need to use ImageMagick if possible because I need to get the script to run on another server which does not have pdftk (and it would be a pain to get it on there).

How can I merge PDFs using ImageMagick and PHP with lossless quality?


回答1:


ImageMagick can't do lossless PDF merging. If you have a Linux server, you may try pdfconcat (which does lossless merging very quickly):

$ wget -O pdfconcat http://www.math.bme.hu/~pts/cvsget.cgi/u=bin.i386/p=/M=bin.i386/c=f1/n=/bin.i386/pdfconcat
$ chmod +x pdfconcat
$ ./pdfconcat -o output.pdf input1.pdf input2.pdf input3.pdf



回答2:


My CAM::PDF Perl library includes a flexible command-line tool called appendpdf.pl which can mix arbitrary pages of a PDF into another document.



来源:https://stackoverflow.com/questions/848513/lossless-merging-of-pdfs-php

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