I need to convert a pdf file into jpeg using c#. And the solution(library) have to be free.
I have searched a lot of information but seems that I dont get nothing cl
The library pdfiumviewer might be helpful here. It is also available as nuget.
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