>>Spire.PDF更新至最新版v7.5,欢迎下载体验
C#
using System.IO;using System.Net;using Spire.Pdf;namespace DownloadPdfFromUrl{ class Program { static void Main(string[] args) { //Create a PdfDocument object PdfDocument doc = new PdfDocument(); //Create a WebClient object WebClient webClient = new WebClient(); //Download data from URL and save as memory stream using (MemoryStream ms = new MemoryStream(webClient.DownloadData("http://www.e-iceblue.com/images/sample.pdf"))) { //Load the stream doc.LoadFromStream(ms); } //Save to PDF file doc.SaveToFile("result.pdf", FileFormat.PDF); } }}
VB.NET
Imports System.IOImports System.NetImports Spire.PdfNamespace DownloadPdfFromUrl Class Program Shared Sub Main(ByVal args() As String) 'Create a PdfDocument object Dim doc As PdfDocument = New PdfDocument() 'Create a WebClient object Dim webClient As WebClient = New WebClient() 'Download data from URL and save as memory stream Imports(MemoryStream ms = New MemoryStream(webClient.DownloadData("http:'www.e-iceblue.com/images/sample.pdf"))) { 'Load the stream doc.LoadFromStream(ms) } 'Save to PDF file doc.SaveToFile("result.pdf", FileFormat.PDF) End Sub End ClassEnd Namespace
运行项目后结果:

是E-iceblue官方友好合作伙伴,如果您对spire.PDF感兴趣,可以联系在线客服了解具体授权价格和使用机制。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!