Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajeesh MenothRank #118 · 18.4K reputationPosted Oct 7, 2015, 8:42 PM EDT
Priyaranjan K SRank #45 · 32.5K reputationPosted Oct 6, 2015, 9:42 PM EDT
Abhishek KumarRank #510 · 4.8K reputationPosted Oct 6, 2015, 10:01 PM EDT
Matthew Mickelson120 reputationPosted Oct 7, 2015, 5:41 PM EDT
Maiasa Jehan2 reputationPosted Oct 12, 2015, 6:33 AM EDT
The process you are describing is called rasterization. To load a PDF, you will need to a library to do that. The following forums discusses the same issue:
http://www.c-sharpcorner.com/Forums/Thread/287735/how-to-convert-pdf-file-to-image-file-in-C-Sharp-net.aspx
http://www.c-sharpcorner.com/Forums/thread/318048/how-to-convert-pdf-to-image.aspx
Jony Green103 reputationPosted Oct 19, 2015, 12:06 AM EDT
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 19, 2015, 1:23 AM EDT
using (FileStream file = File.OpenRead(@"..\path\to\pdf\file.pdf")) // in file { var bytes = new byte[file.Length]; file.Read(bytes, 0, bytes.Length); using (var pdf = new LibPdf(bytes)) { byte[] pngBytes = pdf.GetImage(0,ImageType.PNG); // image type using (var outFile = File.Create(@"..\path\to\pdf\file.png")) // out file { outFile.Write(pngBytes, 0, pngBytes.Length); } } }