Reputation: 122
Now I'm trying to convert a PDF File to a Image file.
I hope to get a image file from a PDF file using GhostScript. The output image should be 500x500 size. It means whole size of the image is resized to fit 500x500 size.
I am already tried options below. No special option : Output image is crop to 500x500 size.... -dFitPage : It automatically rotate image. The long side is to be changed to Height. other -*FitPage options are same....
What I want is same with using -dFitPage without rotation.
Do you have any idea to solve this problem?
Upvotes: 0
Views: 631
Reputation: 21
Yes it is not possible by using ghostscript but you can make it works by using custom bitmap like i did
var outputPNGPath = Path.Combine(outputFolder, string.Format("{0}.jpeg", filename));
var pdf2PNG = rasterizer.GetPage(xDpi, yDpi, i);
Bitmap resized = new Bitmap(pdf2PNG, new Size(1240, 1754));
resized.Save(outputPNGPath, ImageFormat.Jpeg);
pdf2PNG.Dispose();
resized.Dispose();
this is worked for me to convert 1240*1654 image to 1240*1754
Upvotes: 2