PDF to Image, PNG, JPG/Jpeg, multipage TIFF, Bitmap in C# and VB.Net

PDF to Image, PNG, JPG/Jpeg, multipage TIFF, Bitmap in C# and VB.Net

PDF Focus .Net

.Net assembly which gives API to convert PDF to All: DOCX, RTF, HTML, XML, Text, Excel, Images in .Net and C#.
PDF to Images scheme

PDF Focus .Net

PDF to Image, PNG, JPG/Jpeg, multipage TIFF, Bitmap in C# and VB.Net
PDF to Images scheme

Introduction

Now let's get to know another benefit of the library. PDF Focus .Net offers great abilities to rasterize PDF documents to images: PNG, JPG/jpeg, B&W-TIFF, multipage-TIFF, Bitmap, GIF and, furthermore, into "System.Drawing.Image". It offers developers a set of actionable properties to convert PDF to images with the desired level of quality, tune up the color depth, and specify dpi and image format. To show how PDF Focus .Net really lessens the burden of coding, assume that you want to convert a multipage PDF into a set of JPEG pages in C#:

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

f.OpenPdf(@"e:\Computer Magazine.pdf");

if (f.PageCount > 0)
{
    //Set image properties: Jpeg, 200 dpi
    f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
    f.ImageOptions.Dpi = 200;

    //Save all PDF pages as page1.jpg, page2.jpg ... pageN.jpg
    f.ToImage(@"e:\Pictures\, "page");
}
          

Download

To see this functionality firsthand, download the freshest «PDF Focus .Net» with code examples, 104.0 Mb.

Limitations

PDF Focus .Net The limitations of the free version are: The trial notice "Created by unlicensed version of PDF Focus .Net" and the random addition of the word "TRIAL".


Some examples to convert PDF to various Images in C# and VB.Net

1. Convert PDF file to JPEG using C#:

           SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            f.OpenPdf(@"c:\Document.pdf");

            if (f.PageCount > 0)
            {
                //Save all PDF pages to jpeg images and put them in ArrayList, set 200 dpi
                f.ImageOptions.Dpi = 200;
                f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
                ArrayList images = f.ToImage();

                //Next manipulate with Jpeg in memory or save to HDD, open in a viewer
            }

2. Convert PDF file to Multipage TIFF file with 300 dpi in C#:

           SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            f.OpenPdf(@"c:\Document.pdf");

            if (f.PageCount > 0)
            {
                //Save to multipage TIFF file with 300 dpi
                f.ImageOptions.Dpi = 300;
                f.ToMultipageTiff(@"c:\Result.tiff");
            }

3. Convert 1st page of PDF document to System.Drawing.Image object in C#:

           SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            f.OpenPdf(@"c:\Document.pdf");

            if (f.PageCount > 0)
            {
                //Save 1st page to System.Drawing.Image with 200 dpi
                f.ImageOptions.Dpi = 200;
                System.Drawing.Image img = f.ToDrawingImage(1);
            }

4. Convert 2nd page of PDF document to PNG in ASP.Net-VB.Net:


        Dim f As New SautinSoft.PdfFocus()

        f.OpenPdf(FileUpload1.FileBytes)

        If f.PageCount > 1 Then

            'Let's convert 2nd page from PDF document
            f.ImageOptions.Dpi = 200;
            f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png
            Dim image() As Byte = f.ToImage(2)
            'show image
            Response.Buffer = True
            Response.Clear()
            Response.ContentType = "image/jpeg"
            Response.AddHeader("Content-Disposition:", "attachment; filename=Page2.png")
            Response.BinaryWrite(image)
            Response.Flush()
            Response.End()
        End If

5. Convert 1st and 5th pages of PDF document to Bitmap in C#:

           SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            f.OpenPdf(@"c:\Document.pdf");

            if (f.PageCount > 4)
            {
                //Save 1st page to Bitmap 200 dpi
                f.ImageOptions.Dpi = 200;
                System.Drawing.Bitmap bmp1 = (System.Drawing.Bitmap)f.ToDrawingImage(1);
                System.Drawing.Bitmap bmp5 = (System.Drawing.Bitmap)f.ToDrawingImage(5);
            }

Requirements and Technical Information

Requires .NET Framework 4.0 or higher. Our product is compatible with all .NET languages and supports all Operating Systems where .NET Framework and .NET Core can be used. Note that PDF Focus .Net is entirely written in managed C#, which makes it absolutely standalone and an independent library.

.Net Framework 4.0 and higher and .Net Core 2.0 and higher

.NET Framework 4.0, 4.5, 4.6.1 and higher.The old version for old .NET 2.0 can be found here

.NET Standard 2.0

.NET Core 2.0 and higher.


Multi-platform component, runs on:


Our component has proven itself on cloud platforms and services:

  • Microsoft Azure
  • Amazon Web Services (AWS)
  • Google Cloud Platform
  • SharePoint
  • Docker
  • etc.

If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: