The PDF Focus .Net is a standalone 100% managed C# library. It can convert PDF to Word and PDF to raster Images: JPG, PNG, multipage TIFF, Bitmap, System.Drawing. Image object etc.
The library represents only the file "SautinSoft.PdfFocus.dll". To include in any .Net app (ASP.Net, WinForms, Console etc) the ability of exporting PDF to Image you need to only copy the file "SautinSoft.PdfFocus.dll" into your Bin folder and add a reference to it.
The PDF Focus .Net perfectly works in 32/64-bit applications under .Net 2.0 and above. It can be easily launched in Medium trust level.
The library has powerfull and clear functions to raster PDF documents in the simplest way: set dpi, choose image format (JPEG, Bitmap, multipage TIFF, TIFF, PNG etc), export custom PDF pages:

Here we'll show you some examples of using PDF Focus .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 120 dpi
f.ImageOptions.Dpi = 120;
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 120 dpi
f.ImageOptions.Dpi = 120;
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 = 120;
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);
}
If anyone needs a code sample in C#, VB.Net, PHP etc "How to convert PDF to Image", email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page). We'll help you certainly!
|