Load document from URL
Leave feedback
On this page
The following example shows how to load a document using URL:
string url = "https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET/blob/master/Examples/Resources/SampleFiles/input.pdf?raw=true";
using (Annotator annotator = new Annotator(GetRemoteFile(url)))
{
AreaAnnotation area = new AreaAnnotation()
{
Box = new Rectangle(100, 100, 100, 100),
BackgroundColor = 65535,
};
annotator.Add(area);
annotator.Save("result.pdf");
}
private static Stream GetRemoteFile(string url)
{
WebRequest request = WebRequest.Create(url);
using (WebResponse response = request.GetResponse())
return GetFileStream(response);
}
private static Stream GetFileStream(WebResponse response)
{
MemoryStream fileStream = new MemoryStream();
using (Stream responseStream = response.GetResponseStream())
responseStream.CopyTo(fileStream);
fileStream.Position = 0;
return fileStream;
}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.