Convert PDF to Bitmap with PDFium

After successfully build PDFium with Microsoft Visual C++ 2000 Express,  I begin my first attempt,  tried to convert PDF to Bitmap.

To simplify the job, I do not want use some big Image Library, such as FreeImage, ImageMagick,  GraphicsMagickOpenImageIO and so on.

After some research, I found EasyBMP, a simple, cross-platform, open source (revised BSD) C++ library designed for easily reading, writing, and modifying Windows bitmap (BMP) image files.

Simply add EasyBMP.cpp, EasyBMP.h, EasyBMP_BMP.h, EasyBMP_DataStructures.h,  EasyBMP_VariousBMPutilities.h to project pdfium_test, and use the following code, we can easily convert PDF to Bitmap.

 

 

here is the example, pdfium_test.zip(Win32 pre-build, 3.77M), the usage is same as the original pdfium_test.exe, but convert PDF to PPM and BMP at the same time.

P.S.

From this example, we know PDFium is not only an open-source PDF rendering engine for Chrome, we can do many jobs with the help of it.

 

Leave a Reply