Вы можете сжать изображение перед созданием PDF, например:
compressedImage($source, $path, $quality); //before create pdf
// Compress image function
function compressedImage($source, $path, $quality) {
$info = getimagesize($source);
if ($info['mime'] == 'image/jpeg'){
$image = imagecreatefromjpeg($source);
}elseif ($info['mime'] == 'image/gif'){
$image = imagecreatefromgif($source);
}elseif ($info['mime'] == 'image/png'){
$image = imagecreatefrompng($source);
}
imagejpeg($image, $path, $quality);
return $path;
}
Или использовать класс из tcpdf, например
public
setJPEGQuality( $quality )
//------------------//
SetCompression( $compress = true )
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default. Note: the Zlib extension is required for this feature. If not present, compression will be turned off.