Ghostscript.NET.Rasterizer set resolution (Dpi) is not working

  • Thread starter Thread starter Guest1993
  • Start date Start date
G

Guest1993

Guest
I have this code to set the x and y dpi but it always get ignored. I tried different versions of NuGet GhostScript and I also tried different versions of ghostscript.exe still same issue

Here is my code:

var xDpi = 300; //set the x DPI
var yDpi = 300; //set the y DPI

using (var rasterizer = new GhostscriptRasterizer()) //create an instance for GhostscriptRasterizer
{

rasterizer.Open(fileName); //opens the PDF file for rasterizing
int PdfPages = rasterizer.PageCount;
for (int pageNumber = 1; pageNumber <= rasterizer.PageCount; pageNumber++)
{
//set the output image(png's) complete path
string outputPNGPath = Path.Combine(fileNameResultDirectory, "00" + pageNumber.ToString() + ".tif");


//converts the PDF pages to png's
Image pdf2PNG = rasterizer.GetPage(xDpi, yDpi, pageNumber);

//save the png's
pdf2PNG.Save(outputPNGPath, ImageFormat.Tiff);
}



}

Also tried:

rasterizer.CustomSwitches.Add("-r300x300");


I don't know what else to do... thank you

Continue reading...
 
Back
Top