When you build up an advanced PDF document management program in .NET, you may find it is quite easy to transform .jpeg/.jpg images into PDF files because free open source SDKs that implement such conversion function are not difficult to find. However, when you came across converting PDF file to JPG/JPEG image format, things gets different. In this online guide, we will introduce you a quick and easy way to render and turn PDF file into JPEG/JPG images.
JPEG Image Format
Raster image format JPEG or JPG, with .jpeg or .jpg filename extension, is the most common image format supported by digital cameras and other professional photographic image capture devices. It is the most used file format for storing and transmitting photographic images. More than that, JPEG image format is definitely one of the most popular image formats nowadays.
Difficulties of PDF to JPEG Conversion
Transforming and turning PDF into JPG/JPEG seems a little bit difficult due to the fact that PDF to JPG/JPEG converting has the difficulties to deal with PDF document data maintaining and converting, as well as the generation of lossy compressed JPEG image file format. Certainly, it may not be so hard to find ways to handle them separately, but integrate the whole process in .NET applications may need more complicated manipulation and more time.
Quick and Easy PDF to JPEG Conversion
If you search for a quick and easy way to render and convert PDF to JPEG in .NET with high quality, our .NET PDF to image conversion software may be of great help. Before getting started, please check all technical compatibility. Then use fully developed APIs for high performance conversion from PDF document to JPG/JPEG image file.
- .NET Framework 2.0, 3.0, 3.5, 4.0 and 4.5 etc.
- Microsoft Windows OS in 32-bit and 64-bit
- Visual Studio 2005, 2008, 2010, 2012 and 2013 versions
- .NET Console application, .NET WinForms and ASP.NET web programs
Available Properties and APIs
Find the Target PDF
There are two ways to define a PDF source file to read into your Visual Studio .NET application. Both of them return true if the file is loaded successfully, while false if load failed.
- Load and read PDF from local file on your computer disk.
public bool LoadPDF(string fileName);
- 2. Load and read PDF from file stream or memory stream.
public bool LoadPDF(Stream stream);
Count PDF Page(s)
.NET users may easily define a range of PDF pages to be turned to JPEG images. The following API may be used to return the number of pages in source PDF document.
DPI (Dots per Inch) Customization
DPI of the current PDF page could be set or get when you activate the DPI property. This may help you to set output image DPI.
Get PDF Page Size
If you need to know the original size of PDF file page, please use the codes below.
public int GetPageHeight(int pageIndex);
public int GetPageWidth(int pageIndex);
Get JPEG/JPG image
Page index is used here to assign which PDF document page to convert and change to JPG/JPEG.
public Bitmap ToImage(int pageIndex);
To change the height and width of JPEG/JPG image, please add the following .NET programming code.
public Bitmap ToImage(int pageIndex, int width, int height);