Problems loading a PDF

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Post Reply
Anders
Posts: 1
Joined: Wed Aug 05, 2009 9:29 am

Problems loading a PDF

Post by Anders »

Hello all!

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);
            }
        }
User avatar
xnview
Author of XnView
Posts: 43442
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Problems loading a PDF

Post by xnview »

No problem to load it in XnView?
Pierre.
Post Reply