0

I'm trying to convert a PDF in A3 format to a PDF in A4 format, with the A3 pages fitting the A4 pages.

Therefore I tried using ImageMagicks convert function like so in PHP:

$filePath = $_SERVER['DOCUMENT_ROOT'] . '/pingen/test/Rechnung_220719020369.pdf';
$gs = 'convert -density 300 -define pdf:fit-page=A4 ' . escapeshellarg($filePath) . ' ' . escapeshellarg($_SERVER['DOCUMENT_ROOT'] . '/pingen/test/test'.date('Y-m-dHms').'.pdf');
exec($gs);

But when I try to open the resulting PDF with Adobe Acrobat reader I'm getting the error "Insufficient Data for an Image".

Any solution?

Mischa Binder
  • 130
  • 11
  • Might there be another solution using ghostscript for this problem? I already tried with ghostscript, but as I'm very new to this it ended up in a blank page. – Mischa Binder Jul 19 '22 at 13:31
  • Found a solution with Ghostscript here that works fine: https://stackoverflow.com/questions/7446552/resizing-a-pdf-using-ghostscript But still I'm wondering if it is possible using Imagemagick – Mischa Binder Jul 19 '22 at 13:37
  • Check what version of Ghostscript is being used by Imagemagick. Perhaps it needs to be updated – fmw42 Jul 19 '22 at 15:21

0 Answers0