Docs / Get started

Markdown

Get started with .NET

The engine for C#, on .NET Framework 4.6.1+, .NET 5–10, Mono and Unity.

Install

dotnet add package DocuVerse

The package targets netstandard2.0 and carries the native engine for each runtime in runtimes/<rid>/native/.

A licence key is needed: without one, nothing opens. Make a free account for trial keys (everything works, with a watermark), or choose a plan on the pricing page. Each key is for one SDK, made in your account under Keys: a Web SDK key for the viewer in websites (licenseKey), a Server SDK key for Node.js (setLicenseKey(key)) and .NET (License.SetKey(key)), a Mobile SDK key for apps. A key used with another SDK is refused with an error that says which key to make.

Annotate and save a PDF

using DocuVerse; using var doc = PdfDocument.Open("in.pdf");        // or Open(bytes, password)Console.WriteLine($"{doc.PageCount} pages: {doc.PageText(0)}"); int id = doc.AddAnnotation(0, "{\"type\":\"Square\",\"rect\":[72,600,272,700],\"color\":\"#ff0000\"}");doc.UpdateAnnotation(id, "{\"contents\":\"Please review\"}"); File.WriteAllBytes("page1.png", doc.RenderPagePng(0, 2.0));doc.Save("out.pdf", incremental: true);

Edit a Word document

using var word = WordDocument.Open("report.docx");word.Command("{\"cmd\":\"insert\",\"text\":\"Hello \"}");      // JSON commands, JSON state backword.Command("{\"cmd\":\"key\",\"key\":\"Home\",\"shift\":true}");word.Command("{\"cmd\":\"format\",\"bold\":\"toggle\"}");File.WriteAllBytes("report-edited.docx", word.Save());
On the server, DocuVerse finds installed fonts by itself. See Fonts for the browser viewer.