Hi!
So I have a program that generates a PDF and it's working great!
I'm using c# and MigraDoc to create the document.
However, when I Publish my program and move it to a test computer, instead of my development computer, the PDF loses the logo (image generates with an Image not found error instead).
I've found old (>10 years) questions to similar problems on the internet, but the solutions out there don't seem to work.
I know what the issue is, the Logo file PermitHeader.PNG isn't on my test system, which makes sense.
First of all, my logo is in the Header of the PDF, so the line I'm currently using to create the PDF is (which is working great for testing):
Code:
MigraDoc.DocumentObjectModel.Shapes.Image image = sec.Headers.Primary.AddImage(@"C:\Users\Tech\Desktop\BBB Ready to Upload\BDS\Resources\PermitHeader.PNG");
image.Height = "3.0cm";
image.Width = "16.0cm";
image.LockAspectRatio = true;
One line on Stackoverflow, was this suggestion:
Code:
Image image13 = section.AddImage(Server.MapPath("~/images/logo.png"));
But that didn't play well with the Headercode, and my IDE did not understand Server.MapPath when I tried it without the Header info.
So I went into Visual Studio, and manually included it under 'Resources' in the Publishing info:
Attachment:
publishlogo1.PNG [ 15.5 KiB | Viewed 6142 times ]
But that didn't make any difference.
How can I find the logo file and keep it in the header?
So any assistance would be appreciated.
Thank you!