0
votes

I'm writing a application in C# winforms. I'm currently trying to add an image to an existing pdf using the itextsharp library. I'm loading the pdf using a WebBrowser control and I want to allow the user to add an image to the bottom of the PDF using an OpenFileDialog.

My first thought was to pull the file path by using:

webBrowser1.Url.ToString(); 

However, When i insert that line into the FileStream I get the following error. URI formats are not supported.

 using (Stream inputFile = new FileStream(webBrowser1.Url.ToString(),FileMode.Open, FileAccess.Read, FileShare.Read))

How can I pull the path and filename from the WebBrowser control into the filestream?

Any help is appreciated.

Thank you in advance!

1

1 Answers

0
votes
  • you can use new System.Net.WebClient().DownloadData method to download that file, or
  • iTextSharp.text.Image.GetInstance method supports URLs as well.