C# PDF to Bitmap Library
How to convert PDF page to bitmap (.bmp) image using C#.net in asp.net, windows forms application
C#.NET PDF page to BMP image Convertion without open source library, such as itextsharp, pdfsharp, imagemagick.
In this C# tutorial, you will learn how to convert PDF pages to bitmap (.bmp) images using C# in ASP.NET MVC web app, and Windows Forms application.
How to convert PDF page to Bitmap image using C#
- Thread-safe and robust .NET PDF solution to convert PDF document into BMP image format using C# code
- Multifunctional PDF to BMP converting library control compatible with both Windows and Web applications
-
More about PDF converter:
convert pdf to multipage tiff c#,
c# convert image to pdf,
convert pdf to image c# free,
c# convert pdf to png,
c# pdf converter library,
c# convert docx to pdf without word.
- Professional PDF to BMP converter control with ability of page-to-page conversion using C#.NET
- Able to convert PDF document file into BMP image format with original content preserved using C#
- Easy to convert each PDF document page as an entire BMP image file in C#.NET class applications
- Able to set one general format of BMP files names (converted from each PDF page) using C#.NET
C#.NET PDF to BMP converter control SDK from RasterEdge DocImage SDK for .NET can easily and quickly transform & convert multi-page PDF document into separate BMP image files with no loss in content quality.
C#.NET PDF document converting library control from RasterEdge XDoc.PDF SDK for .NET can not only convert PDF document to BMP image but also own other PDF-to-image converting functionalities,
like
how to convert PDF to JPEG using C#.NET,
how to convert PDF to PNG using C#.NET, and
how to convert PDF to TIFF using C#.NET.
How to convert PDF page to Bitmap image using C#.NET
The following steps and sample c# code will show how to quickly convert a PDF page to BMP image.
- Create a new PDFDocument with an existing PDF file loaded
- Create a new PDFPage object from the first page of the PDF document
- Call PDFPage.ConvertToImage() to convert PDF page to a bitmap (.bmp) file
String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-bmp-start.bmp";
// Open file and get the target page
PDFDocument doc = new PDFDocument(inputFilePath);
PDFPage page = (PDFPage)doc.GetPage(0);
// Convert page to a .BMP image
page.ConvertToImage(ImageType.BMP, outputFilePath);
PDF to Bitmap Image Options Using C#
In your C# code, you can utilize class "ImageOutputOption" to apply the converted bmp image options.
- Color: Output Bitmap image color is Monochrome, Gray, Color.
- Zoom: Set zoom value to 2F. Use more pixels to render a PDF page to bitmap.
- Resolution: Set bitmap image resolution value in the BMP file.
String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-bmp.bmp";
ImageOutputOption options = new ImageOutputOption();
options.Type = ImageType.BMP;
// Output image is Monochrome, Gray, Color.
options.Color = ColorType.Gray;
// Set zoom value to 2F. Use more pixels to render the PDF page.
options.Zoom = 2F;
// Set resolution value in the Bitmap file to 300 dpi.
options.Resolution = 300;
// Open file and get the target page
PDFDocument doc = new PDFDocument(inputFilePath);
PDFPage page = (PDFPage)doc.GetPage(0);
// Convert page to a Bitmap (.bmp) image
page.ConvertToImage(options, outputFilePath);
How to preview PDF in bitmap image using C# .NET
To preview PDF as bitmap image, you need follow the steps below and C# source code.
- In ImageOutputOption, set image type as ImageType.BMP. Set image color as ColorType.Color
- Set image Zoom to 0.25F. You need preview the first page of PDF in a smaller area.
- Set image Resolution to 300. To improve the preview image quality, you need bitmap image with larger resolution.
- Get the first page of PDF file
- Convert the PDF page to the bitmap image file
String inputFilePath = @"W:\Projects\Test-Files\file1.pdf";
String outputFilePath = @"W:\Projects\Test-Output\RasterEdge.com\pdf-convert-pdf-to-bmp-preview.bmp";
ImageOutputOption options = new ImageOutputOption();
options.Type = ImageType.BMP;
// Output image is Monochrome, Gray, Color.
options.Color = ColorType.Color;
// Set zoom value to 2F. Use less pixel and smaller area to render the first page of PDF
options.Zoom = 0.25F;
// Set resolution value in the bitmap file to 300 dpi.
options.Resolution = 300;
// Open file and get the target page
PDFDocument doc = new PDFDocument(inputFilePath);
PDFPage page = (PDFPage)doc.GetPage(0);
// Convert page to a Bitmap (.bmp) image
page.ConvertToImage(options, outputFilePath);