I'm writing a PHP script that combines 2 pdf together, I'm using the FPDI library but it doesn't support the 1.5 version of pdf. So I'm trying to run this code before merging the files (only if file version is 1.5):
exec("gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile={$url} {$url}")
(the $url
variable is repeated in input and output because I want to overwrite the v1.5 file stored in $url
), however that script returns an empty page, i don't know why. can someone help me? thanks
You can't do that. As soon as pdfwrite starts processing it opens the output file for writing, this instantly overwrites the file its using to read from.
You cannot write a new PDF file on top of the old one.