Convert pdf to Tiff with same quality

2019-08-21 08:40发布

问题:

We are using following shell script to convert pdf attachment in tiff but having some issue with quality, So can you please check below shell script and let us know anything where we can improve quality as well as compress file size too as much as possible while conversation.

shell_exec('/usr/bin/gs -q -sDEVICE=tiffg4 -r204x392 -dBATCH -dPDFFitPage -dNOPAUSE -sOutputFile=america_out7.tif america_test.pdf');

We have tried following command and seems quality is better but when we are going to send fax via Free-switch

gs -q -r1233x1754 -dFitPage -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sDEVICE=tiffg4 - -sOutputFile=america_out7.tif america_test.pdf 

We are getting the below error

"Fax processing not successful - result (11) Far end cannot receive at the resolution of the image. "

So, here we need your help to elude this issue and please provide any other way.

Awaiting for some response on this.

回答1:

Fax machines only support certain resolutions. If you Group 3 or Group 4 CCITT compressed TIFF many fax machines can read that, extract the compressed image data, and send it directly to a compatible fax machine.

"Standard" is 204x98, "fine" is 204x96, "superfine" is 400x391.

You've chosen a resolution of 1233x1754. That's 3 times higher than any fax specification I know of supports. So of course your receiving fax machine can't cope with it. Note that there is no fax standard (unless there's been a new one which seems unlikely) supports 600x600 either, though its entirely possible that specific manufacturers may support such a thing between their own equipment.

Naturally the higher the resolution, the better quality your rendered output will be, which is why using a higher resolution results in better quality.

Everyone wants the magical goal of "better quality and lower filesize" but there is no such thing. This is always a tradeoff.

You will probably find that using superfine resolution (400x391) will give you better quality, at the cost of higher file sizes.. You can't go higher than that with ordinary fax.

Note that the PDFSETTINGS switch has no effect except with the pdfwrite device, which is used to create PDF files, not read them.

This is also off-topic for Stack Overflow, since this is not a programming question. Not even a little bit, and Stack Overflow is not a generalised support forum.