Question

How can I convert a PDF to a bitmap (as in an array of pixels, not the .bmp file format) using C++ in a way that will work on both Mac and Windows? On Mac I may be able to use CoreGraphics to do it, but that doesn't give me a windows solution. I have found numerous libraries that claim to do this that require .NET, but that is not an option either.

I need to:

  • Support multiple page PDFs and get a bitmap for each image that I can process
  • Do this on both Windows and Mac. I have a solution on Mac, so worst case a Windows-only solution would be acceptable.
  • Not be tied to a GPL license
  • Keep the size as small as possible; this is being used from a browser plugin, so calling external applications or having large dependencies would be significant disadvantages.

Any ideas?

Was it helpful?

Solution

I don't know about on Windows, but on Mac OS X the system has built-in support for rendering PDFs. You can simply create an NSImage that is backed by an NSPDFImageRep.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top