How to crop pdf file as image and save in C# winform ?
How to crop pdf file as image using coordinate and save as image and then print that image ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
shi lianghongPosted Mar 20, 2015, 3:21 AM
Download a hotfix then add reference,the code :
//Instantiate an object of Spire.Pdf.PdfDocument PdfDocument doc = new PdfDocument(); //Load a PDF file doc.LoadFromFile("sample.pdf"); List
ListImage = new List
(); for (int i = 0; i < doc.Pages.Count; i++) { // Get an object of Spire.Pdf.PdfPageBase PdfPageBase page = doc.Pages[i]; // Extract images from Spire.Pdf.PdfPageBase Image[] images = page.ExtractImages(); if (images != null && images.Length > 0) { ListImage.AddRange(images); } } if (ListImage.Count > 0) { for (int i = 0; i < ListImage.Count; i++) { Image image = ListImage[i]; image.Save("image" + (i + 1).ToString() + ".png", System.Drawing.Imaging.ImageFormat.Png); } System.Diagnostics.Process.Start("image1.png"); } Refer this article:http://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/How-to-Extract-Image-From-PDF-in-C.html
Painting with Images, Drawings, and Visuals