简体   繁体   中英

How to convert pdf page into image in C# using Cyotek.GhostScript.PdfConversion

i want to convert pdf page into image in C# using iTextSharp how can i do that

here is my method where i am getting all pages of pdf

    public void ExtractImage()
    {
          PdfReader pdf = new PdfReader(@"C:\Users\Vipin\Desktop\slide.pdf");

          int pageNumber = pdf.NumberOfPages;
          for (int i = 1; i < pageNumber; i++)
          {
          }
   }

You can use Cyotek Ghostscript to do that. We first split our PDF files up into single pages. We use this:

using Cyotek.GhostScript.PdfConversion;

private Bitmap PdfToBitmap(String path)
{
    Pdf2Image pdfimage = new Pdf2Image();
    pdfimage.Settings.Dpi = 300;
    pdfimage.PdfFileName = path;
    Bitmap bitmap = pdfimage.GetImage();
    return bitmap;
}

http://www.cyotek.com/downloads/view/Cyotek.GhostScript.PdfConversion.zip/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM