I am trying to insert an image file that is stored on a NAS drive into a cell of a pdf created using itext7
When I go to use this code.
imagePath = "https:\\xxx.xxx.xxx.xxx:xxxx\Jobs\Jobs\Quotes\12391\System\Plan.png";
// Create a WebClient with credentials
using (WebClient client = new WebClient())
{
client.Credentials = new NetworkCredential("XXXXXX", " XXXXXXX");
img = new Image(ImageDataFactory
.Create(@"https:\\\\202.180.99.51:5006\\Jobs\\Jobs\\Quotes\\12391\\System\\Plan.png"))
.SetTextAlignment(TextAlignment.CENTER);
table.AddCell(new Cell(4, 2).Add(img));
}
I get
IOException: The filename, directory name, or volume label syntax is incorrect. : 'E:\source\AGBStone\AGBStone\AGBStone\https:\202.180.99.51:5006\Jobs\Jobs\Quotes\12391\System\Plan.png'
How do I stop it adding the local directory context and just use the URL i have entered?
This is a Web Appilcation in C# using MVC
Added HttpClientHandler.DangerousAcceptAnyServerCertificateValidator to get past this error.