PDF Viewer SDK architecture
The PDF Viewer SDK architecture consists of two interconnected npm packages, where the top package builds upon the functionality of the base package. The top package is the PDF Web Viewer package, which provides core viewer capabilities for rendering and interacting with PDF documents. At the base level is the PDF Web SDK package, which provides the necessary functionality for the PDF Web Viewer package. It also includes additional APIs and advanced features, offering a comprehensive toolkit for viewing and working with PDFs that you can implement into your application. However, PDF Viewer SDK is a ready-to-use package, while implementing the PDF Web SDK requires significant development effort compared to the full PDF Viewer SDK.
Layer | Name | npm package | API reference |
---|---|---|---|
1 | PDF Web Viewer | @pdftools/pdf-web-viewer | Viewer API reference |
2 | PDF Web SDK | @pdftools/pdf-web-sdk | PDF Web SDK API reference |
The following chart gives an overview of the most important components in the PDF Viewer SDK and the PDF Web SDK.
Refer to the following sections for more details.
PDF Web Viewer
The PDF Viewer SDK is a ready-to-use component that can easily be integrated into your application.
Learn how to get started.
Important components
There are two components which are relevant to interact with the PDF Viewer SDK.
PdfToolsViewer
The PdfToolsViewer
provides access to the initializer PdfToolsViewer.initialize();
which returns the element to attach to a page.
PdfToolsViewerApi
PdfToolsViewerApi
singleton object allows basic programmatic access to the PDF Viewer SDK, for example to programmatically open a document or control the toolbar.
PDF Web SDK
The PDF Web SDK operates on a higher level of abstraction than the PDF Viewer SDK but also provides more advanced features.
Learn how to use the PDF Web SDK, for example to view a document.
The PDF Web SDK provides several namespaces encapsulating different functionalities:
Namespaces
-
Core: Core components, functionalities and utilities used by the API.
-
Pdf: Contains logic necessary for working with PDF files, such as opening, closing, editing, or saving PDF documents. These operations provide the foundational functionality for interacting with PDF files within the API.
- Annotations: Types describing PDF annotations along with the properties related to each subtype.
- Drawing: Types related to drawing or rendering PDF content, such as drawing shapes, lines, or text on a PDF page.
- Forms: Types related to handling PDF forms, such as filling out form fields, extracting form data, or validating form entries.
- Geometry: Types related to geometric operations on PDF elements, such as calculating areas, distances, or transformations.
- Search: Types related to searching for specific content within a PDF document, such as text search or advanced search capabilities.
-
UI: Components or functions related to building a user interface (UI) for interacting with the PDF document.
Important components
There are several components which are commonly used when interacting with a PDF document.
PdfToolsWebSdk
Singleton object named pdfToolsWebSdk
is used to initialize PDF Web SDK.
Singleton instance of this object is created internally and is available for public access.
Pdf.Controller
Pdf.Controller
class is used for managing documents inside the PDF Web SDK.
It should be instantiated and reused for managing multiple documents.
Pdf.Document
Pdf.Document
class is used for representing a PDF document inside the PDF Web SDK.
Instances of this object are created internally and are available for access through Pdf.Controller
.
Pdf.Page
Pdf.Page
class is used for representing a page inside a PDF document.
Instances of this object are created internally and are available for access through Pdf.Document
property called pages
.
Pdf.AnnotationManager
Pdf.AnnotationManager
class is a central interaction hub designed to handle annotation-related operations within a document.
It serves as a bridge between user interactions and the underlying document structure, facilitating dynamic changes to annotations based on user actions.
It's available per document through Pdf.Document
property called annotations
.
UI.DocumentView
UI.DocumentView
class is used for managing the presentation and interaction with a PDF document within a container element.
It should be constructed with a reference to a container element and initialized with a Pdf.Document
in order to create an interactive preview of the PDF document.