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 Code
Blocking Rules
- NO code generation until Steps 1 & 2 are complete
- NO assumptions - Always verify workspace AND read reference files first
- 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 file
Report 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:
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:
- ALWAYS read
toolbar-settings.md first
- Use ONLY names from these sections:
- "Available Primary Toolbar Items"
- "Available Annotation Toolbar Items"
- "Available Form Designer Items"
- 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:
Reference files are SOURCE OF TRUTH - everything must trace back to them.
1---2name: syncfusion-angular-pdf-viewer3description: Implements the Syncfusion Angular PDF Viewer (PdfViewerComponent) for embedding, configuring, and loading PDF documents. Use this when rendering PDFs in an Angular application, embedding viewer controls, or generating TS/CSS code for PDF display and interaction.4---56# Syncfusion Angular PDF Viewer UI Sample Generator78Target package: `@syncfusion/ej2-angular-pdfviewer`910## Mandatory 3-Step workflow (Strict Enforcement)1112**EVERY query MUST follow these steps sequentially:**1314```15STEP 1: Workspace Detection ? STEP 2: Read Reference File ? STEP 3: Generate Code16```1718### Blocking Rules19201. **NO code generation** until Steps 1 & 2 are complete212. **NO assumptions** - Always verify workspace AND read reference files first223. **NO undocumented APIs** - Use ONLY APIs from reference files2324**Violation = STOP and restart with proper protocol**2526---2728## Mandatory Workflow2930### STEP 1: Workspace Detection *(REQUIRED - DO THIS FIRST)*3132**Execute these tools:**33```341. file_search: **/{package.json,angular.json,tsconfig.json}352. list_dir: src/app/363. read_file: package.json (if exists)37```3839**Report to user:**40```41?? STEP 1 COMPLETE:42- Workspace: [Empty / Angular X.X project detected]43- Files found: [list]44- Decision: [Create new / Use existing]45```4647### STEP 2: Read Reference File *(REQUIRED - DO THIS SECOND)*4849**Execute these steps:**50```511. Match user query to Reference File Routing Guide below522. Use read_file on: references\[filename].md533. Extract ALL steps/APIs from reference file54```5556**Report to user:**57```58?? STEP 2 COMPLETE:59- Reference file: [filename.md]60- Steps found: [list sequential steps]61- APIs validated: [list properties/methods used]62```6364### STEP 3: Generate Code *(EXECUTE ONLY AFTER STEPS 1 & 2)*6566**Validation checklist:**67- [ ] Every API cross-referenced against reference file68- [ ] No invented/assumed properties used69- [ ] Angular patterns followed (component bindings, lifecycle hooks)70- [ ] If API not in reference file ? DELETE it7172**If feature not in reference file:**73```74? FEATURE NOT SUPPORTED75The requested [feature/API] is not documented.76Available alternatives: [list from reference files]77```7879---8081## Reference File Routing Guide8283### Core Setup84| User Query Keywords | Reference File | Purpose |85|---|---|---|86| "basic", "create sample", "getting started", "load PDF" | [getting-started.md](references/getting-started.md) | Minimal PDFViewer setup |87| "configuration", "server settings", "locale" | [general-properties.md](references/general-properties.md) | Core viewer properties |88| "disable", "hide features", "enable/disable", "read-only" | [enable-properties.md](references/enable-properties.md) | Feature toggles |8990### Navigation91| User Query Keywords | Reference File | Purpose |92|---|---|---|93| "page navigation", "next/previous page", "go to page" | [page-navigation.md](references/page-navigation.md) | Page controls |94| "bookmarks", "table of contents", "TOC", "outline" | [bookmark-navigation.md](references/bookmark-navigation.md) | Bookmark navigation (use ViewChild) |95| "hyperlinks", "external links", "URL navigation" | [hyperlink-navigation.md](references/hyperlink-navigation.md) | Link handling |96| "thumbnails", "preview pages", "thumbnail panel" | [thumbnail-navigation.md](references/thumbnail-navigation.md) | Thumbnail panel |9798### Viewing & Interaction99| User Query Keywords | Reference File | Purpose |100|---|---|---|101| "zoom", "magnification", "fit to page", "scale" | [magnification.md](references/magnification.md) | Zoom controls |102| "text selection", "panning", "scroll mode" | [interaction-mode.md](references/interaction-mode.md) | Interaction modes |103| "select text", "copy text" | [text-selection.md](references/text-selection.md) | Text selection |104| "search", "find in PDF", "highlight search" | [text-search.md](references/text-search.md) | Search functionality |105106### Toolbar & Context Menu107| User Query Keywords | Reference File | Purpose |108|---|---|---|109| "customize toolbar", "hide toolbar items", "remove buttons" | [toolbar-settings.md](references/toolbar-settings.md) | Toolbar configuration |110| "show/hide toolbar dynamically", "toggle toolbar" | [toolbar-methods.md](references/toolbar-methods.md) | Programmatic toolbar control |111| "right-click menu", "context menu", "custom menu" | [contextmenu.md](references/contextmenu.md) | Context menu |112113### Annotations114| User Query Keywords | Reference File | Purpose |115|---|---|---|116| "annotation colors", "annotation styles", "customize annotations" | [annotation-settings.md](references/annotation-settings.md) | Annotation appearance |117| "annotation events", "when annotation added", "annotation callbacks" | [annotation-events.md](references/annotation-events.md) | Annotation lifecycle |118| "annotation labels", "shape labels", "measurement labels" | [shape-label-settings.md](references/shape-label-settings.md) | Label customization |119| "ink annotation", "freehand drawing", "signature", "sketch", "handwritten notes" | [ink-annotation.md](references/ink-annotation.md) | Ink annotations |120| "redaction", "redact content", "black out text" | [redaction-annotation.md](references/redaction-annotation.md) | Redaction annotations |121122### Forms123| User Query Keywords | Reference File | Purpose |124|---|---|---|125| "form field defaults", "form field styles" | [form-field-settings.md](references/form-field-settings.md) | Form field config |126| "form field events", "field changes", "validation" | [form-field-events.md](references/form-field-events.md) | Form field events |127128### Document Actions129| User Query Keywords | Reference File | Purpose |130|---|---|---|131| "download PDF", "save PDF", "export" | [download.md](references/download.md) | Download functionality |132| "print PDF", "print document" | [print.md](references/print.md) | Print functionality |133| "reorder pages", "rotate pages", "add/remove pages" | [organize-pages.md](references/organize-pages.md) | Page manipulation |134135### Advanced136| User Query Keywords | Reference File | Purpose |137|---|---|---|138| "load programmatically", "API methods", "extract text" | [api-methods.md](references/api-methods.md) | Programmatic control |139| "event list", "all events", "event reference" | [events.md](references/events.md) | Complete event list |140141---142143## Toolbar Item Name Validation (CRITICAL)144145**When generating toolbar configurations:**1461. **ALWAYS read `toolbar-settings.md` first**1472. **Use ONLY names from these sections:**148 - "Available Primary Toolbar Items"149 - "Available Annotation Toolbar Items"150 - "Available Form Designer Items"1513. **Character-by-character validation required** - No typos allowed152153**Common mistakes to prevent:**154- ? `AnotatetionEditTool` ? ? `AnnotationEditTool`155- ? `CalibrationOption` ? ? `CalibrateTool`156- ? `ShapeAnnotationOption` ? ? `ShapeTool`157158---159160## Quick Start Example161162Add 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.163164```typescript165import { Component, OnInit } from '@angular/core';166import { PdfViewerModule, LinkAnnotationService, BookmarkViewService,167 MagnificationService, ThumbnailViewService, ToolbarService,168 NavigationService, TextSearchService, TextSelectionService,169 PrintService, FormDesignerService, FormFieldsService,170 AnnotationService, PageOrganizerService } from '@syncfusion/ej2-angular-pdfviewer';171172@Component({173 selector: 'app-root',174 // specifies the template string for the PDF Viewer component175 template: `<div class="content-wrapper">176 <ejs-pdfviewer id="pdfViewer"177 [documentPath]='document'178 [resourceUrl]='resource'179 style="height:640px;display:block">180 </ejs-pdfviewer>181 </div>`,182 imports: [ PdfViewerModule ],183 providers: [ LinkAnnotationService, BookmarkViewService, MagnificationService,184 ThumbnailViewService, ToolbarService, NavigationService,185 TextSearchService, TextSelectionService, PrintService,186 AnnotationService, FormDesignerService, FormFieldsService, PageOrganizerService]187})188export class AppComponent implements OnInit {189 public document: string = 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';190 public resource: string = window.location.origin + "/assets/ej2-pdfviewer-lib";191 192 ngOnInit(): void {193 }194}195```196197## Settings Configurations198199### Rule 1: Simple Settings (1-3 properties) ? Inline200```typescript201public annotationSelection = {202 selectionBorderColor: 'blue',203 resizerSize: 8204};205```206207### Rule 2: Complex Settings (4+ properties or enums) ? Import enums208```typescript209import { AnnotationResizerLocation, CursorType } from '@syncfusion/ej2-angular-pdfviewer';210211public annotationSelection = {212 selectionBorderColor: '#0000ff',213 resizerSize: 8,214 resizerLocation: AnnotationResizerLocation.Corners | AnnotationResizerLocation.Edges,215 resizerCursorType: CursorType.grab216};217```218219---220221## Protocol Violation Handling222223| Violation | Fix |224|---|---|225| Skipped Step 1 | Re-run: Use file_search and list_dir first |226| Skipped Step 2 | Re-run: Use read_file on reference file |227| Used undocumented API | Delete it, check reference for alternatives |228| Didn't report findings | Report: "I checked X, found Y, now doing Z" |229230**If user calls out violation: IMMEDIATELY acknowledge, apologize, and restart with proper protocol.**231232---233234## Enforcement Checklist235236**Before generating code, verify:**237- [ ] Step 1 executed (workspace detection) and reported238- [ ] Step 2 executed (reference file read) and reported239- [ ] Every API validated against reference file240- [ ] No undocumented APIs used241- [ ] Angular patterns followed242243**Reference files are SOURCE OF TRUTH - everything must trace back to them.**