
Syncfusion Angular Pdf Viewer
- 1 installs
- 1 repo stars
- Updated July 6, 2026
- syncfusion/pdf-viewer-sdk-skills
Generates Angular TypeScript and CSS code to embed and configure the Syncfusion PdfViewerComponent for loading and interacting with PDF documents.
About
Generates Angular code that embeds the Syncfusion PdfViewerComponent from @syncfusion/ej2-angular-pdfviewer to load and display PDF documents. A developer uses it when adding a configured PDF viewer to an Angular application.
- Targets the @syncfusion/ej2-angular-pdfviewer package
- Enforces a workspace-detection then reference-file workflow, generating only documented APIs
Syncfusion Angular Pdf Viewer by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,914 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/syncfusion/pdf-viewer-sdk-skills --skill syncfusion-angular-pdf-viewerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 1 |
| Last updated | July 6, 2026 |
| Repository | syncfusion/pdf-viewer-sdk-skills ↗ |
What it does
Generates Angular TypeScript and CSS code to embed and configure the Syncfusion PdfViewerComponent for loading and interacting with PDF documents.
Files
Syncfusion Angular PDF Viewer UI Sample Generator
Target package: @syncfusion/ej2-angular-pdfviewer
Mandatory 3-Step workflow (Strict Enforcement)
EVERY query MUST follow these steps sequentially:
STEP 1: Workspace Detection ? STEP 2: Read Reference File ? STEP 3: Generate CodeBlocking Rules
1. NO code generation until Steps 1 & 2 are complete 2. NO assumptions - Always verify workspace AND read reference files first 3. NO undocumented APIs - Use ONLY APIs from reference files
Violation = STOP and restart with proper protocol
---
Mandatory Workflow
STEP 1: Workspace Detection (REQUIRED - DO THIS FIRST)
Execute these tools:
1. file_search: **/{package.json,angular.json,tsconfig.json}
2. list_dir: src/app/
3. read_file: package.json (if exists)Report to user:
?? STEP 1 COMPLETE:
- Workspace: [Empty / Angular X.X project detected]
- Files found: [list]
- Decision: [Create new / Use existing]STEP 2: Read Reference File (REQUIRED - DO THIS SECOND)
Execute these steps:
1. Match user query to Reference File Routing Guide below
2. Use read_file on: references\[filename].md
3. Extract ALL steps/APIs from reference fileReport to user:
?? STEP 2 COMPLETE:
- Reference file: [filename.md]
- Steps found: [list sequential steps]
- APIs validated: [list properties/methods used]STEP 3: Generate Code (EXECUTE ONLY AFTER STEPS 1 & 2)
Validation checklist:
- [ ] Every API cross-referenced against reference file
- [ ] No invented/assumed properties used
- [ ] Angular patterns followed (component bindings, lifecycle hooks)
- [ ] If API not in reference file ? DELETE it
If feature not in reference file:
? FEATURE NOT SUPPORTED
The requested [feature/API] is not documented.
Available alternatives: [list from reference files]---
Reference File Routing Guide
Core Setup
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "basic", "create sample", "getting started", "load PDF" | getting-started.md | Minimal PDFViewer setup |
| "configuration", "server settings", "locale" | general-properties.md | Core viewer properties |
| "disable", "hide features", "enable/disable", "read-only" | enable-properties.md | Feature toggles |
Navigation
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "page navigation", "next/previous page", "go to page" | page-navigation.md | Page controls |
| "bookmarks", "table of contents", "TOC", "outline" | bookmark-navigation.md | Bookmark navigation (use ViewChild) |
| "hyperlinks", "external links", "URL navigation" | hyperlink-navigation.md | Link handling |
| "thumbnails", "preview pages", "thumbnail panel" | thumbnail-navigation.md | Thumbnail panel |
Viewing & Interaction
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "zoom", "magnification", "fit to page", "scale" | magnification.md | Zoom controls |
| "text selection", "panning", "scroll mode" | interaction-mode.md | Interaction modes |
| "select text", "copy text" | text-selection.md | Text selection |
| "search", "find in PDF", "highlight search" | text-search.md | Search functionality |
Toolbar & Context Menu
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "customize toolbar", "hide toolbar items", "remove buttons" | toolbar-settings.md | Toolbar configuration |
| "show/hide toolbar dynamically", "toggle toolbar" | toolbar-methods.md | Programmatic toolbar control |
| "right-click menu", "context menu", "custom menu" | contextmenu.md | Context menu |
Annotations
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "annotation colors", "annotation styles", "customize annotations" | annotation-settings.md | Annotation appearance |
| "annotation events", "when annotation added", "annotation callbacks" | annotation-events.md | Annotation lifecycle |
| "annotation labels", "shape labels", "measurement labels" | shape-label-settings.md | Label customization |
| "ink annotation", "freehand drawing", "signature", "sketch", "handwritten notes" | ink-annotation.md | Ink annotations |
| "redaction", "redact content", "black out text" | redaction-annotation.md | Redaction annotations |
Forms
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "form field defaults", "form field styles" | form-field-settings.md | Form field config |
| "form field events", "field changes", "validation" | form-field-events.md | Form field events |
Document Actions
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "download PDF", "save PDF", "export" | download.md | Download functionality |
| "print PDF", "print document" | print.md | Print functionality |
| "reorder pages", "rotate pages", "add/remove pages" | organize-pages.md | Page manipulation |
Advanced
| User Query Keywords | Reference File | Purpose |
|---|---|---|
| "load programmatically", "API methods", "extract text" | api-methods.md | Programmatic control |
| "event list", "all events", "event reference" | events.md | Complete event list |
---
Toolbar Item Name Validation (CRITICAL)
When generating toolbar configurations: 1. ALWAYS read `toolbar-settings.md` first 2. Use ONLY names from these sections:
- "Available Primary Toolbar Items"
- "Available Annotation Toolbar Items"
- "Available Form Designer Items"
3. Character-by-character validation required - No typos allowed
Common mistakes to prevent:
- ?
AnotatetionEditTool? ?AnnotationEditTool - ?
CalibrationOption? ?CalibrateTool - ?
ShapeAnnotationOption? ?ShapeTool
---
Quick Start Example
Add the Angular PDF Viewer by using <ejs-pdfviewer> selector in the template section of the src/app/app.ts file to render the PDF Viewer component.
import { Component, OnInit } from '@angular/core';
import { PdfViewerModule, LinkAnnotationService, BookmarkViewService,
MagnificationService, ThumbnailViewService, ToolbarService,
NavigationService, TextSearchService, TextSelectionService,
PrintService, FormDesignerService, FormFieldsService,
AnnotationService, PageOrganizerService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-root',
// specifies the template string for the PDF Viewer component
template: `<div class="content-wrapper">
<ejs-pdfviewer id="pdfViewer"
[documentPath]='document'
[resourceUrl]='resource'
style="height:640px;display:block">
</ejs-pdfviewer>
</div>`,
imports: [ PdfViewerModule ],
providers: [ LinkAnnotationService, BookmarkViewService, MagnificationService,
ThumbnailViewService, ToolbarService, NavigationService,
TextSearchService, TextSelectionService, PrintService,
AnnotationService, FormDesignerService, FormFieldsService, PageOrganizerService]
})
export class AppComponent implements OnInit {
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public resource: string = window.location.origin + "/assets/ej2-pdfviewer-lib";
ngOnInit(): void {
}
}Settings Configurations
Rule 1: Simple Settings (1-3 properties) ? Inline
public annotationSelection = {
selectionBorderColor: 'blue',
resizerSize: 8
};Rule 2: Complex Settings (4+ properties or enums) ? Import enums
import { AnnotationResizerLocation, CursorType } from '@syncfusion/ej2-angular-pdfviewer';
public annotationSelection = {
selectionBorderColor: '#0000ff',
resizerSize: 8,
resizerLocation: AnnotationResizerLocation.Corners | AnnotationResizerLocation.Edges,
resizerCursorType: CursorType.grab
};---
Protocol Violation Handling
| Violation | Fix |
|---|---|
| Skipped Step 1 | Re-run: Use file_search and list_dir first |
| Skipped Step 2 | Re-run: Use read_file on reference file |
| Used undocumented API | Delete it, check reference for alternatives |
| Didn't report findings | Report: "I checked X, found Y, now doing Z" |
If user calls out violation: IMMEDIATELY acknowledge, apologize, and restart with proper protocol.
---
Enforcement Checklist
Before generating code, verify:
- [ ] Step 1 executed (workspace detection) and reported
- [ ] Step 2 executed (reference file read) and reported
- [ ] Every API validated against reference file
- [ ] No undocumented APIs used
- [ ] Angular patterns followed
Reference files are SOURCE OF TRUTH - everything must trace back to them.
Syncfusion Angular PDF Viewer — Skill
Overview
The syncfusion-angular-pdf-viewer skill enables AI-assisted code generation for the Syncfusion Angular PDF Viewer (`PdfViewerComponent`). It produces minimal, copy-pasteable TS/JS code to embed, configure, and interact with PDF documents inside Angular applications.
---
Compatibility
Starting from Angular 19, standalone components are the default. Moreover in Angular 19 and below, it uses app.component.ts, app.component.html, app.component.css etc. In Angular 20+, the CLI generates a simpler structure with src/app/app.ts, app.html, and app.css (no .component. suffixes).
---
Skill Structure
syncfusion-angular-pdfviewer/
├── SKILL.md # Skill rules, routing, and code generation guidelines
├── README.md # This file
└── references/
├── getting-started.md # Minimal setup & initialization template
├── general-properties.md # Core viewer properties (documentPath, height, locale, etc.)
├── enable-properties.md # Feature toggle properties (enableToolbar, enableAnnotation, etc.)
├── toolbar-settings.md # Toolbar visibility and item customization
├── toolbar-methods.md # Programmatic toolbar show/hide at runtime
├── contextmenu.md # Right-click context menu customization
├── page-navigation.md # Navigate between pages programmatically
├── bookmark-navigation.md # Bookmark panel and navigation
├── thumbnail-navigation.md # Thumbnail panel and page previews
├── hyperlink-navigation.md # Hyperlink and external link behavior
├── magnification.md # Zoom levels, zoom modes, fit-to-page/width
├── interaction-mode.md # Selection mode vs. panning mode
├── text-selection.md # Enable text select, copy, and selection events
├── text-search.md # Find text in PDF with search options
├── annotation-settings.md # Annotation appearance (colors, opacity, styles)
├── annotation-events.md # Annotation lifecycle events (add, delete, resize, etc.)
├── shape-label-settings.md # Shape/measure annotation label customization
├── redaction-annotation.md # Redaction: create, configure, and apply
├── form-field-settings.md # Form field default properties
├── form-field-events.md # Form field interaction events (focus, blur, change)
├── download.md # PDF download configuration
├── print.md # PDF print configuration
├── organize-pages.md # Reorder, rotate, insert, remove, merge pages
├── api-methods.md # Programmatic API (load, export, undo/redo, extract text)
└── events.md # Complete PDF Viewer event reference---
Quick Start
1. Install the latest Angular CLI
npm install -g @angular/cli2. Create a Angular Project
ng new my-app
cd my-app3. Install the Package
npm install @syncfusion/ej2-angular-pdfviewer --save4. Copy WebAssembly Resources
cp -R ./node_modules/@syncfusion/ej2-pdfviewer/dist/ej2-pdfviewer-lib src/assets/ej2-pdfviewer-lib5. Add CSS Imports (src/index.css)
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-navigations/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-pdfviewer/styles/material.css';
@import '../node_modules/@syncfusion/ej2-notifications/styles/material.css';6. Basic Component (src/app/app.ts)
import { Component, OnInit } from '@angular/core';
import { PdfViewerModule, LinkAnnotationService, BookmarkViewService,
MagnificationService, ThumbnailViewService, ToolbarService,
NavigationService, TextSearchService, TextSelectionService,
PrintService, FormDesignerService, FormFieldsService,
AnnotationService, PageOrganizerService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-root',
// specifies the template string for the PDF Viewer component
template: `<div class="content-wrapper">
<ejs-pdfviewer id="pdfViewer"
[documentPath]='document'
[resourceUrl]='resource'
style="height:640px;display:block">
</ejs-pdfviewer>
</div>`,
imports: [ PdfViewerModule ],
providers: [ LinkAnnotationService, BookmarkViewService, MagnificationService,
ThumbnailViewService, ToolbarService, NavigationService,
TextSearchService, TextSelectionService, PrintService,
AnnotationService, FormDesignerService, FormFieldsService, PageOrganizerService]
})
export class App implements OnInit {
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public resource: string = "https://cdn.syncfusion.com/ej2/26.2.11/dist/ej2-pdfviewer-lib";
ngOnInit(): void {
}
}7. Run the App
ng serve --open---
Available Services
Inject only the services your use-case requires to keep the bundle lean.
| Service | Purpose |
|---|---|
Toolbar | Main toolbar with document controls |
Magnification | Zoom and magnification |
Navigation | Page navigation controls |
Annotation | All annotation capabilities |
LinkAnnotation | Clickable hyperlinks in PDFs |
BookmarkView | Bookmark/outline panel |
ThumbnailView | Page thumbnail panel |
Print | Print functionality |
TextSelection | Select and copy text |
TextSearch | Find text in document |
FormFields | Interactive form field support |
FormDesigner | Create and edit form fields |
---
Reference File Routing
Use the table below to find the correct reference file for any feature request.
Core Setup
| Reference File | Use When … |
|---|---|
getting-started.md | Getting started, minimal setup, loading a PDF |
general-properties.md | Configuring server URL, locale, width/height, resourceUrl |
enable-properties.md | Enabling/disabling toolbar, annotations, forms, download, print |
Navigation
| Reference File | Use When … |
|---|---|
page-navigation.md | Go to first/last/next/previous page or a specific page number |
bookmark-navigation.md | Navigate via bookmarks or open/close bookmark panel |
thumbnail-navigation.md | Display or navigate with the thumbnail panel |
hyperlink-navigation.md | Configure clickable hyperlinks and external URL behavior |
Viewing & Interaction
| Reference File | Use When … |
|---|---|
magnification.md | Zoom controls, fit-to-page, fit-to-width, zoom levels |
interaction-mode.md | Switch between text-selection and panning modes |
text-selection.md | Enable/handle text selection and copy events |
text-search.md | Implement in-document text search and result highlighting |
Toolbar & Context Menu
| Reference File | Use When … |
|---|---|
toolbar-settings.md | Customize toolbar items, visibility, and tooltip behavior |
toolbar-methods.md | Show/hide toolbars programmatically at runtime |
contextmenu.md | Add, remove, or handle right-click context menu items |
Annotations
| Reference File | Use When … |
|---|---|
annotation-settings.md | Set default annotation colors, opacity, author, styles |
annotation-events.md | Handle annotation add/delete/move/resize/select events |
shape-label-settings.md | Customize labels on shape and measure annotations |
redaction-annotation.md | Create and apply redactions to remove sensitive content |
Forms
| Reference File | Use When … |
|---|---|
form-field-settings.md | Configure default properties for text, checkbox, radio, dropdown, signature fields |
form-field-events.md | Handle form field focus, blur, and value-change events |
Document Actions
| Reference File | Use When … |
|---|---|
download.md | Enable download and set custom filenames |
print.md | Configure and trigger printing |
organize-pages.md | Reorder, rotate, insert, remove, or merge pages |
Advanced / API
| Reference File | Use When … |
|---|---|
api-methods.md | Load documents programmatically, export form data, undo/redo, extract text |
events.md | Browse all available PDF Viewer events and their signatures |
---
Annotation Events
Description: Annotation events in Angular PDF Viewer are triggered when annotations are added, removed, moved, resized, selected, or modified on PDF document pages. These events enable custom workflows and UI updates based on annotation interactions.
Table of Contents
- When to Use Annotation Events
- Choosing the Right Event
- How to Use Annotation Events
- Annotation Events Reference
- Annotation Object Reference
- Common Use Cases
---
When to Use Annotation Events
Guide users to implement annotation events when they need to:
- Track user interactions - Log annotation changes for audit trails, analytics, or compliance
- Implement custom workflows - Trigger actions when annotations are added, modified, or removed
- Build custom UI - Update properties panels, toolbars, or status displays based on annotation state
- Enforce business rules - Validate or restrict annotation placement, modifications, or deletions
- Synchronize data - Save annotation changes to a backend, sync across users, or update related data
- Enhance UX - Provide real-time feedback, tooltips, or guided workflows during annotation
Why events matter: The PDF Viewer fires events at key moments in the annotation lifecycle. By handling these events, users can extend the viewer's behavior without modifying its internals.
---
Choosing the Right Event
Help users select the appropriate event based on their goal:
| User Goal | Recommended Event | Why This Event |
|---|---|---|
| Detect when user creates a new annotation | annotationAdd | Fires immediately after annotation is added, providing full annotation object |
| Prevent annotation on specific pages | beforeAddFreeText | Only "before" event that supports cancellation via args.cancel = true |
| Track annotation movements | annotationMove | Fires after move completes with updated position; use annotationMoving for real-time tracking |
| Update UI when annotation is selected | annotationSelect | Provides selected annotation details and supports multi-select detection |
| Log property changes for audit | annotationPropertiesChange | Includes flags (isColorChanged, isThicknessChanged) to identify what changed |
| Detect annotation deletion | annotationRemove | Fires when annotation is removed, providing the removed annotation object |
| Show tooltips on hover | annotationMouseover / annotationMouseLeave | Mouse events provide coordinates and annotation context |
| Track signature additions | addSignature | Specific event for signature objects (not generic annotations) |
| Handle bulk operations | annotationSelect with isMultiSelect check | Use annotationCollection array to process multiple annotations |
Decision Pattern: If user needs to prevent an action → use beforeAdd* events with args.cancel. If user needs to react after an action → use lifecycle events like annotationAdd, annotationMove, annotationRemove.
---
How to Use Annotation Events
Annotation events allow you to respond to user interactions with annotations in the PDF Viewer. Each event provides detailed information about the annotation and the action performed.
Basic Event Handler Pattern
export class AppComponent {
@ViewChild('pdfviewer')
public pdfviewerControl: PdfViewerComponent;
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
eventHandler(args: any): void {
console.log('Event triggered:', args);
}
}<ejs-pdfviewer
#pdfviewer
[documentPath]="document"
(annotationAdd)="eventHandler($event)"
style="height:640px;display:block">
</ejs-pdfviewer>---
Annotation Events Reference
The following table lists all available annotation events. Use this reference to identify event names, understand what triggers them, and access the data they provide.
How to read this table:
- Event Name: The event binding name to use on
<ejs-pdfviewer> - Description: When the event fires during the annotation lifecycle
- Args: The TypeScript type of the event arguments object
- Args Properties: Key properties available in the event handler, including data types
Usage tip: Most events provide annotationId, pageIndex, and the complete annotation object. Use the annotation object to access all properties listed in the Annotation Object Reference section below.
| Event Name | Description | Args | Args Properties |
|---|---|---|---|
| annotationAdd | Fires when an annotation is added to a page in the PDF document. | AnnotationAddEventArgs | annotationId - (string) - Unique identifier of the annotation. pageIndex - (number) - Page index where the annotation was added. annotation - (object) - Annotation object containing all properties. annotationAddMode - (string) - Mode of annotation addition (UI Drawn, Programmatic, etc.). |
| annotationDoubleClick | Fires when an annotation is double-clicked. | AnnotationDoubleClickEventArgs | annotationId - (string) - ID of the annotation that was double-clicked. pageIndex - (number) - Page index where the annotation was double-clicked. annotation - (object) - Annotation object containing all properties. |
| annotationMouseLeave | Fires when the mouse pointer moves away from an annotation object. | AnnotationMouseLeaveEventArgs | annotationId - (string) - ID of the annotation. pageIndex - (number) - Page index of the annotation. |
| annotationMouseover | Fires when the mouse pointer moves over an annotation object. | AnnotationMouseOverEventArgs | annotationId - (string) - ID of the annotation. pageIndex - (number) - Page index of the annotation. X - (number) - X coordinate of mouse position. Y - (number) - Y coordinate of mouse position. |
| annotationMove | Fires when an annotation is moved on a page in the PDF document. | AnnotationMoveEventArgs | annotationId - (string) - ID of the annotation that was moved. pageIndex - (number) - Page index where the annotation was moved. annotation - (object) - Updated annotation object. |
| annotationMoving | Fires while an annotation is being moved. | AnnotationMovingEventArgs | annotationId - (string) - ID of the annotation being moved. pageIndex - (number) - Page index. currentPosition - (object) - Current position during movement. |
| annotationPropertiesChange | Fires when the properties of an annotation are modified on a PDF page. | AnnotationPropertiesChangeEventArgs | annotationId - (string) - ID of the annotation. pageIndex - (number) - Page index. isColorChanged - (boolean) - Indicates if color was changed. isThicknessChanged - (boolean) - Indicates if thickness was changed. isOpacityChanged - (boolean) - Indicates if opacity was changed. annotation - (object) - Updated annotation object. |
| annotationRemove | Fires when an annotation is removed from a page in the PDF document. | AnnotationRemoveEventArgs | annotationId - (string) - ID of the removed annotation. pageIndex - (number) - Page index where the annotation was removed. annotation - (object) - Annotation object that was removed. |
| annotationResize | Fires when an annotation is resized on a page in the PDF document. | AnnotationResizeEventArgs | annotationId - (string) - ID of the resized annotation. pageIndex - (number) - Page index. annotation - (object) - Updated annotation object with new bounds. |
| annotationSelect | Fires when an annotation is selected on a page in the PDF document. | AnnotationSelectEventArgs | annotationId - (string) - ID of the selected annotation. pageIndex - (number) - Page index. annotation - (object) - Selected annotation object. annotationCollection - (array) - Collection of overlapping annotations. isMultiSelect - (boolean) - Indicates if multiple annotations are selected. |
| annotationUnselect | Fires when an annotation is unselected on a page in the PDF document. | AnnotationUnSelectEventArgs | annotationId - (string) - ID of the unselected annotation. pageIndex - (number) - Page index where the annotation was unselected. |
| beforeAddFreeText | Fires before a free-text annotation is added. | BeforeAddFreeTextEventArgs | pageIndex - (number) - Page index where the annotation will be added. cancel - (boolean) - Set to true to prevent the annotation from being added. |
| addSignature | Fires when a signature is added to a page of a PDF document. | AddSignatureEventArgs | pageIndex - (number) - Page index where the signature was added. signature - (object) - Signature object with properties like bounds, opacity, strokeColor, thickness. |
| removeSignature | Fires when the signature is removed from the page of a PDF document. | RemoveSignatureEventArgs | pageIndex - (number) - Page index where the signature was removed. signature - (object) - Signature object that was removed. |
| resizeSignature | Fires when the signature is resized on a page in the PDF document. | ResizeSignatureEventArgs | pageIndex - (number) - Page index. signature - (object) - Updated signature object with new bounds. previousPosition - (object) - Previous position before resize. currentPosition - (object) - Current position after resize. |
| signaturePropertiesChange | Fires when the properties of a signature are changed on a page in the PDF document. | SignaturePropertiesChangeEventArgs | pageIndex - (number) - Page index. isThicknessChanged - (boolean) - Indicates if thickness was changed. isOpacityChanged - (boolean) - Indicates if opacity was changed. isStrokeColorChanged - (boolean) - Indicates if stroke color was changed. signature - (object) - Updated signature object. |
| signatureSelect | Fires when a signature is selected on a page in the PDF document. | SignatureSelectEventArgs | pageIndex - (number) - Page index where the signature was selected. signature - (object) - Selected signature object. |
| signatureUnselect | Fires when a signature is unselected on a page in the PDF document. | SignatureUnSelectEventArgs | pageIndex - (number) - Page index where the signature was unselected. |
---
Annotation Object Reference
Purpose: When event handlers receive an annotation object in their arguments, use this reference to understand which properties are available and how to access them.
When to consult this reference:
- User needs to read annotation properties (color, opacity, position, type)
- User wants to display annotation details in a custom UI
- User needs to filter or validate annotations based on specific properties
- User is building custom logic based on annotation state
Usage pattern: Access properties directly from the args.annotation object:
onAnnotationSelect(args: any): void {
const annotation = args.annotation;
console.log('Type:', annotation.type);
if (annotation.type === 'FreeText') {
console.log('Content:', annotation.content);
}
}Property availability: Not all properties are present on all annotation types. Check type or subType to determine which type-specific properties are available.
Core Properties (Available on All Annotation Types)
| Property Name | Description | Data type |
|---|---|---|
| annotationId | Unique identifier for the annotation. | string |
| id | Internal identifier for the annotation (e.g., ink0, free_text0). | string |
| randomId | Random identifier for certain annotation types like stamps. | string |
| author | Author of the annotation. | string |
| pageNumber / pageIndex | Page number/index where the annotation is located. | number |
| type | Type of annotation (TextMarkup, FreeText, Ink, Measure, Stamp, StickyNotes, etc.). | string |
| subType | Subtype of the annotation (Highlight, Underline, Strikethrough, Squiggly, Area, etc.). | string |
| shapeAnnotationType | Shape type of the annotation (textMarkup, Polygon, Ink, FreeText, Stamp, sticky, etc.). | string |
| subject | Subject or title of the annotation. | string |
| note / notes | Note/comment associated with the annotation. | string |
| color | Color of the annotation (hex value or rgba). | string |
| strokeColor | Stroke/border color of the annotation. | string |
| fillColor | Fill color of the annotation (hex or rgba). | string |
| opacity | Opacity value of the annotation (0-1). | number |
| thickness | Thickness/width of the stroke. | number |
| bounds | Boundary object with x, y, width, height, left, top, right values. | object |
| rect | Rectangle object with bottom, left, right, top, height, width values. | object |
| width / height / left / top | Direct dimension and position properties. | number |
| customData | Custom data associated with the annotation. | object |
| modifiedDate | Last modified date of the annotation. | string |
| creationDate | Creation date of the annotation. | string |
| annotationAddMode | Mode of annotation addition (UI Drawn Annotation, Programmatic, etc.). | string |
| isLocked | Whether the annotation is locked from editing. | boolean |
| isCommentLock | Whether comments on the annotation are locked. | boolean |
| isPrint | Whether the annotation is included in print. | boolean |
| isMultiSelect | Whether annotation spans multiple pages. | boolean |
| isAnnotationRotated | Whether the annotation is rotated. | boolean |
| rotateAngle | Rotation angle of the annotation (RotateAngle0, RotateAngle90, etc. or numeric). | string \ |
| comments | Array of comment objects for this annotation. | array |
| review | Review status information. | object |
| annotationSettings | Annotation settings with isLock, isPrint, min/max height/width. | object |
| annotationSelectorSettings | Settings for the annotation selector (resizer, border, etc.). | object |
| annotationCollection | Collection of overlapping annotations. | array |
| allowedInteractions | Array of allowed interactions for locked annotations. | array |
| vertexPoints | Array of vertex points for polygon-type annotations. | array |
| rectangleDifference | Difference rectangle data. | array |
Type-Specific Properties
Different annotation types expose additional properties. Check the type property to determine which properties are available.
| Property Name | Description | Data type |
|---|---|---|
| TextMarkup Properties | Available when type === "TextMarkup" | |
| textMarkupContent | The text content that was marked up. | string |
| textMarkupStartIndex | Start index of the marked text. | number |
| textMarkupEndIndex | End index of the marked text. | number |
| Measure/Shape Properties | Available when type === "Shape" or measurement annotations | |
| caption | Whether caption is enabled for the annotation. | boolean |
| captionPosition | Position of the caption (Top, Bottom, Left, Right). | string |
| enableShapeLabel | Whether shape label is enabled. | boolean |
| labelContent | Content of the label. | string |
| labelBounds | Boundary of the label. | object |
| labelBorderColor | Border color of the label. | string |
| labelFillColor | Fill color of the label. | string |
| labelSettings | Label settings object with borderColor, fillColor, fontColor, fontSize, etc. | object |
| fontColor | Font color for text. | string |
| fontSize | Font size for text. | number |
| indent | Indent value for measure annotations. | string |
| leaderLength | Length of the leader line. | number |
| leaderLineExtension | Extension of the leader line. | number |
| leaderLineOffset | Offset of the leader line. | number |
| lineHeadStart | Style of line head start (Arrow, Closed, Diamond, None, etc.). | string |
| lineHeadEnd | Style of line head end. | string |
| cloudIntensity | Intensity of cloud shape. | number |
| isCloudShape | Whether the shape is a cloud shape. | boolean |
| calibrate | Calibration data with ratio, x, distance, area information. | object |
| FreeText Properties | Available when type === "FreeText" | |
| content | Text content of the free text annotation. | string |
| dynamicText | Dynamic text of the annotation. | string |
| fontFamily | Font family for the text. | string |
| textAlign | Text alignment (Left, Center, Right, Justify). | string |
| font | Font object with isBold, isItalic, isStrikeout, isUnderline properties. | object |
| isReadonly | Whether the free text is read-only. | boolean |
| Ink Properties | Available when type === "Ink" (hand-drawn annotations) | |
| data | Path data for ink annotation (SVG path format). | string |
| Stamp Properties | Available when type === "Stamp" | |
| icon | Icon/stamp type (Revised, Approved, AsIs, Expired, etc.). | string |
| customStampName | Name of custom stamp. | string |
| isDynamicStamp | Whether the stamp is dynamic. | boolean |
| isMaskedImage | Whether the stamp has a masked image. | boolean |
| stampAnnotationType | Type of stamp annotation. | string |
| stampAnnotationPath | Path data for stamp annotation. | array |
| stampFillcolor | Fill color of the stamp. | string |
| template | Stamp template. | string |
| templateSize | Size of the stamp template. | string |
| StickyNotes Properties | Available when type === "StickyNotes" | |
| state | State of the sticky note. | string |
| stateModel | State model of the sticky note. | string |
| pathData | Path data for sticky note. | string |
| borderDashArray | Border dash array style. | number |
| borderStyle | Border style. | string |
Nested Object Structures
Many annotation properties are complex objects. Use these references to understand their structure and access nested properties.
Rect Object
Purpose: Represents the rectangular boundary of an annotation. Available via args.annotation.rect.
Usage example:
const rect = args.annotation.rect;
console.log(`Position: (${rect.left}, ${rect.top})`);
console.log(`Size: ${rect.width} x ${rect.height}`);| Property Name | Description | Data type |
|---|---|---|
| bottom | Bottom coordinate value. | number |
| left | Left coordinate value. | number |
| right | Right coordinate value. | number |
| top | Top coordinate value. | number |
| height | Height of the rectangle. | number |
| width | Width of the rectangle. | number |
Review Object
Purpose: Contains review/approval status for annotations. Available via args.annotation.review.
Usage example:
if (args.annotation.review) {
console.log('Review state:', args.annotation.review.state);
console.log('Reviewed by:', args.annotation.review.author);
}| Property Name | Description | Data type |
|---|---|---|
| state | State of the review (Accepted, Rejected, Cancelled, etc.). | string |
| stateModel | State model of the review. | string |
| author | Author of the review. | string |
| modifiedDate | Modified date of the review. | string |
AnnotationSettings Object
Purpose: Configuration settings for the annotation. Available via args.annotation.annotationSettings.
Usage example:
if (args.annotation.annotationSettings?.isLock) {
console.log('This annotation is locked');
}| Property Name | Description | Data type |
|---|---|---|
| isLock | Whether the annotation is locked. | boolean |
| isPrint | Whether the annotation should be printed. | boolean |
| maxHeight | Maximum height of the annotation. | number |
| maxWidth | Maximum width of the annotation. | number |
| minHeight | Minimum height of the annotation. | number |
| minWidth | Minimum width of the annotation. | number |
AnnotationSelectorSettings Object
Purpose: Visual appearance settings for annotation selection handles and borders. Available via args.annotation.annotationSelectorSettings.
| Property Name | Description | Data type |
|---|---|---|
| resizerFillColor | Fill color of the resizer handles. | string |
| resizerBorderColor | Border color of the resizer handles. | string |
| resizerSize | Size of the resizer handles. | number |
| resizerShape | Shape of the resizer handles (Square, Circle, etc.). | string |
| resizerLocation | Location of resizers (corners, edges, etc.). | number |
| resizerCursorType | Cursor type for the resizer. | string |
| selectionBorderColor | Color of the selection border. | string |
| selectionBorderThickness | Thickness of the selection border. | number |
| selectorLineDashArray | Dash array pattern for the selector line. | array |
LabelSettings Object
Purpose: Styling configuration for annotation labels (used in shape and measurement annotations). Available via args.annotation.labelSettings.
| Property Name | Description | Data type |
|---|---|---|
| borderColor | Border color of the label. | string |
| fillColor | Fill color of the label. | string |
| fontColor | Font color for label text. | string |
| fontSize | Font size for label text. | number |
| labelContent | Default content of the label. | string |
| fontFamily | Font family for label text. | string |
| notes | Notes associated with the label. | string |
| opacity | Opacity of the label. | number |
Font Object
Purpose: Text formatting properties for free text annotations. Available via args.annotation.font.
Usage example:
if (args.annotation.type === 'FreeText') {
const font = args.annotation.font;
if (font.isBold) console.log('Text is bold');
if (font.isItalic) console.log('Text is italic');
}| Property Name | Description | Data type |
|---|---|---|
| isBold | Whether the text is bold. | boolean |
| isItalic | Whether the text is italic. | boolean |
| isStrikeout | Whether the text has strikeout. | boolean |
| isUnderline | Whether the text is underlined. | boolean |
Calibrate Object
Purpose: Measurement calibration data for distance/area annotations. Available via args.annotation.calibrate.
| Property Name | Description | Data type |
|---|---|---|
| ratio | Calibration ratio (e.g., "1 in = 1 in"). | string |
| x | Array of X calibration values. | array |
| distance | Array of distance calibration values. | array |
| area | Array of area calibration values. | array |
Bounds Object
Purpose: Position and dimensions of an annotation. Available via args.annotation.bounds.
Usage example:
const bounds = args.annotation.bounds;
console.log(`Annotation at (${bounds.x}, ${bounds.y})`);
console.log(`Size: ${bounds.width} x ${bounds.height}`);
console.log(`Alternative: left=${bounds.left}, top=${bounds.top}, right=${bounds.right}`);| Property Name | Description | Data type |
|---|---|---|
| x | X coordinate. | number |
| y | Y coordinate. | number |
| left | Left coordinate. | number |
| top | Top coordinate. | number |
| width | Width of the bounds. | number |
| height | Height of the bounds. | number |
| right | Right coordinate. | number |
VertexPoint Object
Purpose: Represents individual points in polygon-based annotations. Available via args.annotation.vertexPoints (array).
Usage example:
if (args.annotation.vertexPoints) {
args.annotation.vertexPoints.forEach((point, index) => {
console.log(`Point ${index}: (${point.x}, ${point.y})`);
});
}| Property Name | Description | Data type |
|---|---|---|
| x | X coordinate of the vertex. | number |
| y | Y coordinate of the vertex. | number |
---
Common Use Cases
Purpose: Guide users through practical implementations that solve real-world requirements. Each example demonstrates a specific pattern and explains when to apply it.
How to use these examples: 1. Identify the user's requirement (audit logging, access control, custom UI, etc.) 2. Point them to the matching use case 3. Explain how to adapt the pattern to their specific needs 4. Highlight which event properties are essential for their scenario
---
1. Tracking Annotation Changes
User Need: Log user interactions, implement audit trails, or send analytics data.
When to recommend: User mentions "tracking", "logging", "audit", "analytics", "telemetry", or "history".
Pattern: Attach handlers to lifecycle events (annotationAdd, annotationMove, annotationRemove) and log relevant data.
onAnnotationMove(args: any): void {
this.logEvent('annotation_moved', {
annotationId: args.annotationId,
page: args.pageIndex,
timestamp: new Date().toISOString()
});
}<ejs-pdfviewer (annotationMove)="onAnnotationMove($event)"></ejs-pdfviewer>Why this works: annotationMove fires after the move completes, providing the final position. For real-time tracking during drag, use annotationMoving instead.
Key properties: annotationId (identifier), pageIndex (location), timestamp (when).
---
2. Preventing Certain Actions
User Need: Restrict annotation placement on specific pages (e.g., cover pages, signature pages) or enforce business rules.
When to recommend: User mentions "prevent", "restrict", "block", "validation", "business rules", or "access control".
Pattern: Use beforeAddFreeText event and set args.cancel = true to prevent the action.
Important: This is the only event that supports cancellation. Use it for validation before annotations are created.
onBeforeAddFreeText(args: any): void {
if (args.pageIndex === 0) {
args.cancel = true;
alert('Annotations are not allowed on the cover page.');
}
}<ejs-pdfviewer (beforeAddFreeText)="onBeforeAddFreeText($event)"></ejs-pdfviewer>Why this works: Setting args.cancel = true stops the annotation from being added. The event fires before the action completes, allowing intervention.
Limitation: Currently only available for beforeAddFreeText. For other annotation types, handle in annotationAdd and remove if invalid using deleteAnnotationById().
---
3. Accessing Annotation Properties
User Need: Display annotation details in a properties panel, inspector, or custom UI.
When to recommend: User mentions "properties panel", "inspector", "details view", "custom UI", or "show annotation info".
Pattern: Use annotationSelect to get the full annotation object when user selects an annotation, then display its properties.
onAnnotationSelect(args: any): void {
const annotation = args.annotation;
console.log('Color:', annotation.color);
this.updatePropertiesPanel(args.annotationId, annotation);
}<ejs-pdfviewer (annotationSelect)="onAnnotationSelect($event)"></ejs-pdfviewer>Why this works: annotationSelect provides the complete annotation object with all properties. Reference the Annotation Object Reference above to see all available properties.
Key insight: Use args.isMultiSelect to detect if multiple annotations are selected, and args.annotationCollection to process them.
---
4. Validating Property Changes
User Need: Track specific property modifications for compliance, review workflows, or change detection.
When to recommend: User mentions "property changes", "detect modifications", "compliance", "track edits", or "change history".
Pattern: Use annotationPropertiesChange event with boolean flags to identify which properties changed.
onAnnotationPropertiesChange(args: any): void {
if (args.isColorChanged) {
console.log('Annotation color changed to:', args.annotation.color);
}
}<ejs-pdfviewer (annotationPropertiesChange)="onAnnotationPropertiesChange($event)"></ejs-pdfviewer>Why this works: The event provides boolean flags (isColorChanged, isThicknessChanged, isOpacityChanged) so you can detect exactly what changed without comparing old/new values.
Key properties: Use args.annotation to access the updated property values.
Advanced: Combine with annotationSelect to show real-time property updates in a UI panel.
---
5. Handling Multiple Selections
User Need: Perform bulk operations on multiple annotations (delete all, change color, export selected).
When to recommend: User mentions "bulk operations", "multiple annotations", "select all", "batch processing", or "group actions".
Pattern: Check args.isMultiSelect in annotationSelect event and use args.annotationCollection to process each annotation.
onAnnotationSelect(args: any): void {
if (args.isMultiSelect) {
console.log('Multiple annotations selected');
console.log('Selected annotations count:', args.annotationCollection.length);
args.annotationCollection.forEach((annotation: any) => {
console.log('Annotation ID:', annotation.annotationId);
});
} else {
console.log('Single annotation selected:', args.annotationId);
}
}<ejs-pdfviewer (annotationSelect)="onAnnotationSelect($event)"></ejs-pdfviewer>Why this works: annotationCollection contains all selected annotations when isMultiSelect === true. Loop through this array to apply operations to each annotation.
Implementation tip: After bulk operations, use the viewer's API methods (e.g., deleteAnnotationById(), updateAnnotationProperties()) on each annotation ID from the collection.
UI consideration: Provide clear feedback showing how many annotations are selected and which operation will be applied.
Annotation Settings in Angular PdfViewer Component
Description: Configure PDF annotation settings to control appearance, behavior, and interaction of text markup, shape, stamp, sticky notes, measurement, free text, ink, and signature annotations in the Angular PdfViewer component. Customize colors, styles, author details, access restrictions, and default properties to meet specific annotation requirements for document review and collaboration workflows.
Table of Contents
- Overview
- Quick Start
- Global vs Type-Specific Settings
- Annotation Types Available
- Settings Properties Reference
- Annotation-Related Component Properties
- Core Annotation Settings
- Common Use Cases
- Type Definitions
---
Overview
The Angular PdfViewer provides comprehensive annotation configuration through property binding. Settings can be applied globally to all annotations or customized per annotation type through dedicated settings properties like highlightSettings, stampSettings, freeTextSettings, etc.
When to use: Configure annotation properties during component initialization to establish default behaviors, appearance standards, and interaction rules for PDF document markup workflows.
How Annotation Settings Work
Settings are bound to the <ejs-pdfviewer> component and applied when annotations are created. Global settings provide baseline defaults while type-specific settings override globals for individual annotation types.
---
Quick Start
Apply Settings to Specific Annotation Type
Configure individual annotation type appearance and behavior using type-specific property bindings:
import { Component, OnInit } from '@angular/core';
import { AnnotationService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-root',
template: `
<ejs-pdfviewer
id="pdfViewer"
[documentPath]="document"
[highlightSettings]="highlightSettings"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [AnnotationService]
})
export class AppComponent implements OnInit {
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public highlightSettings = {
color: 'green',
opacity: 0.6,
author: 'John Doe',
isLock: false
};
ngOnInit(): void {}
}Use this when: You need to control how a specific annotation type (highlight, rectangle, stamp, etc.) appears across your PDF document.
Apply Global Settings to All Annotations
Use annotationSettings to apply common configuration across all annotation types:
import { Component, OnInit } from '@angular/core';
import { AnnotationService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-root',
template: `
<ejs-pdfviewer
id="pdfViewer"
[documentPath]="document"
[annotationSettings]="annotationSettings"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [AnnotationService]
})
export class AppComponent implements OnInit {
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public annotationSettings = {
author: 'PDF Reviewer',
opacity: 0.7,
isLock: false
};
ngOnInit(): void {}
}Use this when: You want consistent author names, security policies, or opacity values applied to all annotation types in the document.
---
Global vs Type-Specific Settings
Global Settings (annotationSettings):
- Applied to all annotation types unless overridden
- Ideal for organization-wide policies (author name, lock state, download restrictions)
- Available properties:
author,subject,customData,isLock,isPrint,skipDownload,skipPrint,minWidth,minHeight,maxWidth,maxHeight,opacity,allowedInteractions
Type-Specific Settings:
- Override global settings for individual annotation types
- Control unique properties per annotation category
- Examples:
highlightSettings(text markup color),freeTextSettings(font properties),stampSettings(stamp items),measurementSettings(calibration units)
Decision Guide:
- Setting author name for all annotations? → Use
annotationSettings(global) - Customizing highlight color only? → Use
highlightSettings(type-specific) - Locking all annotations? → Use
annotationSettings(global) - Different colors for shapes vs text markup? → Use
rectangleSettingsandhighlightSettingsseparately
---
Annotation Types Available
The Angular PdfViewer supports the following annotation types with corresponding settings properties:
| Annotation Type | Settings Property | Description |
|---|---|---|
| Highlight | highlightSettings | Yellow text highlight for emphasizing content |
| Underline | underlineSettings | Underline text markup annotation |
| Strikethrough | strikethroughSettings | Strike-through text markup annotation |
| Squiggly | squigglySettings | Wavy underline text markup annotation |
| Line | lineSettings | Straight line with customizable endpoints |
| Arrow | arrowSettings | Line with arrow heads for directional indication |
| Rectangle | rectangleSettings | Rectangular shape annotation |
| Circle | circleSettings | Circular or elliptical shape annotation |
| Polygon | polygonSettings | Multi-sided closed shape annotation |
| Distance | distanceSettings | Measurement annotation for distance calculation |
| Perimeter | perimeterSettings | Measurement annotation for perimeter calculation |
| Area | areaSettings | Measurement annotation for area calculation |
| Radius | radiusSettings | Measurement annotation for radius/diameter |
| Volume | volumeSettings | Measurement annotation for 3D volume calculation |
| FreeText | freeTextSettings | Text box annotation with formatting options |
| Stamp | stampSettings | Predefined stamp images |
| CustomStamp | customStampSettings | custom stamp images |
| StickyNotes | stickyNotesSettings | Comment notes attached to document location |
| Ink | inkAnnotationSettings | Freehand drawing annotation |
| HandWrittenSignature | handWrittenSignatureSettings | Digital handwritten signature annotation |
---
Settings Properties Reference
Annotation-Related Component Properties
Properties available directly on the <ejs-pdfviewer> component:
| Property | Description | Type | Default |
|---|---|---|---|
enableAnnotation | Enable or disable annotation features | boolean | true |
enableTextMarkupAnnotation | Enable or disable text markup annotations | boolean | true |
enableShapeAnnotation | Enable or disable shape annotations | boolean | true |
enableMeasureAnnotation | Enable or disable measurement annotations | boolean | true |
enableStampAnnotations | Enable or disable stamp annotations | boolean | true |
enableStickyNotesAnnotation | Enable or disable sticky notes | boolean | true |
enableInkAnnotation | Enable or disable ink annotations | boolean | true |
isAnnotationToolbarVisible | Show or hide annotation toolbar | boolean | true |
annotationSettings | Global settings for all annotations | AnnotationSettings | null |
annotationCollection | Read-only collection of document annotations | AnnotationCollection[] | null |
dateTimeFormat | Date format for dynamic stamps | string | "MM/dd/yyyy" |
annotation | Get the annotation object of the PDF Viewer. | Annotation | null |
annotationDrawingOptions | Configure annotation drawing options. | `AnnotationDrawingOptions` | null |
exportAnnotationFileName | Set the filename when exporting annotations. | string | "annotations" |
handWrittenSignatureSettings | Configure handwritten signature settings. | HandWrittenSignatureSettings | null |
isSignatureEditable | Allow or prevent editing of signatures after creation. | boolean | true |
isValidFreeText | Validate free text before rendering. | boolean | true |
showDigitalSignatureAppearance | Show or hide digital signature appearance dialog. | boolean | true |
signatureCollection | Get the collection of digital signatures in the PDF. | SignatureCollection | null |
signatureDialogSettings | Configure signature dialog settings. | `SignatureDialogSettings` | null |
signatureFitMode | Set how signatures fit in the signature field. | `SignatureFitMode` | Default |
Core Annotation Settings
Settings properties available for annotation configuration:
| Property Name | Description | Applicable Settings |
|---|---|---|
annotationSettings | Global settings for all annotation types | Component-level |
highlightSettings | Settings for highlight text markup | Component-level |
underlineSettings | Settings for underline text markup | Component-level |
strikethroughSettings | Settings for strikethrough text markup | Component-level |
squigglySettings | Settings for squiggly text markup | Component-level |
lineSettings | Settings for line annotations | Component-level |
arrowSettings | Settings for arrow annotations | Component-level |
rectangleSettings | Settings for rectangle annotations | Component-level |
circleSettings | Settings for circle annotations | Component-level |
polygonSettings | Settings for polygon annotations | Component-level |
distanceSettings | Settings for distance measurement | Component-level |
perimeterSettings | Settings for perimeter measurement | Component-level |
areaSettings | Settings for area measurement | Component-level |
radiusSettings | Settings for radius measurement | Component-level |
volumeSettings | Settings for volume measurement | Component-level |
freeTextSettings | Settings for free text annotations | Component-level |
stampSettings | Settings for stamp annotations | Component-level |
customStampSettings | Settings for custom stamp annotations | Component-level |
stickyNotesSettings | Settings for sticky notes | Component-level |
inkAnnotationSettings | Settings for ink annotations | Component-level |
handWrittenSignatureSettings | Settings for signature annotations | Component-level |
measurementSettings | Calibration settings for measurements | Component-level |
---
Common Use Cases
Use Case 1: Apply Company Branding to All Annotations
Set organization-wide author and metadata for all annotations:
import { Component, OnInit } from '@angular/core';
import { AnnotationService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-root',
template: `
<ejs-pdfviewer
id="pdfViewer"
[documentPath]="document"
[annotationSettings]="annotationSettings"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [AnnotationService]
})
export class AppComponent implements OnInit {
public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public annotationSettings = {
author: 'Acme Corporation',
subject: 'Document Review',
customData: { department: 'Legal', version: '1.0' }
};
ngOnInit(): void {}
}Use Case 2: Lock Annotations After Creation
Prevent users from editing annotations once created:
public annotationSettings = {
isLock: true,
allowedInteractions: []
};Use Case 3: Customize Multiple Annotation Type Colors
Apply distinct colors to different annotation types:
public highlightSettings = { color: '#00FF00', opacity: 0.5 };
public underlineSettings = { color: '#0000FF', opacity: 0.4 };
public rectangleSettings = { fillColor: '#FFFF00', strokeColor: '#FF0000' };Use Case 4: Restrict Annotation Download and Print
Hide annotations from exported and printed documents:
public annotationSettings = {
skipDownload: true,
skipPrint: true
};Use Case 5: Configure Free Text Annotation Defaults
Set default font properties for text box annotations:
public freeTextSettings = {
fontFamily: 'Helvetica',
fontSize: 16,
fontColor: '#000000',
fillColor: '#FFFF99',
borderColor: '#FF0000',
borderWidth: 2,
textAlignment: 'Left',
enableAutoFit: true
};Use Case 6: Set Measurement Calibration
Configure measurement units and scale ratio for measurement annotations:
public measurementSettings = {
conversionUnit: 'cm',
displayUnit: 'cm',
scaleRatio: 2,
depth: 96
};Use Case 7: Configure Stamp Annotation Items
Define available stamp items for users:
public stampSettings = {
dynamicStamps: ['Approved', 'Reviewed', 'Confidential'],
signStamps: ['Accepted', 'Rejected', 'SignHere'],
standardBusinessStamps: ['Draft', 'Final', 'ForPublicRelease'],
opacity: 0.8,
author: 'Stamp Authority'
};---
Type Definitions
Common Annotation Properties
Available across most annotation settings types (properties marked with asterisk have limited availability):
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | "Guest" |
subject | Annotation subject or title | string | "" |
opacity | Transparency level (0-1) | number | 1 |
isLock | Prevent editing when true | boolean | false |
isPrint | Include in print output | boolean | true |
skipDownload | Exclude from downloaded file | boolean | false |
skipPrint | Exclude from print output | boolean | false |
customData | User-defined metadata object | object | null |
allowedInteractions | Permitted interactions when locked | AllowedInteraction[] | [] |
minWidth | Minimum annotation width | number | 0 |
minHeight | Minimum annotation height | number | 0 |
maxWidth | Maximum annotation width | number | 0 |
maxHeight | Maximum annotation height | number | 0 |
Important: Properties like isLock, isPrint, skipDownload, skipPrint are NOT directly configurable in settings objects. These are set on annotation instances after creation or through programmatic editing.
Text Markup Annotation Properties
Specific to highlightSettings, underlineSettings, strikethroughSettings, and squigglySettings:
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | "Guest User" |
subject | Annotation subject | string | Varies by type |
color | Markup color (hex or named) | string | "#FFFF00" |
opacity | Transparency (0 to 1) | number | 0.9 |
modifiedDate | Modified date string | string | "" |
enableTextMarkupResizer | Enable resizing handles | boolean | false |
enableMultiPageAnnotation | Allow spanning multiple pages | boolean | false |
Shape Annotation Properties
Applicable to lineSettings, arrowSettings, rectangleSettings, circleSettings, and polygonSettings:
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | Not documented |
subject | Annotation subject | string | Not documented |
fillColor | Interior fill color (hex or named) | string | Varies by type |
strokeColor | Border/line color (hex or named) | string | Varies by type |
thickness | Border/line thickness (1-10) | number | 1 |
opacity | Transparency (0 to 1) | number | 0.6 |
lineHeadStartStyle | Start cap style (line/arrow only) | string | Not documented |
lineHeadEndStyle | End cap style (line/arrow only) | string | Not documented |
Free Text Annotation Properties
Specific to freeTextSettings:
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | Not documented |
subject | Annotation subject | string | Not documented |
fillColor | Background color | string | "green" (example) |
borderColor | Border color | string | "blue" (example) |
fontColor | Text color | string | "yellow" (example) |
fontSize | Text size in points | number | 16 |
fontFamily | Font name | string | "Helvetica" |
fontStyle | Font style flags | string | Not documented |
textAlignment | Text alignment | string | Not documented |
borderWidth | Border thickness | number | Not documented |
borderStyle | Border style | string | "solid" |
defaultText | Placeholder text | string | "Type Here" |
enableAutoFit | Auto-expand width | boolean | false |
opacity | Transparency (0 to 1) | number | Not documented |
Measurement Annotation Properties
Applicable to distanceSettings, perimeterSettings, areaSettings, radiusSettings, volumeSettings, and measurementSettings:
| Property | Description | Type | Default | Settings |
|---|---|---|---|---|
author | Annotation creator name | string | Not documented | Type-specific |
subject | Annotation subject | string | Not documented | Type-specific |
fillColor | Interior fill color | string | Varies by type | Type-specific |
strokeColor | Border color | string | Varies by type | Type-specific |
opacity | Transparency (0 to 1) | number | 0.6 | Type-specific |
thickness | Border thickness | number | Not documented | Type-specific |
conversionUnit | Source measurement unit | string | "in" | measurementSettings |
displayUnit | Display measurement unit | string | "in" | measurementSettings |
scaleRatio | Scale multiplier | number | 1 | measurementSettings |
depth | Depth for volume (not width) | number | 96 | measurementSettings |
leaderLength | Leader line length | number | 40 | distanceSettings |
Stamp Annotation Properties
Specific to stampSettings:
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | "Guest User" |
opacity | Transparency (0 to 1) | number | 0.3 |
dynamicStamps | Available dynamic stamps (not set in settings) | array | Not configurable |
signStamps | Available sign stamps (not set in settings) | array | Not configurable |
standardBusinessStamps | Available business stamps (not set in settings) | array | Not configurable |
customStamps | Custom stamps (not set in settings) | array | Not configurable |
enableCustomStamp | Allow custom stamp (not in settings) | boolean | true |
Sticky Notes Properties
Specific to stickyNotesSettings:
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | "Syncfusion" |
opacity | Transparency (0 to 1) | number | Not documented |
Ink Annotation Properties
Specific to inkAnnotationSettings:
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | "Syncfusion" |
strokeColor | Ink path color | string | "green" |
thickness | Ink path thickness | number | 3 |
opacity | Transparency (0 to 1) | number | 0.6 |
width | Annotation width (set during addAnnotation) | number | 150 |
height | Annotation height (set during addAnnotation) | number | 60 |
path | SVG path data (set during addAnnotation) | string | Not in settings |
Handwritten Signature Properties
Specific to handWrittenSignatureSettings (limited documentation):
| Property | Description | Type | Default |
|---|---|---|---|
author | Annotation creator name | string | Not documented |
opacity | Transparency (0 to 1) | number | Not documented |
width | Signature width (set during addAnnotation) | number | Not in settings |
height | Signature height (set during addAnnotation) | number | Not in settings |
CustomStampSettings Properties
| Name | Description | Type |
|---|---|---|
customStampImageSource | Defines the custom stamp images source to be added in stamp menu of the PDF Viewer toolbar. | string |
customStampName | Defines the custom stamp name to be added in stamp menu of the PDF Viewer toolbar. | string |
AnnotationDrawingOptions Properties
| Name | Description | Type |
|---|---|---|
| enableLineAngleConstraints | Enables angular constraints for line-type annotations. | |
When set to true, lines and arrows are restricted to fixed angles defined by the restrictLineAngleTo property. | boolean | |
| restrictLineAngleTo | Specifies the angle (in degrees) to which line-type annotations are constrained. | number |
SignatureDialogSettings Properties
| Name | Description | Type |
|---|---|---|
| displayMode | Get or set the required signature options will be enabled in the signature dialog. | `DisplayMode` |
| hideSaveSignature | Get or set a boolean value to show or hide the save signature check box option in the signature dialog. | boolean |
Enumeration Types
CalibrationUnit:
in- Inchescm- Centimetersmm- Millimetersft- Feetpt- Pointsp- Picas
FontStyle:
None- Normal textBold- Bold textItalic- Italic textUnderline- Underlined textStrikethrough- Strikethrough text
TextAlignment:
Left- Align text leftCenter- Center textRight- Align text rightJustify- Justify text
LineHeadStyle:
None- No line capArrow- Arrow headOpen- Open arrowClosed- Closed arrowOpenArrow- Open arrow variationClosedArrow- Closed arrow variationSquare- Square capRound- Round capDiamond- Diamond cap
DynamicStampItem:
ApprovedConfidentialNotApprovedReceivedReviewedRevised
SignStampItem:
AcceptedInitialHereRejectedSignHereWitness
StandardBusinessStampItem:
ApprovedCompletedConfidentialDraftFinalForCommentForPublicReleaseInformationOnlyNotApprovedNotForPublicReleasePreliminaryResultsVoid
SignatureFitMode:
DefaultStretch
DisplayMode:
Draw - Display only the draw option in the signature dialog. Text - Display only the text option in the signature dialog. Upload - Display only the upload option in the signature dialog.
API Methods in Angular PdfViewer Component
Brief: Comprehensive reference for programmatic control of the Angular PdfViewer component including methods for document loading, annotation management, form field operations, text extraction, navigation, and state management. Use these APIs when the user requires programmatic control beyond standard UI interactions.
Table of Contents
- When to Use These APIs
- API Categories
- Complete API Reference
- Common Parameter Types
- Usage Examples by Scenario
When to Use These APIs
Guide users to these methods when they express these needs:
- "Load a PDF programmatically" → Use
load()method - "Process form data from PDF" → Use
exportFormFieldsAsObject()orimportFormFields() - "Add/edit PDF annotations dynamically" → Use
annotation.addAnnotation(),annotation.editAnnotation() - "Extract text from PDF" → Use
extractText()with bounds parameter - "Implement undo/redo for PDF edits" → Use
undo()andredo()methods - "Respond to layout changes" → Use
updateViewerContainer()after resize - "Navigate to specific coordinates" → Use coordinate conversion methods
Alternative approaches: If users need simple page navigation or UI interactions, refer to navigation.md or events.md instead of programmatic APIs.
API Categories
When users describe their goal, identify which category fits best, then recommend specific methods:
| Category | Methods | When to Recommend |
|---|---|---|
| Annotation Management | annotation.addAnnotation, annotation.editAnnotation, annotation.setAnnotationMode, annotation.selectAnnotation, annotation.clearSelection | User wants to add, modify, or manage annotations programmatically (e.g., "highlight search results", "enable rectangle drawing mode") |
| Form Field Operations | updateFormFieldsValue, updateFormFields, retrieveFormFields, resetFormFields, focusFormField, exportFormFieldsAsObject, importFormFields, clearFormFields | User works with fillable PDF forms - needs to pre-fill, validate, export, clear field data (e.g., "populate form from database", "export form data") |
| Form Designer | formDesigner.addFormField, formDesigner.updateFormField, formDesigner.deleteFormField, formDesigner.selectFormField, formDesigner.setFormFieldMode | User needs to create or modify form fields programmatically (e.g., "dynamically add textbox", "create dropdown") |
| Document Operations | load, download, saveAsBlob | User wants to open PDF from URL/Blob, save modified PDF, or get PDF as Blob for upload (e.g., "switch between multiple PDFs", "let user download annotated PDF") |
| Navigation | getPageNumberFromClientPoint, getPageInfo, convertClientPointToPagePoint, convertPagePointToClientPoint, convertPagePointToScrollingPoint | User needs programmatic navigation or coordinate conversion (e.g., "zoom to search result", "highlight region at coordinates") |
| Text Extraction | extractText | User wants to extract text from specific PDF region for processing (e.g., "copy text from bounds") |
| State Management | undo, redo, destroy, updateViewerContainer | User needs undo/redo functionality, viewer cleanup, or layout refresh (e.g., "undo last annotation", "update viewer after resize") |
Complete API Reference
Annotation Module Methods
| Method Name | Description | Parameters | Return Type | Code Snippet |
|---|---|---|---|---|
| addAnnotation | Adds annotations programmatically with specific annotation type and settings | annotationType: string, options: AnnotationSettings | void | viewer.annotation.addAnnotation('Highlight', {bounds: [{x: 100, y: 100, width: 200, height: 50}], pageNumber: 1}); |
| editAnnotation | Updates existing properties of the specified annotation object | annotation: any | void | viewer.annotation.editAnnotation({id: 'annot-123', strokeColor: 'red', opacity: 0.8}); |
| setAnnotationMode | Sets annotation type to be added in next user interaction | type: string | void | viewer.annotation.setAnnotationMode('Rectangle'); |
| selectAnnotation | Selects annotations using annotation ID or object | annotationId: string \ | object | void |
| clearSelection | Clears the selection of the annotation | - | void | viewer.annotation.clearSelection(); |
Form Designer Module Methods
| Method Name | Description | Parameters | Return Type | Code Snippet |
|---|---|---|---|---|
| addFormField | Adds form field to the PDF page programmatically | formFieldType: string, options: FormFieldSettings | HTMLElement | viewer.formDesigner.addFormField('Textbox', {name: 'field1', bounds: {X: 100, Y: 100, Width: 200, Height: 30}}); |
| updateFormField | Updates the form field with the given properties and value | formFieldId: string \ | object, options: FormFieldSettings | void |
| deleteFormField | Deletes the form field from the PDF page | formFieldId: string \ | object | void |
| selectFormField | Selects the form field in the PDF Viewer | formFieldId: string \ | object | void |
| setFormFieldMode | Sets the form field mode to add form field on user interaction | formFieldType: string | void | viewer.formDesigner.setFormFieldMode('Textbox'); |
| clearSelection | Clears the selection of the form field | formFieldId: string \ | object | void |
Core Methods
| Method Name | Description | Parameters | Return Type | Code Snippet |
|---|---|---|---|---|
| load | Loads a PDF document from a specified URL or Blob | document: string \ | Blob | void |
| download | Downloads the current PDF document to the client machine | - | void | viewer.download(); |
| saveAsBlob | Saves the current PDF document as a Blob object | - | Promise<Blob> | viewer.saveAsBlob().then(blob => console.log(blob)); |
| updateFormFieldsValue | Updates the values of form fields in the PDF document | field: FormField | void | viewer.updateFormFieldsValue(fieldObject); |
| updateFormFields | Updates specific form fields in the PDF document (deprecated - use formDesigner.updateFormField) | formFields: FormField[] | void | viewer.updateFormFields([{name: 'field1', value: 'newValue'}]); |
| retrieveFormFields | Retrieves all form field data from the PDF document | - | FormField[] | const formFields = viewer.retrieveFormFields(); |
| resetFormFields | Resets all form field values to their default values | - | void | viewer.resetFormFields(); |
| focusFormField | Sets focus to a specific form field in the PDF document | fieldName: string | void | viewer.focusFormField('fieldName'); |
| deleteAnnotations | Deletes the annotation collection in the PDF document | - | void | viewer.deleteAnnotations(); |
| exportAnnotation | Exports the annotation data in the specified format | annotationDataFormat: AnnotationDataFormat | void | viewer.exportAnnotation(AnnotationDataFormat.Json); |
| exportAnnotationsAsBase64String | Exports the annotation data in the specified format as a base64 String | annotationDataFormat: AnnotationDataFormat | Promise<string> | viewer.exportAnnotationsAsBase64String(AnnotationDataFormat.Xfdf); |
| exportAnnotationsAsObject | Exports the annotation data in the specified format as an object | annotationDataFormat: AnnotationDataFormat | Promise<object> | viewer.exportAnnotationsAsObject(AnnotationDataFormat.Json); |
| importAnnotation | Imports the annotation data into the PDF document | importData: any, annotationDataFormat: AnnotationDataFormat | void | viewer.importAnnotation(importData, AnnotationDataFormat.Json); |
| exportFormFieldsAsObject | Exports form fields data from the PDF document as a JSON object | format: string | Promise<object> | viewer.exportFormFieldsAsObject('Fdf').then(data => console.log(data)); |
| exportFormFields | Exports form fields data as downloadable file | fileName: string, format: string | void | viewer.exportFormFields('FormData', 'Json'); |
| importFormFields | Imports form field data into the PDF document | source: string, format: string | void | viewer.importFormFields('File', 'Json'); |
| clearFormFields | Clears all form field values in the PDF document without removing fields | field?: FormField | void | viewer.clearFormFields(); |
| extractText | Extracts text from the PDF document based on the selection region | bounds: any | string | const text = viewer.extractText({x: 0, y: 0, width: 100, height: 100}); |
| getPageInfo | Retrieves information about a specific page in the PDF document | pageIndex: number | PageInfo | const pageInfo = viewer.getPageInfo(0); |
| getPageNumberFromClientPoint | Gets the page number at a specific client point (screen coordinates) | clientPoint: any | number | const pageNum = viewer.getPageNumberFromClientPoint({x: 100, y: 200}); |
| convertClientPointToPagePoint | Converts a client point (screen coordinates) to page point coordinates | clientPoint: any | any | const pagePoint = viewer.convertClientPointToPagePoint({x: 100, y: 200}); |
| convertPagePointToClientPoint | Converts a page point to client point (screen coordinates) | pagePoint: any | any | const clientPoint = viewer.convertPagePointToClientPoint({x: 50, y: 75}); |
| convertPagePointToScrollingPoint | Converts a page point to scrolling point coordinates within the viewport | pagePoint: any | any | const scrollPoint = viewer.convertPagePointToScrollingPoint({x: 50, y: 75}); |
| undo | Undoes the last action performed in the PDF viewer | - | void | viewer.undo(); |
| redo | Redoes the last undone action in the PDF viewer | - | void | viewer.redo(); |
| destroy | Destroys the PdfViewer component and releases its resources | - | void | viewer.destroy(); |
| showNotificationPopup | Opens a dialog to display an error message | errorString: string | void | viewer.showNotificationPopup('Error'); |
| unload | Unloads the PDF document being displayed in the PDF viewer. | - | void | viewer.unload(); |
| updateViewerContainer | Updates the PDF viewer container size and layout | - | void | viewer.updateViewerContainer(); |
| zoomToRect | Brings the given rectangular region to view and zooms in the document to fit the region in client area (view port). | rectangle: Rect | void | viewer.zoomToRect(new Rect(10, 10, 100, 100)); |
Common Parameter Types
CRITICAL: Bounds Format Differs Between Annotations and Form Fields
Annotations – bounds (lowercase):
viewer.annotation.addAnnotation('Rectangle', {
offset: { x: 100, y: 100 },
width: 200,
height: 50,
pageNumber: 1
});Form Fields – bounds (capitalized X, Y, Width, Height):
viewer.formDesigner.addFormField('Textbox', {
bounds: { X: 100, Y: 100, Width: 200, Height: 30 }
});Do NOT mix or interchange these formats - each API expects its specific casing.
AnnotationSettings
Used with annotation.addAnnotation() to customize annotation properties.
| Property | Description | Data Type |
|---|---|---|
| offset | The position of the annotation | {x: number, y: number} |
| pageNumber | The page number where annotation is placed | number |
| width | Width of the annotation | number |
| height | Height of the annotation | number |
| bounds | Bounds array for text markup annotations | Array<{x, y, width, height}> |
| author | Author of the annotation | string |
| subject | Subject of the annotation | string |
| strokeColor | Stroke color | string |
| fillColor | Fill color | string |
| opacity | Opacity value (0-1) | number |
| thickness | Line/border thickness | number |
| vertexPoints | Array of points for line/shape annotations | Array<{x, y}> |
FormFieldSettings
Used with formDesigner.addFormField() and formDesigner.updateFormField().
| Property | Description | Data Type |
|---|---|---|
| name | Name of the form field | string |
| bounds | The bounds of the form field (capitalized) | {X, Y, Width, Height} |
| value | Default value of the form field | string |
| fontFamily | Font family for the field | string |
| fontSize | Font size for the field | number |
| color | Text color | string |
| backgroundColor | Background color | string |
| borderColor | Border color | string |
| thickness | Border thickness | number |
| alignment | Text alignment | string |
| isReadOnly | Whether field is read-only | boolean |
| isRequired | Whether field is required | boolean |
| maxLength | Maximum length for text fields | number |
| tooltip | Tooltip text | string |
FormField
Represents a form field in the PDF document.
| Property | Description | Data Type |
|---|---|---|
| name | The name of the form field | string |
| value | The current value of the form field | string |
| fieldType | The type of form field | string |
PageInfo
Contains information about a specific page.
| Property | Description | Data Type |
|---|---|---|
| pageNumber | The page number | number |
| width | The width of the page | number |
| height | The height of the page | number |
| rotation | The rotation angle of the page | number |
Usage Examples by Scenario
Scenario 1: Add Text Markup Annotations Programmatically
When: User wants to highlight, underline, or strikethrough text programmatically.
Why: Use annotation.addAnnotation() with specific bounds to add text markup without user interaction - ideal for highlighting search results or marking important sections.
// Add highlight annotation
viewer.annotation.addAnnotation("Highlight", {
bounds: [{ x: 97, y: 110, width: 350, height: 14 }],
pageNumber: 1,
color: '#FFFF00',
opacity: 0.5
} as any);
// Add underline annotation
viewer.annotation.addAnnotation("Underline", {
bounds: [{ x: 250, y: 148, width: 345, height: 14 }],
pageNumber: 2,
color: '#FF0000'
} as any);
// Add strikethrough annotation
viewer.annotation.addAnnotation("Strikethrough", {
bounds: [{ x: 250, y: 144, width: 345, height: 14 }],
pageNumber: 2,
color: '#0000FF'
} as any);Scenario 2: Add Shape Annotations Programmatically
When: Creating diagrams, marking regions, or adding visual elements to PDFs.
Why: Use annotation.addAnnotation() with shape types to add lines, rectangles, circles, and polygons dynamically - useful for marking areas or creating diagrams.
// Add line annotation
viewer.annotation.addAnnotation("Line", {
offset: { x: 200, y: 230 },
pageNumber: 1,
vertexPoints: [{ x: 200, y: 230 }, { x: 350, y: 230 }],
strokeColor: '#0000FF',
thickness: 2
} as any);
// Add rectangle annotation
viewer.annotation.addAnnotation("Rectangle", {
offset: { x: 200, y: 480 },
pageNumber: 1,
width: 150,
height: 75,
fillColor: '#FFFF00',
strokeColor: '#FF0000'
} as any);
// Add circle annotation
viewer.annotation.addAnnotation("Circle", {
offset: { x: 200, y: 620 },
pageNumber: 1,
width: 90,
height: 90,
fillColor: '#00FF00'
} as any);Scenario 3: Add Stamp Annotations Programmatically
When: Adding approval stamps, signatures, or custom images to PDFs.
Why: Use annotation.addAnnotation() with stamp types to add dynamic, approved, or custom stamp images - ideal for approval workflows.
// Add dynamic stamp
viewer.annotation.addAnnotation("Stamp", {
offset: { x: 200, y: 140 },
pageNumber: 1
} as any, DynamicStampItem.Approved);
// Add custom stamp
viewer.annotation.addAnnotation('Stamp', {
offset: { x: 100, y: 440 },
width: 46,
height: 100,
pageNumber: 1,
customStamps: [{
customStampName: "Image",
customStampImageSource: "data:image/jpeg;base64,/9j4AAQSkZJRg..."
}]
} as any);Scenario 4: Edit Existing Annotations
When: Modifying annotation properties like color, position, or lock state.
Why: Use annotation.editAnnotation() to update existing annotations programmatically - essential for batch updates or conditional styling.
// Edit annotation properties
for (let i = 0; i < viewer.annotationCollection.length; i++) {
if (viewer.annotationCollection[i].subject === "Rectangle") {
viewer.annotationCollection[i].strokeColor = "#0000FF";
viewer.annotationCollection[i].thickness = 2;
viewer.annotationCollection[i].fillColor = "#FFFF00";
viewer.annotation.editAnnotation(viewer.annotationCollection[i]);
}
}Scenario 5: Add Sticky Notes and Free Text
When: Adding comments or text annotations to PDFs.
Why: Use annotation.addAnnotation() for notes and editable text boxes - perfect for commenting or adding instructions.
// Add sticky note
viewer.annotation.addAnnotation("StickyNotes", {
offset: { x: 100, y: 200 },
pageNumber: 1
} as any);
// Add free text annotation
viewer.annotation.addAnnotation("FreeText", {
offset: { x: 100, y: 150 },
fontSize: 16,
fontFamily: "Helvetica",
pageNumber: 1,
width: 200,
height: 40,
textAlignment: 'Center',
borderStyle: 'solid',
borderWidth: 2,
borderColor: 'red',
fillColor: 'blue',
fontColor: 'white',
defaultText: "Syncfusion"
} as any);Scenario 6: Manage Form Fields
When: Working with fillable PDFs that have form fields.
Why: Use form field methods to read current state, pre-fill from database, and export for submission.
// Retrieve all form fields
const formFields = viewer.retrieveFormFields();
console.log(formFields);
// Update specific field value
const field = formFields.find(f => f.name === 'First Name');
if (field) {
field.value = 'John';
field.tooltip = 'First Name';
viewer.updateFormFieldsValue(field);
}
// Export filled form data
viewer.exportFormFieldsAsObject('Fdf').then((data: any) => {
console.log('Exported data:', data);
});
// Reset all fields
viewer.resetFormFields();
// Clear all fields
viewer.clearFormFields();Scenario 7: Dynamic Form Field Creation
When: Creating fillable PDF forms programmatically.
Why: Use formDesigner.addFormField() to dynamically add textboxes, checkboxes, dropdowns - ideal for building forms on the fly.
// Add textbox form field
viewer.formDesigner.addFormField('Textbox', {
name: 'firstName',
bounds: { X: 100, Y: 100, Width: 200, Height: 30 },
value: '',
fontSize: 12,
fontFamily: 'Helvetica',
isRequired: true,
tooltip: 'Enter your first name'
} as any);
// Add checkbox
viewer.formDesigner.addFormField('Checkbox', {
name: 'agreeTerms',
bounds: { X: 100, Y: 150, Width: 20, Height: 20 },
isChecked: false
} as any);
// Add dropdown
viewer.formDesigner.addFormField('DropDown', {
name: 'country',
bounds: { X: 100, Y: 200, Width: 200, Height: 30 },
options: [
{ itemName: 'USA', itemValue: 'us' },
{ itemName: 'Canada', itemValue: 'ca' }
]
} as any);Scenario 8: Extract Text from PDF
When: Getting text content from a specific region.
Why: Use extractText() with bounds for targeted extraction - ideal for processing specific fields or copying text from coordinates.
// Extract text from rectangular region
const bounds = { x: 100, y: 150, width: 200, height: 100 };
const extractedText = viewer.extractText(bounds);
console.log('Extracted:', extractedText);Scenario 9: Navigate and Get Page Information
When: Programmatically moving to specific pages or getting page details.
Why: Use getPageInfo() for layout calculations and coordinate conversion for precise positioning.
// Get page information
const pageInfo = viewer.getPageInfo(0);
console.log('Page dimensions:', pageInfo?.width, pageInfo?.height);
// Get page number from click coordinates
const pageNum = viewer.getPageNumberFromClientPoint({x: 100, y: 200});
console.log('Page number:', pageNum);
// Convert coordinates
const pagePoint = viewer.convertClientPointToPagePoint({x: 100, y: 200});
const clientPoint = viewer.convertPagePointToClientPoint({x: 50, y: 75});Scenario 10: Implement Undo/Redo
When: Allowing users to undo/redo annotations or form changes.
Why: Use undo() and redo() to provide familiar editing experience - essential for annotation workflows.
// User clicks undo button
viewer.undo();
// User clicks redo button
viewer.redo();Scenario 11: Add Measurement Annotations
When: Adding distance, perimeter, area, radius, or volume measurements.
Why: Use measurement annotation types for technical drawings or architectural plans.
// Add distance annotation
viewer.annotation.addAnnotation("Distance", {
offset: { x: 200, y: 230 },
pageNumber: 1,
vertexPoints: [{ x: 200, y: 230 }, { x: 350, y: 230 }]
} as any);
// Add area annotation
viewer.annotation.addAnnotation("Area", {
offset: { x: 200, y: 500 },
pageNumber: 1,
vertexPoints: [
{ x: 200, y: 500 },
{ x: 288, y: 499 },
{ x: 289, y: 553 },
{ x: 200, y: 500 }
]
} as any);Scenario 12: Add Handwritten Signature
When: Adding signature annotations to PDFs.
Why: Use signature annotation with path data for digital signing workflows.
// Add handwritten signature
viewer.annotation.addAnnotation("HandWrittenSignature", {
offset: { x: 220, y: 180 },
pageNumber: 1,
width: 150,
height: 60,
path: '[{"command":"M","x":244.8,"y":982.0}...]' // SVG path data
} as any);Bookmark Navigation in Angular PDF Viewer
Reference: Official Syncfusion Angular PDF Viewer documentation for bookmark navigation features
Brief: Bookmark navigation enables users to navigate through embedded PDF bookmarks. The Angular PDF Viewer automatically loads and presents bookmarks for easy document traversal through both UI panel and programmatic API methods.
⚠️ CRITICAL: Correct API Usage
ALL bookmark methods MUST be accessed via the bookmark module on the viewer component:
// ✅ CORRECT - Access via bookmark module
this.pdfViewer.bookmark.goToBookmark(pageIndex, y);
this.pdfViewer.bookmark.getBookmarks();
// ❌ WRONG - These methods DO NOT exist directly on viewer
this.pdfViewer.goToBookmark(); // ❌ NOT A VALID METHOD
this.pdfViewer.navigateToBookmark(); // ❌ NOT A VALID METHODTable of Contents
- When to Use
- Prerequisites
- Enabling Bookmarks
- API Methods
- Complete Examples
- Bookmark Data Structure
- Best Practices
When to Use
Use bookmarks when:
- Jump to specific sections in long PDFs (reports, manuals, specifications)
- Navigate document hierarchy without manual scrolling
- Display table of contents extracted from PDF
- Build custom navigation UIs beyond default sidebar
Skip bookmarks if PDF has no embedded bookmarks or only needs simple page navigation.
Prerequisites
Before using bookmark features, ensure:
enableBookmarkproperty is set totrueon the ejs-pdfviewer elementBookmarkViewServiceis injected into the component providers- The PDF document contains embedded bookmarks (many PDFs don't have them)
Enabling Bookmarks
import { Component, ViewChild } from '@angular/core';
import { PdfViewerComponent, BookmarkViewService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `
<ejs-pdfviewer #pdfViewer id="pdfViewer"
[documentPath]="document"
[enableBookmark]="true"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [BookmarkViewService]
})
export class AppComponent {
@ViewChild('pdfViewer') public pdfViewer: PdfViewerComponent;
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
}What happens: Bookmarks load automatically, sidebar panel appears with hierarchy, and all bookmark API methods become available.
API Methods
1. goToBookmark()
Signature: this.pdfViewer.bookmark.goToBookmark(pageIndex: number, y: number): void
Navigates to specific page and Y coordinate based on bookmark location.
Parameters:
pageIndex(number): Zero-based page index (0 = first page)y(number): Vertical pixel coordinate (0 = top of page)
public navigateToBookmark(): void {
const pageIndex = 0; // First page
const yCoordinate = 150; // 150 pixels from top
this.pdfViewer.bookmark.goToBookmark(pageIndex, yCoordinate);
}Usage with button:
<button (click)="navigateToBookmark()">Go to Chapter 1</button>2. getBookmarks()
Signature: this.pdfViewer.bookmark.getBookmarks(): any[]
Retrieves all bookmarks as hierarchical array. Returns empty array [] if no bookmarks exist.
public retrieveBookmarks(): void {
const bookmarks = this.pdfViewer.bookmark.getBookmarks();
console.log('Available bookmarks:', bookmarks);
if (bookmarks && bookmarks.length > 0) {
bookmarks.forEach(bookmark => {
console.log(`Title: ${bookmark.title}, Page: ${bookmark.page}`);
});
} else {
console.log('No bookmarks found in this PDF');
}
}Open/close bookmark pane programmatically
Approach 1: Use isBookmarkPanelOpen property on PDF Viewer instance. Setting it to true opens the bookmark panel. Using it during initialization opens the bookmark panel on load
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { PdfViewerComponent, BookmarkViewService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `
<button (click)="openBookmarkPanel()">Open Bookmark Panel</button>
<button (click)="closeBookmarkPanel()">Open Bookmark Panel</button>
<ejs-pdfviewer #pdfViewer id="pdfViewer"
[documentPath]="document"
[enableBookmark]="true"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [BookmarkViewService]
})
export class AppComponent {
@ViewChild('pdfViewer') public pdfViewer: PdfViewerComponent;
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public openBookmarkPanel(): void {
this.pdfViewer.isBookmarkPanelOpen = true;
}
public closeBookmarkPanel(): void {
this.pdfViewer.isBookmarkPanelOpen = false;
}
}Approach 2: Use openBookmarkPane() of bookmark module to open bookmark panel and use closeBookmarkPane() of bookmark module to close bookmark panel.
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { PdfViewerComponent, BookmarkViewService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `
<button (click)="openBookmarkPanel()">Open Bookmark Panel</button>
<button (click)="closeBookmarkPanel()">Open Bookmark Panel</button>
<ejs-pdfviewer #pdfViewer id="pdfViewer"
[documentPath]="document"
[enableBookmark]="true"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [BookmarkViewService]
})
export class AppComponent {
@ViewChild('pdfViewer') public pdfViewer: PdfViewerComponent;
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public openBookmarkPanel(): void {
this.pdfViewer.bookmark.openBookmarkPane();
}
public closeBookmarkPanel(): void {
this.pdfViewer.bookmark.closeBookmarkPane();
}
}Complete Examples
Example 1: Navigate to Specific Bookmark
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { PdfViewerComponent, BookmarkViewService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `
<button (click)="goToChapterOne()">Go to Chapter 1</button>
<button (click)="goToChapterTwo()">Go to Chapter 2</button>
<ejs-pdfviewer #pdfViewer id="pdfViewer"
[documentPath]="document"
[enableBookmark]="true"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [BookmarkViewService]
})
export class AppComponent {
@ViewChild('pdfViewer') public pdfViewer: PdfViewerComponent;
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public goToChapterOne(): void {
this.pdfViewer.bookmark.goToBookmark(0, 0);
}
public goToChapterTwo(): void {
this.pdfViewer.bookmark.goToBookmark(10, 50);
}
}Example 2: Retrieve and Display Bookmarks
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { PdfViewerComponent, BookmarkViewService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `
<button (click)="retrieveBookmarks()">Get All Bookmarks</button>
<div *ngIf="bookmarkList.length > 0">
<h3>Table of Contents</h3>
<ul>
<li *ngFor="let bookmark of bookmarkList" (click)="navigateTo(bookmark)">
{{ bookmark.title }} (Page {{ bookmark.page + 1 }})
</li>
</ul>
</div>
<ejs-pdfviewer #pdfViewer id="pdfViewer"
[documentPath]="document"
[enableBookmark]="true"
style="height:640px;display:block">
</ejs-pdfviewer>
`,
providers: [BookmarkViewService]
})
export class AppComponent implements AfterViewInit {
@ViewChild('pdfViewer') public pdfViewer: PdfViewerComponent;
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public bookmarkList: any[] = [];
ngAfterViewInit(): void {
// Wait for document to load before retrieving bookmarks
setTimeout(() => {
this.retrieveBookmarks();
}, 1500);
}
public retrieveBookmarks(): void {
const bookmarks = this.pdfViewer.bookmark.getBookmarks();
this.bookmarkList = bookmarks || [];
console.log('Bookmarks retrieved:', this.bookmarkList);
}
public navigateTo(bookmark: any): void {
this.pdfViewer.bookmark.goToBookmark(bookmark.page, bookmark.y);
}
}Example 3: Custom Bookmark Sidebar
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { PdfViewerComponent, BookmarkViewService } from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `
<div style="display: flex; height: 100vh;">
<div style="width: 250px; overflow-y: auto; border-right: 1px solid #ccc; padding: 10px;">
<h3>Bookmarks</h3>
<div *ngIf="bookmarks.length === 0">
<p>No bookmarks available</p>
</div>
<ul style="list-style: none; padding: 0;">
<li *ngFor="let bookmark of bookmarks"
style="margin-bottom: 8px; cursor: pointer;"
(click)="handleBookmarkClick(bookmark)">
<button style="width: 100%; text-align: left;">
{{ bookmark.title }}
</button>
<ul *ngIf="bookmark.children && bookmark.children.length > 0"
style="list-style: none; padding-left: 15px;">
<li *ngFor="let child of bookmark.children"
style="margin-top: 5px; cursor: pointer;"
(click)="handleBookmarkClick(child); $event.stopPropagation()">
<button style="width: 100%; text-align: left; font-size: 0.9em;">
{{ child.title }}
</button>
</li>
</ul>
</li>
</ul>
</div>
<div style="flex: 1;">
<ejs-pdfviewer #pdfViewer id="pdfViewer"
[documentPath]="document"
[enableBookmark]="true"
(documentLoad)="onDocumentLoad()"
style="height:100%;display:block">
</ejs-pdfviewer>
</div>
</div>
`,
providers: [BookmarkViewService]
})
export class AppComponent {
@ViewChild('pdfViewer') public pdfViewer: PdfViewerComponent;
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
public bookmarks: any[] = [];
public onDocumentLoad(): void {
setTimeout(() => {
const allBookmarks = this.pdfViewer.bookmark.getBookmarks();
this.bookmarks = allBookmarks || [];
}, 1000);
}
public handleBookmarkClick(bookmark: any): void {
if (bookmark.page !== undefined && bookmark.y !== undefined) {
this.pdfViewer.bookmark.goToBookmark(bookmark.page, bookmark.y);
}
}
}Bookmark Data Structure
Each bookmark object returned by getBookmarks() has:
| Property | Type | Description | Example |
|---|---|---|---|
| title | string | Display name | "Chapter 1" |
| page | number | Zero-based page index | 0 (first page) |
| y | number | Vertical Y coordinate | 150 |
| children | array | Nested sub-bookmarks | [{title: "Section 1.1", ...}] |
[
{
title: "Chapter 1",
page: 0,
y: 150,
children: [
{ title: "Section 1.1", page: 2, y: 200, children: [] },
{ title: "Section 1.2", page: 5, y: 100, children: [] }
]
},
{
title: "Chapter 2",
page: 10,
y: 50,
children: []
}
]Best Practices
1. Always validate viewer reference before calling methods:
if (this.pdfViewer && this.pdfViewer.bookmark) {
this.pdfViewer.bookmark.goToBookmark(0, 0);
}2. Wait for PDF to load before accessing bookmarks:
- Use
documentLoadevent orsetTimeoutwith adequate delay (1-1.5s)
public onDocumentLoad(): void {
setTimeout(() => {
const bookmarks = this.pdfViewer.bookmark.getBookmarks();
this.bookmarkList = bookmarks || [];
}, 1000);
}3. Handle PDFs with no bookmarks gracefully:
getBookmarks()returns[]if no bookmarks exist
const bookmarks = this.pdfViewer.bookmark.getBookmarks();
if (!bookmarks || bookmarks.length === 0) {
console.log('No bookmarks available');
}4. Cache bookmarks in component property:
- Call
getBookmarks()once on document load, store result, reuse
5. Validate data before navigation:
public navigateToBookmark(bookmark: any): void {
if (typeof bookmark.page === 'number' && typeof bookmark.y === 'number') {
this.pdfViewer.bookmark.goToBookmark(bookmark.page, bookmark.y);
}
}6. Inject BookmarkViewService in providers:
- Bookmark features only work when
BookmarkViewServiceis injected in the component providers array
7. Use AfterViewInit lifecycle hook:
- Access viewer component methods after view initialization
ngAfterViewInit(): void {
setTimeout(() => {
// Safe to call bookmark methods here
}, 1500);
}Download in Angular PDF Viewer component
Brief: The Angular PDF Viewer component provides download functionality to save the currently loaded PDF document. Users can download PDFs either through the toolbar button or programmatically using the download method.
Table of Contents
Enable Download
The download feature allows users to save the currently loaded PDF document to their local system.
Property
enableDownload
Type
boolean
Default Value
true
Usage
import { Component, OnInit } from '@angular/core';
import { LinkAnnotationService, BookmarkViewService, MagnificationService,
ThumbnailViewService, ToolbarService, NavigationService,
TextSearchService, AnnotationService, TextSelectionService,
PrintService
} from '@syncfusion/ej2-angular-pdfviewer';
@Component({
selector: 'app-container',
template: `<div class="content-wrapper">
<ejs-pdfviewer id="pdfViewer"
[enableDownload]='true'
[documentPath]='document'
style="height:640px;display:block">
</ejs-pdfviewer>
</div>`,
providers: [ LinkAnnotationService, BookmarkViewService, MagnificationService,
ThumbnailViewService, ToolbarService, NavigationService,
AnnotationService, TextSearchService, TextSelectionService,
PrintService]
})
export class AppComponent implements OnInit {
public document = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';
}Note
When enabled, the download button appears in the PDF Viewer toolbar. This property works for both standalone and server-backed viewer modes.
---
Programmatic Download
Trigger a download action programmatically without user interaction with the toolbar button.
Method
download()
Usage
<script>
window.onload = function () {
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewer.download();
}
</script>Note
This method initiates the download of the currently loaded PDF document. Useful for implementing custom download buttons or automated save operations in your application workflow.
---
Download Filename
Specify the filename for the downloaded PDF document.
Property
downloadFileName
Type
string
Usage
<ejs-pdfviewer id="pdfViewer"
[downloadFileName]='customFileName'
[documentPath]='document'
style="height:640px;display:block">
</ejs-pdfviewer>Note
The filename can be set to provide a meaningful name for the downloaded file. If not specified, the default filename from the document or a generic name will be used.
---
Related Features
Toolbar Configuration
The download button can be customized as part of the toolbar settings. Refer to the toolbar items documentation for controlling the visibility and behavior of the download button within the toolbar.
Feature Modules
The download functionality requires specific service providers to be injected. Ensure the necessary feature modules like ToolbarService are included in your component providers for the download feature to work properly.
Events in Angular PDF Viewer
Reference: Official Syncfusion Angular PDF Viewer documentation on Events - comprehensive guide covering all event triggers for document lifecycle, navigation, annotations, forms, and user interactions
Brief: The Syncfusion Angular PDF Viewer component triggers multiple events that allow you to respond to user interactions and control the PDF viewing experience. These events include document loading, download, import/export, annotations, signatures, printing, form validation, text search and selection, hyperlinks, and page navigation.
How to Use Events in Angular PDF Viewer
// app.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.html'
})
export class AppComponent {
public onEventName(args: EventArgs): void {
// Event handling logic here
}
}<!-- app.html -->
<ejs-pdfviewer
id="pdfViewer"
[documentPath]="documentPath"
(eventName)="onEventName($event)"
style="height: 600px">
</ejs-pdfviewer>List of Events
| Event Name | Description | Args | Args Properties |
|---|---|---|---|
| bookmarkClick | Triggers when a bookmark item is clicked in the bookmark panel. | BookmarkClickEventArgs | name - (string) - The bookmark name that was clicked. target - (string) - The bookmark target/destination. |
| buttonFieldClick | Triggers when a button form field is clicked. | ButtonFieldClickEventArgs | name - (string) - The name of the button field. pageNumber - (number) - The page number where the button is located. |
| commentAdd | Triggers when a comment is added to the comment panel. | CommentEventArgs | id - (string) - The unique identifier of the comment. pageIndex - (number) - The page index where the comment was added. annotationId - (string) - The associated annotation ID. |
| commentDelete | Triggers when a comment is deleted from the comment panel. | CommentEventArgs | id - (string) - The unique identifier of the deleted comment. pageIndex - (number) - The page index of the deleted comment. |
| commentEdit | Triggers when a comment is edited in the comment panel. | CommentEventArgs | id - (string) - The unique identifier of the edited comment. pageIndex - (number) - The page index of the edited comment. |
| commentSelect | Triggers when a comment is selected in the comment panel. | CommentEventArgs | id - (string) - The unique identifier of the selected comment. pageIndex - (number) - The page index of the selected comment. |
| commentStatusChanged | Triggers when a comment's status changes in the comment panel. | CommentEventArgs | id - (string) - The comment identifier. status - (string) - The new status of the comment. pageIndex - (number) - The page index of the comment. |
| created | Triggers during the creation of the PDF Viewer component. | void | No Properties |
| customContextMenuBeforeOpen | Fires before the custom context menu opens. | CustomContextMenuBeforeOpenEventArgs | name - (string) - Event name. ids - (string[]) - Array of menu item ids that will be shown; remove ids to hide items for this open. |
| customContextMenuSelect | Fires when a custom context menu item is selected. | CustomContextMenuSelectEventArgs | name - (string) - Event name. id - (string) - The id of the clicked menu item. |
| documentLoad | Triggers while loading a document into the PDF Viewer. | LoadEventArgs | documentName - (string) - Name of the loaded document. pageData - (DocumentInfo) - Document information including page count and sizes. pageData.pageCount - (number) - Total page count of the document. |
| documentLoadFailed | Triggers when document loading fails. | LoadFailedEventArgs | documentName - (string) - Name of the document that failed to load. error - (string) - Error message describing the failure. |
| documentUnload | Triggers when the document is closed. | UnloadEventArgs | documentName - (string) - Name of the unloaded document. |
| downloadEnd | Triggers after a document is downloaded. | DownloadEndEventArgs | fileName - (string) - File name of the downloaded PDF document. status - (string) - Download completion status. |
| downloadStart | Triggers when the download action is initiated. | DownloadStartEventArgs | fileName - (string) - File name of the PDF document being downloaded. |
| exportFailed | Triggers when exporting annotations fails. | ExportFailureEventArgs | name - (string) - Event name. errorDetails - (string) - Details of the export failure. |
| exportStart | Triggers when exporting annotations starts. | ExportStartEventArgs | fileName - (string) - Name of the export file. |
| exportSuccess | Triggers when annotations are exported successfully. | ExportSuccessEventArgs | fileName - (string) - Name of the exported annotations file. |
| extractTextCompleted | Triggers when text extraction is completed. | ExtractTextCompletedEventArgs | documentTextCollection - (List<Dictionary>) - Returns the extracted text collection. pageTextContent.pageText - (string) - Extracted text from the page. pageTextContent.pageSize - (SizeF) - Dimensions of the page. |
| hyperlinkClick | Triggers when a hyperlink in the PDF document is clicked. | HyperlinkClickEventArgs | hyperlink - (string) - The URL of the clicked hyperlink. target - (string) - The target window/frame for the hyperlink. |
| hyperlinkMouseOver | Triggers when hovering over a hyperlink in the PDF document. | HyperlinkMouseOverArgs | hyperlink - (string) - The URL of the hovered hyperlink. name - (string) - Name associated with the hyperlink. |
| importFailed | Triggers when importing annotations fails. | ImportFailureEventArgs | name - (string) - Event name. errorDetails - (string) - Details of the import failure. |
| importStart | Triggers when importing annotations starts. | ImportStartEventArgs | fileName - (string) - Name of the import file. |
| importSuccess | Triggers when annotations are imported successfully. | ImportSuccessEventArgs | No Properties |
| keyboardCustomCommands | Triggers when customized keyboard command keys are pressed. | KeyboardCustomCommandsEventArgs | name - (string) - Event name. keyboardCommand - (object) - The command metadata raised by Command Manager. keyboardCommand.name - (string) - Name of the custom command. |
| moveSignature | Triggers when a signature is moved across the page. | MoveSignatureEventArgs | id - (string) - Signature identifier. pageNumber - (number) - Page number where signature was moved. |
| pageChange | Triggers when the current page number changes. | PageChangeEventArgs | currentPageNumber - (number) - Current page number. previousPageNumber - (number) - Previous page number before navigation. |
| pageClick | Triggers when a mouse click occurs on a page. | PageClickEventArgs | pageNumber - (number) - Page number where click occurred. x - (number) - X coordinate of the click. y - (number) - Y coordinate of the click. |
| pageMouseover | Triggers when moving the mouse over a page. | PageMouseoverEventArgs | name - (string) - Event name. pageX - (number) - Mouse X position relative to page. pageY - (number) - Mouse Y position relative to page. |
| pageOrganizerSaveAs | Triggers when a save as action is performed in the page organizer. | PageOrganizerSaveAsEventArgs | downloadDocument - (string) - Name of the document to be saved. |
| pageRenderComplete | Triggers after a page finishes rendering. | PageRenderCompleteEventArgs | data - (number) - Page number that completed rendering. |
| pageRenderInitiate | Triggers when page rendering begins. | PageRenderInitiateEventArgs | jsonData - (string) - JSON data for the page being rendered. |
| printEnd | Triggers when a print action is completed. | PrintEndEventArgs | documentName - (string) - Name of the printed document. |
| printStart | Triggers when a print action is initiated. | PrintStartEventArgs | documentName - (string) - Name of the document being printed. |
| removeSignature | Triggers when a signature is removed. | RemoveSignatureEventArgs | bounds - (object) - Bounds information of the removed signature. id - (string) - Signature identifier. |
| resizeSignature | Triggers when a signature is resized. | ResizeSignatureEventArgs | currentPosition - (object) - Current position and size of the resized signature. id - (string) - Signature identifier. |
| resourcesLoaded | Triggers after PDFium resources are loaded. | void | No Properties |
| signaturePropertiesChange | Triggers when signature properties are changed. | SignaturePropertiesChangeEventArgs | type - (string) - Type of property that changed. id - (string) - Signature identifier. |
| signatureSelect | Triggers when a signature is selected. | SignatureSelectEventArgs | signature - (object) - The selected signature object. id - (string) - Signature identifier. |
| signatureUnselect | Triggers when a signature is unselected. | SignatureUnselectEventArgs | signature - (object) - The unselected signature object. id - (string) - Signature identifier. |
| textSearchComplete | Triggers when a text search is completed. | TextSearchCompleteEventArgs | searchText - (string) - The text that was searched. results - (number) - Number of results found. |
| textSearchHighlight | Triggers when the searched text is highlighted. | TextSearchHighlightEventArgs | bounds - (object) - Bounds of the highlighted search result. pageIndex - (number) - Page index of the highlighted text. |
| textSearchStart | Triggers when a text search is initiated. | TextSearchStartEventArgs | searchText - (string) - The text being searched. matchCase - (boolean) - Whether search is case-sensitive. |
| textSelectionEnd | Triggers when text selection is complete. | TextSelectionEndEventArgs | pageIndex - (number) - Page index where text selection ended. textContent - (string) - The selected text content. |
| textSelectionStart | Triggers when text selection is initiated. | TextSelectionStartEventArgs | pageIndex - (number) - Page index where text selection started. |
| thumbnailClick | Triggers when a thumbnail is clicked in the thumbnail panel. | ThumbnailClickEventArgs | pageNumber - (number) - Page number of the clicked thumbnail. |
| toolbarClick | Triggers when a toolbar item is clicked. | ClickEventArgs | name - (string) - Name of the toolbar item clicked. id - (string) - Id of the toolbar item. |
| validateFormFields | Triggers when form field validation fails. | ValidateFormFieldsArgs | name - (string) - Event name. documentName - (string) - Name of the document. formField - (object) - The last interacted field's data. nonFillableFields - (array) - Array of required/invalid fields that failed validation. |
| zoomChange | Triggers when the magnification value changes. | ZoomChangeEventArgs | zoomValue - (number) - The new zoom percentage value. previousZoomValue - (number) - The previous zoom percentage value. |
---
PdfKeys
| Name | Description |
|---|---|
| A | Represents the key value A when the A key is pressed in the Keyboard |
| ArrowDown | Represents the key value ArrowDown when the ArrowDown key is pressed in the Keyboard |
| ArrowLeft | Represents the key value ArrowLeft when the ArrowLeft key is pressed in the Keyboard |
| ArrowRight | Represents the key value ArrowRight when the ArrowRight key is pressed in the Keyboard |
| ArrowUp | Represents the key value ArrowUp when the ArrowUp key is pressed in the Keyboard |
| B | Represents the key value B when the B key is pressed in the Keyboard |
| BackSpace | Represents the key value BackSpace when the BackSpace key is pressed in the Keyboard |
| C | Represents the key value C when the C key is pressed in the Keyboard |
| D | Represents the key value D when the D key is pressed in the Keyboard |
| Delete | Represents the key value Delete when the Delete key is pressed in the Keyboard |
| E | Represents the key value E when the E key is pressed in the Keyboard |
| End | Represents the key value End when the End key is pressed in the Keyboard |
| Enter | Represents the key value Enter when the Enter key is pressed in the Keyboard |
| Escape | Represents the key value Escape when the Escape key is pressed in the Keyboard |
| F | Represents the key value F when the F key is pressed in the Keyboard |
| F1 | Represents the key value F1 when the F1 key is pressed in the Keyboard |
| F10 | Represents the key value F10 when the F10 key is pressed in the Keyboard |
| F11 | Represents the key value F11 when the F11 key is pressed in the Keyboard |
| F12 | Represents the key value F12 when the F12 key is pressed in the Keyboard |
| F2 | Represents the key value F2 when the F2 key is pressed in the Keyboard |
| F3 | Represents the key value F3 when the F3 key is pressed in the Keyboard |
| F4 | Represents the key value F4 when the F4 key is pressed in the Keyboard |
| F5 | Represents the key value F5 when the F5 key is pressed in the Keyboard |
| F6 | Represents the key value F6 when the F6 key is pressed in the Keyboard |
| F7 | Represents the key value F7 when the F7 key is pressed in the Keyboard |
| F8 | Represents the key value F8 when the F8 key is pressed in the Keyboard |
| F9 | Represents the key value F9 when the F9 key is pressed in the Keyboard |
| G | Represents the key value G when the G key is pressed in the Keyboard |
| H | Represents the key value H when the H key is pressed in the Keyboard |
| Home | Represents the key value Home when the Home key is pressed in the Keyboard |
| I | Represents the key value I when the I key is pressed in the Keyboard |
| J | Represents the key value J when the J key is pressed in the Keyboard |
| K | Represents the key value K when the K key is pressed in the Keyboard |
| L | Represents the key value L when the L key is pressed in the Keyboard |
| M | Represents the key value M when the M key is pressed in the Keyboard |
| Minus | Represents the key value Minus when the Minus key is pressed in the Keyboard |
| N | Represents the key value N when the N key is pressed in the Keyboard |
| None | Represents a null key value when no keys are pressed |
| Number0 | Represents the key value 0 when the 0 key is pressed in the Keyboard |
| Number1 | Represents the key value 1 when the 1 key is pressed in the Keyboard |
| Number2 | Represents the key value 2 when the 2 key is pressed in the Keyboard |
| Number3 | Represents the key value 3 when the 3 key is pressed in the Keyboard |
| Number4 | Represents the key value 4 when the 4 key is pressed in the Keyboard |
| Number5 | Represents the key value 5 when the 5 key is pressed in the Keyboard |
| Number6 | Represents the key value 6 when the 6 key is pressed in the Keyboard |
| Number7 | Represents the key value 7 when the 7 key is pressed in the Keyboard |
| Number8 | Represents the key value 8 when the 8 key is pressed in the Keyboard |
| Number9 | Represents the key value 9 when the 9 key is pressed in the Keyboard |
| O | Represents the key value O when the O key is pressed in the Keyboard |
| P | Represents the key value P when the P key is pressed in the Keyboard |
| PageDown | Sets the key value as PageDown when page down key is pressed |
| PageUp | Represents the key value PageUp when the PageUp key is pressed in the Keyboard |
| Plus | Represents the key value Plus when the Plus key is pressed in the Keyboard |
| Q | Represents the key value Q when the Q key is pressed in the Keyboard |
| R | Represents the key value R when the R key is pressed in the Keyboard |
| S | Represents the key value S when the S key is pressed in the Keyboard |
| Space | Represents the key value Space when the Space key is pressed in the Keyboard |
| Star | Represents the key value Star when the Star key is pressed in the Keyboard |
| T | Represents the key value T when the T key is pressed in the Keyboard |
| Tab | Represents the key value Tab when the Tab key is pressed in the Keyboard |
| U | Represents the key value U when the U key is pressed in the Keyboard |
| V | Represents the key value V when the V key is pressed in the Keyboard |
| W | Represents the key value W when the W key is pressed in the Keyboard |
| X | Represents the key value X when the X key is pressed in the Keyboard |
| Y | Represents the key value Y when the Y key is pressed in the Keyboard |
| Z | Represents the key value Z when the Z key is pressed in the Keyboard |
---
PdfModifierKeys
| Name | Description |
|---|---|
| Alt | Represents the Alt key is pressed in the Keyboard |
| Control | Represents the Control key is pressed in the Keyboard |
| Meta | Represents the Meta key is pressed in the Keyboard |
| None | Represents no modifiers are pressed in the Keyboard |
| Shift | Represents the Shift key is pressed in the Keyboard |