XDoc.PDF
Features
Tech Specs
How-to C#
Pricing
C# PDF: How to PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print Work with Other SDKs Barcode Read Barcode Create OCR Twain

C# PDF to Image Converter Library
How to convert PDF page to png, gif images using C#.net. Free open source examples


Online C# Demo Codes for Converting PDF to Raster Images, .NET Graphics, and REImage in C#.NET Project










  • Best PDF converter SDK for Visual Studio .NET for converting PDF to image in C#.NET application
  • Free .NET DLLs for converting PDF to images in both .NET WinForms and ASP.NET application
  • An advanced .NET control able to batch convert PDF documents to image formats in C#.NET
  • Support exporting PDF to multiple image forms, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Professional .NET library and Visual C# source code for creating high resolution images from PDF in C#.NET class
  • Create image files including all PDF contents, like watermark and signature in .NET
  • Turn multipage PDF file into single image files respectively in .NET framework
  • Converter control easy to create thumbnails from PDF pages
  • Selection for compressing to multiple image formats
  • Cut and paste any areas in PDF pages to images
  • Supports to resize images in conversion


RasterEdge.com provides C# developers with mature PDF document processing and rendering library SDK. Our XDoc.PDF allows C# developers to perform high performance conversions from PDF document to multiple image forms. Besides raster image Jpeg, images forms like Png, Bmp, Gif, .NET Graphics, and REImage (an intermediate class) are also supported. In the following parts, we provide some examples for these PDF conversions.





C# convert single pdf file to image with image settings


        #region convert single pdf file to image with image settings(file to file)
        internal static void pdf2Image()
        {
            String inputFilePath = @"C:\demo.pdf";
            String outputDirectory = @"C:\output\";
            ImageOutputOption ops = new ImageOutputOption();
            ops.Color = ColorType.Monochrome;
            ops.Resolution = 120;
            PDFDocument doc = new PDFDocument(inputFilePath);
            doc.ConvertToImages(ImageType.PNG, ops, outputDirectory, "fileName");
        }
        #endregion

        #region convert single pdf file to image with image settings(Stream to Stream)
        internal static void pdfStream2ImageStream()
        {
            String inputFilePath = @"C:\demo.pdf";
            byte[] arr = File.ReadAllBytes(inputFilePath);
            MemoryStream inputStream = new MemoryStream(arr);
            PDFDocument doc = new PDFDocument(inputStream);

            List<Stream> outputStreams = new List<Stream>();
            for (int i = 0; i < doc.GetPageCount();i++ )
            {
                outputStreams.Add(new MemoryStream());
            }

            ImageOutputOption ops = new ImageOutputOption();
            ops.Color = ColorType.Monochrome;
            ops.Resolution = 120;
            doc.ConvertToImages(ImageType.PNG, ops, outputStreams.ToArray());
        }
        #endregion




C# convert single pdf file to png with image options


        #region convert single pdf file to png with image options
        internal static void pdf2PngImage()
        {
            String inputFilePath = @"C:\demo.pdf";
            String outputDirectory = @"C:\output\";
            ImageOutputOption ops = new ImageOutputOption();
            ops.Color = ColorType.Monochrome;
            ops.Resolution = 120;
            ops.Zoom = 1.5f;
            //To set more settings.....

            PDFDocument doc = new PDFDocument(inputFilePath);
            doc.ConvertToImages(ImageType.PNG, ops, outputDirectory, "fileName");
        }
        #endregion




C# convert single pdf file to jpeg2000 with image options


        #region convert single pdf file to Jpeg2000 with image options
        internal static void pdf2Jpeg2000Image()
        {
            String inputFilePath = @"C:\demo.pdf";
            String outputDirectory = @"C:\output\";
            ImageOutputOption ops = new ImageOutputOption();
            ops.Color = ColorType.Monochrome;
            ops.Resolution = 120;
            ops.Zoom = 1.5f;
            //To set more settings.....

            PDFDocument doc = new PDFDocument(inputFilePath);
            doc.ConvertToImages(ImageType.JPEG2000, ops, outputDirectory, "fileName");
        }
        #endregion




C# convert two or multiple pdf files to image (batch convert)


        #region convert two or multiple pdf files to image(batch files and single tread)
        internal static void pdfFilesToImage()
        {
            String inputDirectory = @"C:\input\";
            String outputDirectory = @"C:\output\";
            String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
            foreach (String filePath in files)
            {
                int startIdx = filePath.LastIndexOf("\\");
                int endIdx = filePath.LastIndexOf(".");
                String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
                PDFDocument doc = new PDFDocument(filePath);
                doc.ConvertToImages(ImageType.BMP, outputDirectory, docName);
            }
        }
        #endregion




C# combine multiple pdf files, and convert to image


        #region combine pdf files and convert to Bmp
        internal static void combineAndConvertToBmp()
        {
            String[] files = new String[] { @"C:\demo1.pdf", @"C:\demo2.pdf", @"C:\demo3.pdf" };
            Stream stream = new MemoryStream();
            PDFDocument.CombineDocument(files, stream);
            PDFDocument doc = new PDFDocument(stream);
            String outputDirectory = @"C:\output\";
            doc.ConvertToImages(ImageType.BMP, outputDirectory, "fileName");
        }
        #endregion