I am using GflAx 2.82 with C# to convert a PDF into a PNG file using the code at the end of this post. Exactly the same code works for converting a jpg to a png. But dealing with a pdf, the program gets stuck at the g.LoadBitmap(file) command. No error message appears. I tried it with different pdfs from different sources (thanks to google). Ghostscript 8.70 is installed.
Anyone encountered a similar problem?
Code: Select all
public static void PDFtoPNG()
{
String file = "test.pdf";
String image = "test.png";
try
{
GflAx.GflAxClass g = new GflAx.GflAxClass();
g.EpsDpi = 72;
g.Page = 1;
g.LoadBitmap(file);
g.Page = 1;
g.SaveFormat = GflAx.AX_SaveFormats.AX_PNG;
g.SaveBitmap(image);
}
catch (Exception ex)
{
Console.WriteLine("GflAx error: " + ex.Message);
}
}