Acroform fields equals null when retrieving a pdf from a url
Hi
I am having an issue whereby when I download a pdf document with acroform fields from a url, my acroform fields no longer exist. I am using C# .NET 4 framework and PDF Sharp. My code is below any ideas?
string url = "http://www.testsite.com/test.pdf";
MemoryStream stream = new MemoryStream();
using (WebClient wc = new WebClient())
{
byte[] data = wc.DownloadData(url);
stream = new MemoryStream(data);
}
PdfDocument pdf = PdfReader.Open(stream, PdfDocumentOpenMode.Modify);
PdfTextField pdfSurname = (PdfTextField)(pdf.AcroForm.Fields["surname"]);
At this point the pdf.Acroform is null so it fails. If I however put a physical path instead of stream then it works fine. I do not have an option to use a physical path as we need it to work with a content management system which uses a url to access the pdf.