问题
I'm using RadPdfViewer first time in my WinForm application. I want to load pdf from url (e.g. http://10.70.0.60/PDF/sample.pdf ).
Its working with local file but not with website url of PDF file, I have mentioned in example. Kindly please suggest me how I load PDF from url in RadPdfViewer Control.Kindly let me know if any other detail required.
Thanks in advance
回答1:
I have solved the issue by my self. Hope this answer will save next person time. Below code is working fine for me.
using (WebClient client = new WebClient())
{
using (Stream ms = new MemoryStream(client.DownloadData("http://10.70.0.60/PDF/sample.pdf")))
{
MemoryStream mStream = new MemoryStream();
mStream.SetLength(ms.Length);
ms.Read(mStream.GetBuffer(), 0, (int)ms.Length);
this.radPdfViewer1.LoadDocument(mStream);
}
}
回答2:
You can set Documentsource as shows, Wroked for me
PDFViewer.DocumentSource = new PdfDocumentSource(new Uri(@"YOUR PATH");
来源:https://stackoverflow.com/questions/32368271/show-pdf-in-radpdfviewer-from-url-in-winform