how do I convert a pdf to a bitmap image in .net?

前端 未结 4 2018
悲哀的现实
悲哀的现实 2020-12-18 13:57

Looking for solution to convert a specified page of a pdf file to a bitmap image.

相关标签:
4条回答
  • 2020-12-18 14:21

    I did this in a previous project. We used ImageMagick.NET which is a wrapper of perhaps the greatest open source image manipulation API there is, ImageMagick

    http://imagemagick.codeplex.com/

    0 讨论(0)
  • 2020-12-18 14:22

    Download PDFcreator from SourceForge. It is open source, and has COM automation component, sample code in a variety of languages. You can use the PDFcreator printer driver to save in a numerous graphics formats.

    0 讨论(0)
  • 2020-12-18 14:40

    This might do the job:

    http://www.o2sol.com/pdf4net/products.htm
    
    0 讨论(0)
  • 2020-12-18 14:40

    (Disclaimer I worked on this component at Software Siglo XXI)

    If you don't want to mess with Ghostscript API and need a quick working solution to convert PDF documents to raster images (PNG, JPG, ...), you could use Super Pdf2Image Converter .NET. It's available for both 32 and 64 bit and is very cheap and effective.

    You can take a look here: http://softwaresigloxxi.com/SuperPdf2ImageConverter.html

    For instance, here's a sample code for converting:

    // Instantiate the component
    Pdf2ImageConverter p2i = new Pdf2ImageConverter(pdfPath);
    
    // Get page count of a PDF file
    int pages = p2i.GetPageCount();
    
    // Get size of any page
    int width, height;
    p2i.GetPageSize(1, out width, out height);
    
    // Convert any page of PDF to image file (preserving aspect ratio)
    p2i.GetImage(outputImagePath, pageNumber, resolution, imageFormat);
    
    // Or... convert any page of PDF to image (returns bitmap object)
    Bitmap bm = p2i.GetImage(pageNumber, resolution, width, height, imageFormat);
    
    0 讨论(0)
提交回复
热议问题