Load a PDF from a Remote URL in C#
To load a PDF document to your program from a URL, use the LoadFromHttp
method of the GdPicturePDF
class. It requires a Uri
class object as its parameter, which represents a URI.
To load a PDF document from a URL pointing to a demo PDF, use the following code:
using GdPicturePDF gdpicturePDF = new GdPicturePDF(); // Create a `Uri` object pointing to a PDF document. Uri pdfUri = new Uri("https://pspdfkit.com/downloads/pspdfkit-web-demo.pdf"); // Load a PDF document from URL. gdpicturePDF.LoadFromHttp(pdfUri); // Save the PDF document to file. gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF() ' Create a `Uri` object pointing to a PDF document. Dim pdfUri As Uri = New Uri("https://pspdfkit.com/downloads/pspdfkit-web-demo.pdf") ' Load a PDF document from URL. gdpicturePDF.LoadFromHttp(pdfUri) ' Save the PDF document to file. gdpicturePDF.SaveToFile("C:\temp\output.pdf") End Using