PRODUCTS | DOWNLOAD | PURCHASE | SUPPORT | BLOG | LIVE DEMOS | COMPANY Follow us on Google Plus SautinSoft on Facebook SautinSoft on Twitter
.Net Components Converts PDF, Word HTML5 with C#, VB .Net
 

 

How to convert PDF to Jpeg in C# and VB.Net

 
 

If you are looking for a solution to convert PDF into Jpeg images using C#, stop the searching - you're in the right place!

The PDF Focus .Net is only the one library designed for this purpose. It perfectly converts any PDF documents to Jpeg/JPG.

By creating the library, we've tried to cover all requirements from customers: only the .Net platform and nothing else, 32 and 64-bit support, Medium Trust level, converting of all types of PDF documents, works under Windows, Mac, Linux and a lot of other nuances.

Let's move forward, here we'll show you how to convert a PDF document into a set of Jpeg images using Visual Studio 2010/C#.

You may watch all steps in video or take a tour on this page below:

Very simple example. For example, we've a two-page PDF document (412 Kb), version 1.5 - Zoo.pdf:

Sampe PDF document - zoo.pdf 1. Let's convert all pages into a set of Jpegs: Page1.jpg, Page2.jpg, ... PageN.jpg.

Step 1: Launch Visual Studio 2010. Click File->New Project->Visual C# Console Application. (video 0:54).

Type the application name and location, for example "pdf to jpeg" and "c:\samples". (video 1:10).

Step 2: In the Solution Explorer right-click on "References" and select "Add Reference". Next add references to the "System.Drawing" and "SautinSoft.PdfFocus.dll". (video 1:23).

Step 3: So, we've created an empty C# console application. Now type the C# code to convert our Zoo.pdf to Jpeg files with 200 dpi. (video 1:56).

Don't forget to create a folder "Pictures" inside "C:\Tutorials\", because the component does not create folders by itself.

C# code:


            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

            f.Serial = "XXXXX";

            f.OpenPdf(@"C:\Tutorials\zoo.pdf");



            if (f.PageCount > 0)

            {

                //Set 200 dpi and jpeg format

                f.ImageOptions.Dpi = 200;

                f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;



                //Save all pages to jpegs into the folder 'Pictures'

                //P.S. The folder 'Pictures' must be existed

                for (int page = 1; page <= f.PageCount; page++)

                    f.ToImage(@"c:\Tutorials\Pictures\"+ "page" + page + ".jpg", page);

            }

If you are developing in VB.Net all steps are very similar, except you will need to select Visual Basic Console Application in the step 1.

VB.Net code:


			Dim f As New SautinSoft.PdfFocus()

			f.Serial = "XXXXX"

			f.OpenPdf("C:\Tutorials\zoo.pdf")



			If f.PageCount > 0 Then

				'Set 200 dpi and jpeg format

				f.ImageOptions.Dpi = 200

				f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg



				'Save all pages to jpegs into the folder 'Pictures'

				'P.S. The folder 'Pictures' must be existed

				For page As Integer = 1 To f.PageCount

					f.ToImage("c:\Tutorials\Pictures\" & "page" & page & ".jpg", page)

				Next page

			End If

Now build the application and launch it.
Page1.jpg produced from PDF in C#

 

 

Page2.jpg produced from PDF in C#  

Well done! Our congratulations, with help of the PDF Focus .Net library we've converted all pages of PDF document to a set of Jpegs.

Try it for free now! Download the PDF Focus .Net, 6.6.9.7 (Sep 7th, 2017) , 21.2 Mb .

 

Home | Contact | Privacy

Copyright © 2002 - 2017, SautinSoft (started from sautin.com). All rights reserved.