Mina N
Mina N

Reputation: 231

PDF to PNG with high resolution

I want to convert a PDF file to PNG, I want the output to be 595*842 with high resolution,

I used this command:

gswin64.exe -q -sDEVICE=png16m -dSAFER -dMaxBitmap=1000000000 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dPDFFitPage=true -sDEVICE=pngalpha -dBATCH -dNOPAUSE -sOutputFile=C:\cover.png C:\cover.pdf

I know that I can use -r300 but it will change the dimension to 2479*3509 also, I've tried -sPAPERSIZE=a4 + -r300 which didn't work.

How can I have the output in 595x842 with high resolution?

Current code:

ProcessInfo = new System.Diagnostics.ProcessStartInfo( "gswin64.exe", "-q -sDEVICE=pngalpha -dBATCH -dNOPAUSE -sOutputFile=C:\\Users\\MNiyatkhair\\Desktop\\cairoCopy\\cover.png C:\\Users\\MNiyatkhair\\Desktop\\cairoCopy\\Holding.pdf" ); 
// -r300 
ProcessInfo.CreateNoWindow = true; 
ProcessInfo.UseShellExecute = true; 
ProcessInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 
Process = Process.Start(ProcessInfo); Process.WaitForExit(); 

Upvotes: 0

Views: 1637

Answers (1)

user2536463
user2536463

Reputation:

You can try to increase the image resolution (for example -r(72*3)) and add proportional downscale factor -dDownScaleFactor=3. It will work like native PDF MatrixTransform.

Upvotes: 1

Related Questions