Save pdf to jpeg using c#
The library pdfiumviewer might be helpful here. It is also available as nuget.
- Create a new winforms app. Add nuget "PdfiumViewer" to it.
- This will also add two native dll's named "pdfium.dll" in folders x86 and x64 to your project. Set "Copy to Output Directory" to "Copy Always".
Try out the following code (change paths to suit your setup).
try { using (var document = PdfiumViewer.PdfDocument.Load(@"input.pdf")) { var image = document.Render(0, 300, 300, true); image.Save(@"output.png", ImageFormat.Png); } } catch (Exception ex) { // handle exception here; }
Edit 2: Changed code to show that page index is 0 based as pointed out in comment by S.C. below
Edit 1: Updated solution
Have you tried pdfsharp?
This link might be helpful