DEV Community

GroupDocs
GroupDocs

Posted on

1

Export annotations and retrieve document pages using C# .NET Annotator API

Most recent monthly release of the .NET document annotator API allows applications developers to redeem document pages with or without the annotations, export specific annotation type and range of pages while annotating documents or images on .NET platform. Other highlights from version 18.12 of GroupDocs.Annotation for .NET are important enhancements such as adding text replacement for grouped shapes and a number of fixed issues – http://bit.ly/2T5VBeQ

Following code sample illustrates how you can obtain annotations from a JSON file and export them to a PDF document:

// Create instance of annotator.
AnnotationConfig cfg = CommonUtilities.GetConfiguration();
AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
// Get file stream
Stream manifestResourceStream = new FileStream(CommonUtilities.MapSourceFilePath(filePath), FileMode.Open, FileAccess.ReadWrite);
List<AnnotationInfo> annotations = new List<AnnotationInfo>();
Stream stream = annotator.ExportAnnotationsToDocument(manifestResourceStream,annotations, DocumentType.Pdf);
// Save result stream to file.
using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.pdf"), FileMode.Create))
{
byte[] buffer = new byte[stream.Length];
stream.Seek(0, SeekOrigin.Begin);
stream.Read(buffer, 0, buffer.Length);
fileStream.Write(buffer, 0, buffer.Length);
fileStream.Close();
}

YouTube video tutorials of the .NET API – http://bit.ly/2Sod3vn

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry πŸ•’

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more β†’

Top comments (0)

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay