I need to convert a pdf file into jpeg using c#.
The solution (dll library) have to be free.
I have searched a lot of information on the web but seems that the library pdfiumviewer might be helpful here. It is also available as nuget.
I have tried this code without success, because the new file in jpg format is not saved.
How to do resolve this?
using PdfiumViewer;
using System;
using System.Drawing.Imaging;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            try
            {
                using (var document = PdfDocument.Load(@"sample.pdf"))
                {
                    var image = document.Render(0, 300, 300, true);
                    image.Save(@"output.png", ImageFormat.Png);
                }
            }
            catch (Exception ex)
            {
                // handle exception here;
            }
        }
    }
}
Edit #01
protected void Page_Load(object sender, EventArgs e)
{
    if (IsPostBack)
    {
        try
        {
            using (var document = PdfDocument.Load(@"C:\\Users\\aaa\\Documents\\Visual Studio 2013\\WebSites\\GroupDocsConversion\\sample.pdf"))
            {
                var image = document.Render(0, 300, 300, true);
                image.Save(@"C:\\Users\\aaa\\Documents\\Visual Studio 2013\\WebSites\\GroupDocsConversion\\output.png", ImageFormat.Png);
            }
        }
        catch (Exception ex)
        {
            Response.Write("Error: " + ex.Message);
        }
    }
}