So I'm using MigraDoc/PdfSharp to create a PDF document. My app is an ASP.NET Webforms project I have a png file that is in a folder that resides in my solution but when I push it to my web server it cannot find the image. The question: What should my path to the image be on the webserver??? I'm launching the document via an .aspx webpage and code looks like:
Code:
protected void Page_Load(object sender, EventArgs e)
{
Document document = CreateDocument();
// Send PDF to browser
MemoryStream stream = new MemoryStream();
renderer.PdfDocument.Save(stream, false);
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", stream.Length.ToString());
Response.BinaryWrite(stream.ToArray());
Response.Flush();
stream.Close();
Response.End();
}
public static Document CreateDocument()
{
Document document = new Document();
DefineContentSection(document);
}
static void DefineContentSection(Document document)
{
var image = section.AddImage(// What should my path to the image be on the webserver???)
}
Please Help!! I know this has to be a very simple solution.