本文介绍如何使用Spire.PDF从URL地址中下载PDF文档。
C#
using System.IO;
using System.Net;
using Spire.Pdf;
namespace DownloadPdfFromUrl
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建PdfDocument对象
            PdfDocument doc = new PdfDocument();
            //创建WebClient对象
            WebClient webClient = new WebClient();
            //从URL地址下载PDF数据,并保存为流
            using (MemoryStream ms = new MemoryStream(webClient.DownloadData("http://www.e-iceblue.com/images/sample.pdf")))
            {
                //加载流
                doc.LoadFromStream(ms);
            }
            //保存为PDF文档
            doc.SaveToFile("result.pdf", FileFormat.PDF);
        }
    }
}VB.NET
Imports System.IO
Imports System.Net
Imports Spire.Pdf
Namespace DownloadPdfFromUrl
    Class Program
        Shared  Sub Main(ByVal args() As String)
            '创建PdfDocument对象 Dim doc As PdfDocument = New PdfDocument() '创建WebClient对象
            Dim webClient As WebClient = New WebClient()
 
            '从URL地址下载PDF数据,并保存为流 Imports(MemoryStream ms = New MemoryStream(webClient.DownloadData("http:'www.e-iceblue.com/images/sample.pdf"))){'加载流
                doc.LoadFromStream(ms)
            }
 
            '保存为PDF文档 doc.SaveToFile("result.pdf",FileFormat.PDF) End Sub End Class End Namespace
 



 
					



