I use this code to generate JPEG images from a PDF file:
String cmd = @"./lib/gswin32c";
String args = "-dNOPAUSE -sDEVICE=jpeg -dJPEGQ=100 -dBATCH -dSAFER -sOutputFile=" + fileName + "-%03d.jpg " + fileName + ".pdf";
Process proc = new Process();
proc.StartInfo.FileName = cmd;
proc.StartInfo.Arguments = args;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();
I works really fine, but the quality is really bad. It seems to be blurred. Any hints how to improve the quality?
Now I'm using the following arguments and it is working as expected:
String args = "-dNOPAUSE -sDEVICE=pngalpha -r300 -dBATCH -dSAFER -sOutputFile=" + fileName + "-%03d" + FILEEXTENSION + " " + fileName + ".pdf";
JPEG? For documents? Generate gifs or pngs, if you can. JPEGs are unsuitable for anything else than photos, even at a "maximum" quality setting.
http://lbrandy.com/blog/2008/10/my-first-and-last-webcomic/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With