Using Vizit.API to Export to PDF with Pro Annotations

In Vizit 5.2, we've added the ability to export documents as PDFs with Pro annotations burned into the resulting document. This offers functionality similar to the "Export" button found in Pro, but allows it to be performed via a call to our Vizit.API .NET assembly.

Getting Started

If you haven't already, take a look at this article and follow the instructions in it to get started writing your custom code:

The rest of this article will explain the details of how to write the specific code to export to PDF with Pro Annotations.


The following example shows how to export a given document to PDF using the new GeneratePdf method.

SPFile file = SPContext.Current.Web.GetFile("/Documents/mydoc.docx");
bool includeAnnotations = false;
using(Stream str = Vizit.API.Pro.Export.GeneratePdf(file, includeAnnotations))
// saves stream to disk

Though it is not necessary to call this method prior to calling GeneratePdf with includeAnnotations set to true, the Export namespace has a HasAnnotations method as well. 

SPFile file = SPContext.Current.Web.GetFile("/Documents/mydoc.docx");
bool hasAnnos = Vizit.API.Pro.Export.HasAnnotations(file);

Sample Application

The attached console application will prompt for a URL to a document as well as a path to a directory to save the resulting file. It will find the corresponding SPFile and any related annotations and save a file called "Result.pdf" to the folder specified. This console application must be run as the Application Pool account user of the target file, and must be run on a Web Front End of the SharePoint Farm.

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk