
Working with Document Viewer Library – supports PDF, Office and CAD formats with built‑in annotations, search and printing: A Practical Guide
The Document Viewer Library in Doconut lets you render PDF, Office, and CAD files, annotate them, search their contents, and print—all from a single .NET component. If you’re building a document‑centric portal, a legal‑tech case manager, or an engineering drawing review tool, you need a viewer that works the way your users do: instantly, securely, and without external services. Doconut delivers that experience on‑premise, inside your ASP.NET or .NET Core application, while keeping the codebase clean and the deployment footprint small.
In this practical guide we’ll walk through the core workflow of the Document Viewer Library, show you how to embed it, and demonstrate the three pillars that make it indispensable—annotation, search (including OCR), and controlled printing. By the end, you’ll have a ready‑to‑run prototype and a clear picture of how Doconut can become the backbone of any document‑heavy enterprise solution.

Windows Deployment and Free Trial Options
Doconut’s library runs on .NET 6 and is fully supported in Windows environments. Whether you host your app in Azure, AWS, or on‑premise, it delivers consistent rendering and annotation performance.
To get started quickly, Doconut offers a free trial that includes full access to the annotation engine, OCR‑enabled search, and controlled printing features. Sign up on the official site, download the trial license, and follow the integration steps below to see the library in action within minutes.
Why the Document Viewer Library Is a Game‑Changer for .NET Enterprises
Enterprises that manage contracts, engineering schematics, or employee records face three recurring challenges:
- Format diversity – PDFs, Word documents, Excel spreadsheets, and CAD drawings coexist in the same repository.
- Collaborative review – Business users need to highlight, comment, or stamp a document without leaving the application.
- Regulated access – Printing must be auditable, and searchable text must be available even for scanned images.
Doconut’s Document Viewer Library solves all three with a single, server‑side .NET component that supports 33+ file types—including DOCX, XLSX, PPTX, DWG, and DXF—out of the box. The library renders each format natively, bypassing the need for Microsoft Office, Acrobat, or external conversion services. Because rendering happens on the server, you keep sensitive data behind your firewall, which is essential for healthcare, legal, and financial environments.
The built‑in annotation engine lets you add highlights, free‑hand drawings, or stamped approvals directly to the viewer canvas. Annotations are stored as lightweight XML, making them easy to persist in a database or a version‑control system. The search plugin provides instant text lookup across any opened document; when the source is a scanned image, the OCR engine extracts searchable strings on the fly. Finally, the controlled printing feature gives you the ability to enforce page‑range limits, watermarks, or print‑audit logs, all through a single API call.
Together, these capabilities let you replace a tangled stack of third‑party viewers, JavaScript plugins, and external conversion services with a single, maintainable library that scales from a handful of users to enterprise‑wide deployments.
Embedding the Viewer: Step‑by‑Step Integration in ASP.NET Core
Below is a concise description of the steps required to integrate Doconut’s Document Viewer Library into an ASP.NET Core application:
- Register the Doconut middleware – configure the
UseDoconutmiddleware to handle the internal image‑tile endpoint (DocImage.axd). This endpoint streams rendered pages as PNG tiles, keeping the UI responsive even for large CAD files. - Load the license – provide the Doconut license file (e.g.,
DoconutLicense.xml) either as a file on disk or as a stream. The library reads the license automatically during the first viewer instance creation. - Create a viewer instance – instantiate the
Viewerclass, passing in any required services such as a distributed cache or HTTP context accessor. - Configure rendering options – set up a configuration object (for example,
PdfConfig) to control default rendering behaviour, hyperlink extraction, and raster resolution for CAD drawings. - Open a document – call the
OpenDocumentmethod with the file path (or stream) and the previously defined configuration. The method returns a secure token that the JavaScript front‑end uses to request page images, annotations, and search results.
These steps result in a server‑side viewer for Windows environments running .NET 6. The token‑based approach keeps the client lightweight: the front‑end only needs to reference the Doconut viewer component hosted at https://doconut.app.
Built‑in Annotations for Real‑Time Review Workflows
Annotations turn a passive viewer into a collaborative workspace. Doconut’s annotation manager operates on a per‑page basis and stores everything as XML, which means you can easily version, audit, or merge changes in a database.
Typical annotation workflow
- Retrieve the annotation manager for the current page by calling the viewer’s
GetAnnotationManagermethod, supplying the page dimensions. - Create an annotation object (e.g., an image stamp, highlight, or free‑hand drawing) and set its position, size, and visual properties.
- Add the annotation to the manager.
- Persist the annotation XML using
GetAnnotationXmland store it in your data store. - When the document is re‑opened, load the saved XML back into the viewer with
LoadAnnotationXML.
Enterprise scenarios
- Legal Tech – Lawyers drop a “Signature” stamp onto a contract, then submit the XML to a case‑management service for audit.
- Engineering Review – Designers add red‑line drawings directly on a DWG page; the annotation XML is stored alongside the revision history.
- HR & Recruitment – Recruiters highlight key sections of a resume, add comments, and push the annotated version to the candidate’s profile.
Because the annotation data lives on the server, you maintain full control over who can edit, who can view, and who can print. The API is deliberately thin: you only need the manager retrieval, add, and load methods, and you can build additional UI features (undo/redo, custom tools) on top without pulling in extra dependencies.
Instant Search and OCR: Making Every Document Findable
A document repository is only valuable when users can locate the information they need in seconds. Doconut’s search plugin offers instant, full‑text search across any opened file. For raster‑only PDFs or scanned CAD drawings, the built‑in OCR engine extracts text on demand, turning images into searchable content without a separate preprocessing step.
Typical search workflow
- Call the viewer’s search method (exposed by the Search Plugin) with the desired keyword.
- Receive a list of matching page numbers and the coordinates of each match.
- For each match, obtain the page’s annotation manager and add a temporary highlight annotation to show the user where the term appears.
When a user opens a scanned PDF of an invoice, the viewer automatically runs OCR on each page as it is rendered. The extracted text is indexed in memory, making subsequent searches instantaneous. This approach eliminates the need for a separate OCR service, reduces latency, and guarantees that the searchable text never leaves your secure environment.
Enterprise benefits
- Customer portals can surface relevant clauses from a contract with a single keystroke.
- Financial reporting tools let analysts locate a line item across dozens of scanned statements.
- Healthcare record systems become searchable for medication names inside scanned physician notes, improving patient safety.
All of this is achieved with zero third‑party dependencies, keeping the stack lightweight and the compliance surface small.
Controlled Printing from the Viewer – Security Meets Convenience
Printing is often the weakest link in document security. Doconut’s controlled printing feature gives you the authority to decide what, when, and how a document can be printed, while still providing a familiar browser‑based print dialog.
Typical printing workflow
- Define a
PrintConfigobject that specifies options such as page‑range limits, watermarks, and whether to log each print request. - Pass the configuration together with the document token to the viewer’s
Printmethod. - The viewer renders the selected pages on the server, applies any watermarks, and streams the printable PDF back to the client’s browser.
- An audit entry is created automatically, allowing administrators to track who printed what and when.
By handling printing on the server, Doconut ensures that the original document never leaves your protected environment, and you retain full visibility into print activity—a critical requirement for regulated industries.
Conclusion
Doconut’s Document Viewer Library gives .NET teams a single, secure, and feature‑rich component for rendering PDFs, Office files, and CAD drawings, enriching them with annotations, OCR‑enabled search, and controlled printing. With server‑side processing, built‑in conversion, and support for over 33 file formats, you can eliminate costly third‑party dependencies and keep sensitive data under your direct control.
Ready to modernise your enterprise document workflow? Start your free trial of Doconut today, download the library, and follow the integration steps outlined above to bring powerful viewing, annotation, and search capabilities to your .NET application in minutes.