
Syncfusion Blazor Pdf Viewer
- 1 installs
- 1 repo stars
- Updated July 6, 2026
- syncfusion/pdf-viewer-sdk-skills
Generates Blazor C# and Razor code to embed the Syncfusion SfPdfViewer for PDF viewing, annotation, text search, form filling, and navigation.
About
Generates copy-pasteable C# and Razor code that integrates the Syncfusion.Blazor.SfPdfViewer control into a Blazor application. A developer uses it when adding PDF rendering, annotation, search, or form filling to Blazor apps.
- Uses the Syncfusion.Blazor.SfPdfViewer NuGet package
- Strict mode: only generates APIs documented in the reference files
Syncfusion Blazor Pdf Viewer by the numbers
- 1 all-time installs (skills.sh)
- Ranked #121 of 153 .NET & C# 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-blazor-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 Blazor C# and Razor code to embed the Syncfusion SfPdfViewer for PDF viewing, annotation, text search, form filling, and navigation.
Files
Syncfusion Blazor Pdfviewer – UI Sample
NuGet: Syncfusion.Blazor.SfPdfViewer + Syncfusion.Blazor.Themes Namespace: Syncfusion.Blazor.SfPdfViewer
Generate C# Code for the User's Project (default)
Trigger keywords: "how to", "add pdfviewer", "code sample", "show me", "example", "snippet", "integrate", "component", "create sample".
Purpose: Generate minimal, copy-pasteable C# and Razor code that the user can integrate directly into their Blazor project.
Workflow:
⚠️ CRITICAL — Feature Support Policy (STRICT MODE):
FUNDAMENTAL RULE: Only generate code using APIs and properties that are EXPLICITLY listed in the reference files. ANY deviation is a VIOLATION.
- MANDATORY CHECKS BEFORE GENERATING ANY CODE:
1. Search the reference files for the exact API/property name 2. Verify it appears in the Method Reference, Properties, or Events tables 3. If NOT found in ANY reference file, STOP immediately 4. Do NOT generate or suggest undocumented APIs under any circumstances
- STRICT ENFORCEMENT - ZERO TOLERANCE:
- NO custom properties - Only use properties from reference file tables
- NO invented methods - Only use methods from reference file tables
- NO workarounds with undefined APIs - Forbidden
- NO assumptions about undocumented behavior - Forbidden
- NO alternative implementations using guess-work - Forbidden
- NO pretending support exists - Forbidden
- MANDATORY RESPONSE FOR UNSUPPORTED FEATURES:
- If a requested scenario/feature/API is NOT listed in any reference file, you MUST respond with:
"This feature is not supported in the current Syncfusion Blazor PDF Viewer implementation."- Then list what IS supported from the appropriate reference file
- Never suggest alternatives unless explicitly documented in reference files
- REFERENCE FILE HIERARCHY:
- Each reference file contains complete, authoritative documentation for its domain
- The tables (Method Reference, Properties, Events) are the SOURCE OF TRUTH
- Content outside these tables in reference files is explanatory only
- Do NOT extend beyond what appears in the reference file tables
- AUDIT YOUR GENERATION:
- Before providing any code, verify EVERY API used appears in a reference file table
- Document which reference file each API comes from
- If you cannot cite a reference file table entry, DELETE that code
- This is a CRITICAL REQUIREMENT. Violations compromise the skill's integrity and reliability.
Step 1 — Detect the Application Type (REQUIRED - DO NOT SKIP)
- Use file_search and read_file tools to inspect workspace project files:
.csprojfile (project configuration)Program.cs(startup configuration)_Imports.razor(namespace imports)App.razor(root component)- Any existing
.razorfiles in Components/Pages - Output: Confirm the detected application type (e.g., "Blazor WebApp" or "Blazor Server") before proceeding.
Step 2 — Generate Code from Reference Files Only (REQUIRED)
- Before generating: Confirm that Steps 1 are complete
- Read the relevant
references/*.mdfile(s) for the requested feature - Cross-reference EVERY API, property, and method against these tables
- DECLARATIVE-ONLY APPROACH (MANDATORY - NO LIFECYCLE METHODS):
- Use ONLY property binding in Razor markup similar lifecycle methods.
- Configure all PDF Viewer properties directly as component attributes
- MANDATORY: Before generating ANY code, verify that reference files exist and are accessible
- Read the appropriate reference file(s) for the requested feature:
- Use
read_filetool on relevantreferences/*.mdfiles - Confirm file contains Methods/Properties/Events tables
- Verify tables are complete and readable
- If reference file is missing or cannot be read:
- STOP code generation
- Respond: "Reference file for this feature is not available. Please ensure all reference files are present in the
references/directory." - List the missing reference file name
- This is a BLOCKER step: Cannot proceed without reference file validation
- If an API/property does NOT appear in the reference file table, DO NOT USE IT
- Do NOT invent, guess, or suggest any API, method, property, class, or namespace not explicitly present in the reference files
Code References
All templates and operation snippets live in references/*.md. Each file is a focused snippet or template the agent will combine when generating samples.
Flow: Always start with getting-started.md, then merge matched features into its anchors (PROPS, EVENTS, UI_BUTTONS, HANDLERS). If no keyword matches, return only the basic sample.
| File | Purpose |
|---|---|
| getting-started.md | Foundation setup and minimal PDF Viewer component. Includes complete setup prerequisites. Provides minimal working component with DocumentPath, Height, Width properties and feature anchor points. Use as foundation for all PDF Viewer implementations with proper project setup and configuration validation. |
| toolbar-properties.md | Comprehensive toolbar customization using PdfViewerToolbarSettings. Includes 11 properties (ShowTooltip, EnableToolbar, EnableAnnotationToolbar, IsAnnotationToolbarVisible, ToolbarSettings, ToolbarClicked, ToolbarItems, AnnotationToolbarItems, FormDesignerToolbarItems, MobileToolbarItems, RedactionToolbarItems, CustomToolbarItems), 5 specialized toolbars (Primary, Annotation, FormDesigner, Mobile, Redaction) with 14/22/9/7/7 items respectively, and 7 code examples. Use to simplify UI for workflows, create role-based tool access, optimize mobile experience, add custom functionality, and control annotation/form/redaction capabilities. |
| toolbar-methods.md | Programmatic control methods for toolbar visibility and behavior. Includes 5 methods (ShowToolbarAsync, ShowAnnotationToolbar, ShowRedactionToolbar, EnableToolbarItemsAsync, ShowToolbarItemsAsync), 14 toolbar items for granular control (OpenOption, PrintOption, DownloadOption, SearchOption, MagnificationTool, PageNavigationTool, SelectionTool, PanTool, AnnotationEditTool, CommentTool, FormDesigner, SubmitForm, UndoRedoTool, Redaction). |
| magnification.md | Programmatic zoom/magnification control with 10 properties, 7 methods, 1 event, and comprehensive decision guidance. Properties: ZoomMode (Default/FitToPage/FitToWidth/FitToHeight), ZoomValue (10-400%), MinZoomValue, MaxZoomValue , EnableMagnification, EnablePinchZoom, EnableZoomOptimization, RestrictZoomRequest, ZoomValueChanged callback, TileRenderingSettings. Methods: ZoomAsync(exact %), ZoomInAsync (step to preset), ZoomOutAsync (step to preset), FitToPageAsync, FitToWidthAsync, FitToHeightAsync, GetZoomPercentageAsync. Events: ZoomChanged (CurrentZoomValue, PreviousZoomValue). |
| text-search.md | Complete text search functionality for PDF document content discovery and navigation. EnableTextSearch property to toggle search availability. Text search methods (4 total): SearchTextAsync (string searchText, bool isMatchCase for case-sensitive/insensitive search), SearchNextAsync (navigate to next result), SearchPreviousAsync (navigate to previous result), CancelTextSearchAsync (clear highlights and cancel). Search configuration: PdfViewerTextSearchColorSettings with SearchColor (found text color), SearchHighlightColor (highlighted text color) for visual customization. Search events (3 total): OnTextSearchStart (SearchText, MatchCase parameters), OnTextSearchComplete (SearchText, MatchCase for completion tracking), OnTextSearchHighlight (PageNumber, coordinates for result location tracking). |
| annotation-events.md | Comprehensive reference for annotation lifecycle, interaction, and signature-specific events (20+ events total). Includes event subscription patterns, event categories (add/modify/delete, select/move/resize, signature operations), complete event list with detailed arguments and properties, and supporting type definitions. |
| annotation-properties.md | Reference for enabling/disabling 13+ annotation feature types (FreeText, Shape, TextMarkup, StickyNotes, Ink, Handwritten Signature, Measure, Stamp, Image) via boolean properties. Includes programmatic methods (SetAnnotationModeAsync, UpdateMeasurementSettingsAsync), export configuration (filename, format), signature control (editability, digital appearance), and comprehensive type definitions (AnnotationType, DynamicStampItem, SignStampItem, StandardBusinessStampItem). |
| annotation-settings.md | Configuration for default appearance, behavior, size constraints, and restrictions across 20+ annotation types (22+ settings classes). Properties control colors (stroke, fill, font, border), size constraints (min/max width/height), locking (IsLock, AllowedInteractions), print/download inclusion, author info. |
| redaction-settings.md | Complete configuration API for redaction settings to permanently remove sensitive information from PDFs. Core overlay properties (9 total): OverlayText, MarkerFillColor, MarkerBorderColor, MarkerOpacity (transparency 0-1), FontColor, FontSize, FontFamily, IsRepeat, TextAlignment. Security and control properties: AllowedInteractions, IsLock, Author, CustomData, IsPrint. Size constraints: MinWidth, MaxWidth, MinHeight, MaxHeight for dimensional control. Download/Print control: SkipPrint, SkipDownload, IsPrint for document persistence. Visual styling: BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Annotation selector settings. |
| programmatical-annotation-methods.md | Complete API for programmatic annotation lifecycle management, redaction, and export/import workflows. Annotation CRUD methods (15 total): AddAnnotationAsync (4 variants for basic/DynamicStamp/SignStamp/StandardBusinessStamp), AddAnnotationsAsync (batch), EditAnnotationAsync, DeleteAnnotationAsync (3 variants: no params/by object/by ID), DeleteAnnotationsAsync (3 variants), GetAnnotationsAsync, SelectAnnotationAsync (2 variants), ClearSelectionAsync. Redaction methods: AddPageRedactionsAsync, RedactAsync (permanent). Export/Import: ExportAnnotationAsync (Json/Xfdf formats), ExportAnnotationAsStreamAsync, ExportAnnotationsAsObjectAsync, ImportAnnotationAsync (stream/object). |
| command-manager.md | Dual feature reference for custom keyboard shortcuts and comment panel customization. Command Manager: PdfViewerCommandManager with KeyboardCommand/KeyGesture for mapping key combinations to custom actions via CommandExecutedEventArgs. Comment Panel Settings: PdfViewerCommentPanelSettings with Multiline (enable detailed multi-line comments), DateTimeFormat (custom timestamp formats), and visibility control (CommentPanelVisible bool, CommentPanelVisibleChanged event for two-way binding). |
| document-properties.md | Document-level configuration, metadata, and lifecycle events for PDF handling. Properties: EnableChunkMessages (large file processing). Events (8 total): DocumentLoaded, DocumentLoadFailed, DocumentUnloaded, DocumentEdited (EditingAction: AnnotationAdded/Deleted/Updated, FormFieldImported/Updated), PageMouseover (PageX/Y coordinates), OnPageClick (click coordinates). |
| file-save-properties.md | File download and annotation export/import functionality with complete event-driven workflows. Property: EnableDownload (toggle for toolbar download button). Method: DownloadAsync(references) for programmatic document download. Events (8 total): DownloadStart (FileName), DownloadEnd (DownloadDocument base64 string, FileName), ExportStarted, ExportSucceed (FileName), ExportFailed (ErrorDetails), ImportStarted, ImportSucceed, ImportFailed (ErrorDetails). Use for document persistence workflows, download tracking and logging, annotation export/import operations, user feedback on file operations, error handling for failed imports/exports. |
| ui-properties.md | Core UI properties and hyperlink interaction events for customizing the viewer experience. Includes 4 properties (EnableDesktopMode, EnableErrorDialog, EnableHyperlink, EnableRtl) for controlling UI behavior and device modes, 3 events (OnHyperlinkClick, OnHyperlinkMouseOver, Created) for handling hyperlink navigation and lifecycle, and 4 code examples. Use to customize viewer appearance for different devices, control hyperlink navigation, manage error handling, and support internationalization (RTL). |
| form-field-properties.md | Core form field configuration and design mode control (4 properties, 1 method). Properties: EnableFormDesigner (enable/disable form designer tool), EnableFormFields (control user interaction with existing fields), EnableFormFieldsValidation (enable automatic validation), IsFormFieldDocument (read-only detection of form fields in PDF), EnableAutoComplete (form field auto-completion). Method: SetFormDrawingModeAsync(FormFieldType?) for programmatically setting form field drawing mode with support for 8 field types (Button, CheckBox, DropDown, ListBox, Password, RadioButton, SignatureField, Textbox). Use for form designer workflow control, form field interaction management, auto-validation setup, document capability detection, and dynamic form field type switching. |
| form-field-settings.md | Visual appearance and styling configuration for form fields with 7 properties and comprehensive decision guidance. Properties: BackgroundColor (HEX/RGB/CSS colors), BorderColor, Color (text color), FontFamily, FontSize (double type), FontStyle, Thickness. |
| form-designer-events.md | Comprehensive form field event reference for lifecycle, interaction, validation, and data management (20+ events). Event categories: Lifecycle (FormFieldAdding/Added/Deleted/PropertyChanged with cancellation support), Interaction (Selected/Unselected/Click/DoubleClick/Resized/FocusIn/FocusOut with coordinates), Mouse (MouseEnter/Leave with PageX/PageY), Validation (ValidateFormFields with UnfilledFields dictionary), Import/Export (Importing/Imported/ImportFailed, Exporting/Exported/ExportFailed with ErrorDetails), Designer Mode (IsDesignerModeChanged). |
| programmatical-form-field-methods.md | Complete API for programmatic form field lifecycle management, batch operations, and export/import workflows. Form field CRUD methods (13 total): AddFormFieldsAsync (batch add), GetFormFieldsAsync (retrieve all), UpdateFormFieldsAsync (single/batch variants), DeleteFormFieldsAsync (3 variants: all/selected/by IDs), SelectFormFieldAsync (by object/by ID), RetrieveFormFieldsAsync (legacy). Export/Import: ExportFormFieldsAsync (with format parameter), ExportFormFieldsAsObjectAsync, ImportFormFieldsAsync (Dictionary/Stream variants with format parameter). |
| thumbnail-bookmark.md | Comprehensive reference for programmatic navigation, text selection, and thumbnail/bookmark panel management. Includes 5 methods (ClearTextSelectionAsync, GetBookmarksAsync, GoToBookmarkAsync, OpenThumbnailPaneAsync, SelectTextRegionAsync), 4 UI properties (EnableBookmarkPanel, EnableTextSelection, EnableThumbnailPanel, IsThumbnailPanelOpen), and 3 interaction events (OnTextSelectionEnd, OnTextSelectionStart, OnThumbnailClick). Use to implement custom navigation UIs, programmatic text highlighting, bookmark-based workflows, and text selection management. |
| contextmenu-settings.md | When the user needs to customize the PDF Viewer's as context menu settings and its properties. It used to customize the options in the context menu feature options modification and describes about it behaviour. |
| undo-redo-properties.md | Comprehensive undo/redo functionality for tracking and reversing document changes. Includes 4 properties (CanUndo, CanUndoChanged, CanRedo, CanRedoChanged) for tracking undo/redo state with event callbacks for two-way binding, 2 async methods (UndoAsync, RedoAsync) for performing undo/redo operations, and 2 code examples. Tracks all user actions including annotations, form field entries, edits, and modifications. Use to implement undo/redo buttons, track document edit history, provide keyboard shortcuts (Ctrl+Z/Ctrl+Y), and manage document state changes. |
| navigation-methods.md | Programmatic page navigation control and document information retrieval (9 methods total). Methods: GoToFirstPageAsync/GoToLastPageAsync/GoToNextPageAsync/GoToPreviousPageAsync, GoToPageAsync for jumps (1-based indexing), GetPageCountAsync (async total page count), GetPageDetails (sync page metadata List<PageInfo>), ShowNavigationToolbarAsync(bool) (toolbar visibility), ToggleItemByIndex(int) (panel toggle). Implementation notes: 1-based indexing, all GoTo* methods async (require await), GetPageCountAsync async, GetPageDetails synchronous, invalid page numbers keep current page. |
| navigation-properties.md | Properties for page state tracking, navigation toolbar customization, and UI synchronization in the PDF viewer. Includes CurrentPageNumber, PageCount, and event callbacks (CurrentPageNumberChanged, PageCountChanged) for real-time page monitoring. Configure NavigationToolbarSettings to show/hide built-in items (Thumbnails, Bookmarks, CommentPanel, PageOrganizer) or inject custom toolbar buttons and separators for the Navigation Toolbar |
| page-organizer.md | Complete API for programmatic page manipulation, document structure editing, and page organizer UI configuration. Page operation methods (8 total): DeletePagesAsync, DuplicatePagesAsync, ExtractPagesAsync, ExtractPagesAsStreamAsync, InsertPagesAsync, InsertBlankPagesAsync, MovePagesAsync, RotatePagesAsync, RotatePagesToAngleAsync support index-based (0-based) page operations. PageOrganizerSettings provides feature control (CanDelete, CanInsert, CanRotate, CanDuplicate, CanRearrange, CanImport, CanExtractPages), thumbnail zoom management (ImageZoom, ShowImageZoomingSlider, ImageZoomMin/Max), and footer button visibility (Save/SaveAs). Events: PageOrganizerSaveRequested, PageOrganizerZoomChanged, PageSelected (SelectedPages list) for save/zoom workflows. |
| page-organizer-settings.md | Dedicated settings configuration for the page organizer feature. Properties (12 total): CanDelete, CanInsert, CanRotate, CanDuplicate, CanRearrange, CanImport, CanExtractPages (bool feature toggles), ImageZoom (thumbnail zoom level), ShowImageZoomingSlider, ImageZoomMin/ImageZoomMax, FooterButtons (FooterButton enum for Save/SaveAs visibility). Use with PageOrganizerSettings tag to granularly control which page operations are permitted and configure thumbnail zoom behavior. |
| print.md | Print capabilities configuration, quality control, and event-driven workflows for PDF documents. Print control properties (4 total): EnablePrint (bool toggle for toolbar print button), EnablePrintRotation (bool auto-rotate landscape documents on print), PrintScaleFactor (quality of print image), PrintMode (Default/NewWindow enum for print dialog location). Print method: PrintAsync(references) for programmatic printing. Print events (2 total): PrintStart (Cancel bool for permission validation, FileName for document tracking), PrintEnd (FileName for audit logging and post-print actions). |
| pdfviewer-properties.md | General configuration properties of the Blazor SfPdfViewer component controlling UI appearance and viewer behavior. Properties (15 total): Height, Width (scrollable dimensions), Id (DOM element ID), CssClass (custom styling), DocumentPath (initial PDF path), DownloadFileName (download file name), Locale (culture/localization), InteractionMode, HyperlinkOpenState, CustomFonts (local font paths for document text), FallbackFontCollection (Dictionary<string, Stream> for custom FreeText fonts), FontFamilies (preferred font list), RetryCount (service call retry count), IsDocumentEdited (read-only edit state tracking). Use to configure initial viewer appearance, font support, interaction behavior, and localization. |
| pdfviewer-methods.md | Core lifecycle and document operation methods of the Blazor SfPdfViewer component. Methods (8 total): LoadAsync(string/Stream/byte[], password) for loading PDFs from path/URL/stream/byte array, SaveAsync(filePath) for server-side save, UnloadAsync(references) for memory cleanup, GetDocumentAsync(references) to retrieve modified document as byte[], UpdateViewerContainerAsync(references) for responsive layout reflow, DownloadAsync(references) for browser download, Dispose(references)/Dispose(bool) for resource cleanup. Use for programmatic document lifecycle management, loading PDFs from different sources, saving changes, and container responsiveness. |
| annotation-methods.md | Programmatic annotation mode control methods for the Blazor SfPdfViewer. Methods (2 total): SetAnnotationModeAsync(AnnotationType) to activate a specific annotation type for next user interaction, SetAnnotationModeAsync(AnnotationType, DynamicStampItem?, SignStampItem?, StandardBusinessStampItem?) overload for stamp annotation types (Dynamic/Sign/StandardBusiness), UpdateMeasurementSettingsAsync(references) to update measure settings for existing measure annotations. Use to programmatically switch annotation modes without toolbar interaction, implement custom annotation toolbars, and automate annotation workflows. |
| annotation-selector-settings.md | Global annotation selector appearance configuration via PdfViewerAnnotationSelectorSettings. Properties (9 total): ResizerBorderColor (resizer handle border), ResizerCursorType, ResizerFillColor (resizer handle fill), ResizerLocation, ResizerShape (AnnotationResizerShape: Square/Circle), ResizerSize (handle size in px), SelectionBorderColor (selection outline color), SelectionBorderThickness (selection border width 1–10, default 1), SelectorLineDashArray (dash pattern double[]). Use with PdfViewerAnnotationSelectorSettings tag for common selector styling across all annotation types. |
| area-annotation-settings.md | Default appearance and behavior configuration for area annotations via PdfViewerAreaSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default area annotation appearance, size constraints, lock behavior, and print/download inclusion. |
| arrow-annotation-settings.md | Default appearance and behavior configuration for arrow annotations via PdfViewerArrowSettings. Properties (19 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, LineHeadEndStyle, LineHeadStartStyle. Use to configure default arrow annotation styling including head styles for both ends. |
| circle-annotation-settings.md | Default appearance and behavior configuration for circle annotations via PdfViewerCircleSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default circle annotation appearance, size constraints, lock behavior, and print/download inclusion. |
| command-panel.md | Comment panel visibility and behavior configuration for the PDF Viewer. Properties (3 total): EnableCommentPanel (bool — enables/disables comment panel feature), CommentPanelVisible (bool, default false — show/hide the panel UI), CommentPanelVisibleChanged (EventCallback<bool> — two-way binding callback). CommentPanelSettings: Multiline (bool, default false — enable multi-line text boxes), DateTimeFormat (string — custom timestamp format). Use to control comment panel availability, visibility state, and comment entry UX for annotation review workflows. |
| custom-stamp-annotation-settings.md | Default appearance and behavior configuration for custom stamp/image annotations via PdfViewerCustomStampSettings. Properties (21 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, Height, Width, CustomStamps (List<PdfViewerCustomStamp> with CustomStampName and CustomStampImageSource), EnableCustomStamp (bool, default true), IsAddToMenu (bool — persist new stamps in menu). Use to configure custom image stamps and manage the stamp menu collection. |
| distance-annotation-settings.md | Default appearance and behavior configuration for distance measurement annotations via PdfViewerDistanceSettings. Properties (20 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, LineHeadEndStyle, LineHeadStartStyle, LeaderLength. Use to configure distance measurement annotation defaults including line head styles and leader length. |
| free-text-annotation-settings.md | Default appearance and behavior configuration for free text annotations via PdfViewerFreeTextSettings. Properties (27 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, Opacity, Height, Width, AllowEditTextOnly (bool — restrict to text edits only), AutoFit (bool — auto-resize to content), BorderColor, BorderStyle, BorderThickness, DefaultText, FillColor, FontColor, FontFamily, FontSize (int, default 16), FontStyle, TextAlignment. Use to fully customize free text annotation default appearance and editing behavior. |
| handwritten-signature-settings.md | Default appearance and behavior configuration for handwritten signature annotations via PdfViewerHandwrittenSignatureSettings. Properties (19 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, Height, Width, SignatureDialogSettings (PdfViewerSignatureDialogSettings with DisplayMode, HideSaveSignature, SignatureFonts). Use to configure handwritten signature defaults including the signature capture dialog options. |
| highlight-annotation-settings.md | Default appearance and behavior configuration for highlight annotations via PdfViewerHighlightSettings. Properties (11 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, Opacity, Color, EnableMultiPageAnnotation (bool — allow multi-page highlighting), EnableTextMarkupResizer (bool — show resize handles). Use to set highlight annotation defaults including multi-page support and resizer visibility. |
| ink-annotation-settings.md | Default appearance and behavior configuration for ink annotations via PdfViewerInkAnnotationSettings. Properties (18 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, Height, Width. Use to configure default ink/freehand annotation appearance and size constraints. |
| line-annotation-settings.md | Default appearance and behavior configuration for line annotations via PdfViewerLineSettings. Properties (19 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, LineHeadEndStyle, LineHeadStartStyle. Use to configure default line annotation styling including configurable line head start and end styles. |
| measurement-annotations-settings.md | Global measurement unit and scale configuration for all measurement annotations via PdfViewerMeasurementSettings. Properties (4 total): ConversionUnit (CalibrationUnit enum), Depth (int), DisplayUnit (CalibrationUnit enum), ScaleRatio (double — multiplied against actual measurement for display). Use to set consistent measurement units and scale ratios across all distance, perimeter, area, radius, and volume measurement annotations. |
| navigation-toolbar-settings.md | Navigation toolbar and panel configuration for the left-side navigation UI. Related properties: EnableNavigationToolbar (bool — show/hide left navigation toolbar), EnableNavigationPanel (bool — enable modern navigation panel for custom items). NavigationToolbarSettings: BuiltInItems (List<NavigationToolbarItem>: Thumbnails, Bookmarks, CommentPanel, PageOrganizer), CustomItems (List<CustomNavigationToolbarItem> with Name, HeaderText, IconCss, Index, TooltipText, ItemType, Template for RenderFragment panel content). Use to customize which navigation panels appear and inject fully custom panel templates with interactive content. |
| perimeter-annotation-settings.md | Default appearance and behavior configuration for perimeter measurement annotations via PdfViewerPerimeterSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default perimeter measurement annotation appearance, size constraints, and interaction restrictions. |
| polygon-annotation-settings.md | Default appearance and behavior configuration for polygon annotations via PdfViewerPolygonSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default polygon annotation appearance, size constraints, lock behavior, and print/download inclusion. |
| radius-annotation-settings.md | Default appearance and behavior configuration for radius measurement annotations via PdfViewerRadiusSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default radius measurement annotation appearance, size constraints, and interaction restrictions. |
| rectangle-annotation-settings.md | Default appearance and behavior configuration for rectangle annotations via PdfViewerRectangleSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default rectangle annotation appearance, size constraints, lock behavior, and print/download inclusion. |
| signature-annotation-events.md | Lifecycle and interaction events specific to handwritten signature annotations (7 events total). Events: AddSignature (Bound, Opacity, StrokeColor, Thickness, Id, PageNumber), MoveSignature (CurrentPosition, PreviousPosition, Opacity, StrokeColor, Thickness, Id, PageNumber), RemoveSignature (Bound, Id, PageNumber), ResizeSignature (CurrentPosition, PreviousPosition, Opacity, StrokeColor, Thickness, Id, PageNumber), SignaturePropertiesChange (IsOpacityChanged, IsStrokeColorChanged, IsThicknessChanged, NewValue, OldValue, Id, PageNumber), SignatureSelected (Id, PageNumber), SignatureUnselected (Id, PageNumber). Use to track signature lifecycle, validate changes, and synchronize signature state with application data. |
| squiggly-annotation-settings.md | Default appearance and behavior configuration for squiggly annotations via PdfViewerSquigglySettings. Properties (11 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, Opacity, Color (squiggly color), EnableMultiPageAnnotation (bool), EnableTextMarkupResizer (bool). Use to set squiggly text markup annotation defaults including multi-page support and resizer visibility. |
| stamp-annotation-settings.md | Default appearance and behavior configuration for stamp/image annotations via PdfViewerStampSettings. Properties (22 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness, Height, Width, DateTimeFormat (custom date/time format for dynamic stamps), DynamicStamps (List<DynamicStampItem>), SignStamps (List<SignStampItem>), StandardBusinessStamps (List<StandardBusinessStampItem>). Use to configure which built-in stamp types appear in the annotation toolbar and customize stamp defaults. |
| stickynotes-annotation-settings.md | Default appearance and behavior configuration for sticky notes annotations via PdfViewerStickyNotesSettings. Properties (11 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, Opacity. Use to set sticky note annotation defaults including interaction restrictions, size constraints, and print/download behavior. |
| strikethrough-annotation-settings.md | Default appearance and behavior configuration for strikethrough annotations via PdfViewerStrikethroughSettings. Properties (11 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, Opacity, Color (strikethrough color), EnableMultiPageAnnotation (bool), EnableTextMarkupResizer (bool). Use to set strikethrough text markup annotation defaults including multi-page support and resizer visibility. |
| text-selection-and-extraction.md | Describes about the functionalities of the text selection and text extraction process via EnableTextSelection, IsExtractText for enable or disable properties, ClearTextSelectionAsync and SelectTextRegionAsync methods for programmtical text selection, OnTextSelectionEnd, OnTextSelectionStart, ExtractTextCompleted events for tracking the process. |
| tile-rendering.md | Tile rendering configuration for performance optimization via PdfViewerTileRenderingSettings. Properties (3 total): EnableTileRendering (bool — enable/disable tile-based rendering), X (int — horizontal tile coordinate count), Y (int — vertical tile coordinate count). Use to enable tile rendering for large or complex PDFs to improve rendering performance by splitting pages into tiles. |
| underline-annotation-settings.md | Default appearance and behavior configuration for underline annotations via PdfViewerUnderlineSettings. Properties (11 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, Opacity (0–1), Color (underline color), EnableMultiPageAnnotation (bool), EnableTextMarkupResizer (bool). Use to set underline text markup annotation defaults including multi-page support and resizer visibility. |
| volume-annotation-settings.md | Default appearance and behavior configuration for volume measurement annotations via PdfViewerVolumeSettings. Properties (17 total): AllowedInteractions, Author, CustomData, IsLock, IsPrint, MaxHeight, MaxWidth, MinHeight, MinWidth, SkipDownload, SkipPrint, AnnotationSelectorSettings, BorderDashArray, FillColor, Opacity, StrokeColor, Thickness. Use to set default volume measurement annotation appearance, size constraints, and interaction restrictions. |
| azure-container-deployment.md | Comprehensive guide for deploying Blazor PDF Viewer applications to Azure using Docker containers, Azure Container Registry (ACR), and Azure App Service. Covers prerequisites, Dockerfile configurations for Server and WebAssembly modes, native dependency requirements (libgdiplus), local Docker build/test commands, ACR setup and image push steps, Azure App Service creation and container configuration, troubleshooting guides for common deployment issues, and best practices for production deployment. Use when providing deployment guidance, answering Azure container questions, or explaining Docker containerization for PDF Viewer applications. |
| annotation-enum-properties.md | Enum definitions for annotation types. It used to provide the provide classes and enum properties for annotation common properties. |
| annotation-general-enum-properties.md | General annotation enum properties. It used to provide the provide classes and enum properties for annotation methods. (e.g., Bound type) |
| annotation-settings-enum-properties.md | Enum properties for annotation settings. It used to provide the provide classes and enum properties for annotation settings properties. |
| form-fields-enum-properties.md | Enum properties for form fields. It used to provide the provide classes and enum properties for form field related properties. |
| general-enum-properties.md | General enums (InteractionMode, ZoomMode, ContextMenuAction, etc.). It used to provide the provide classes and enum properties for common properties. |
| keyboard-enum-properties.md | Keyboard shortcut enum properties. It used to provide the provide classes and enum properties for keyboard actions. |
| pdf-annotation-enum-properties.md | PDF-specific annotation enums (e.g., AllowedInteraction). It used to provide the provide classes and enum properties for annotations. |
| toolbar-enum-properties.md | Toolbar item enums (ToolbarItem, AnnotationToolbarItem, etc.). It used to provide the provide classes and enum properties for toolbar properties. |
Quick Start Example
@page "/pdfviewer-sample"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons
<!-- BASE_PATCH:UI_BUTTONS -->
<!-- Buttons from feature files will be inserted here -->
<SfPdfViewer2 @ref="_pdfviewer"
DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
Height="100%"
Width="100%">
<!-- "PROPERTY" should be placed here -->
<!-- "EVENTS" should be placed here-->
</SfPdfViewer2>
@code {
private SfPdfViewer2 _pdfviewer { get; set; }
}---
Syncfusion Blazor PDF Viewer Skills
Create Blazor application by integrating Syncfusion Blazor PDF Viewer control for viewing and editing PDF documents.
See [SKILL.md](SKILL.md) for the full intent-routing guide and rules.
---
Two Modes
Generate C# Code for the User's Project (default)
Produces production-ready C# code and adds it directly into the user's project files.
Trigger keywords: "code", "snippet", "how to write", "Program.cs", "show me", "sample", "example code", "generate code for".
---
Quick Start
Prerequisites and Setup Requirements
Before using the Blazor PDF Viewer component, ensure the following setup is complete:
1. NuGet Package Installation
Required packages in your .csproj file:
dotnet add package Syncfusion.Blazor.SfPdfViewer
dotnet add package Syncfusion.Blazor.Themes- If the project were
Web Assemblythe install the below package too
dotnet add package SkiaSharp.Views.Blazor2. Program.cs Configuration
For Blazor Web App (Server mode) & Auto:
using Syncfusion.Blazor;
.....
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
// Configure SignalR for large file uploads
builder.Services.AddSignalR(o => { o.MaximumReceiveMessageSize = 102400000; });
// Add memory cache
builder.Services.AddMemoryCache();
.......
For Blazor WebAssembly:
using Syncfusion.Blazor;
.....
builder.Services.AddMemoryCache();
//Add Syncfusion Blazor service to the container
builder.Services.AddSyncfusionBlazor();
.....
For Blazor WebAssembly or Auto mode, register the service in both the server and client Program.cs files.
3. _Imports.razor Configuration
Add these namespaces to Components/_Imports.razor (Web App) or _Imports.razor (WebAssembly):
@using Syncfusion.Blazor
@using Syncfusion.Blazor.SfPdfViewer4. App.razor Configuration
Add the Syncfusion stylesheet and script references in Components/App.razor:
<head>
<!-- Other head content -->
<!-- Syncfusion Blazor PDF Viewer control's theme style sheet -->
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>
<body>
<!-- Other body content -->
<!-- Syncfusion Blazor PDF Viewer control's scripts -->
<script src="_content/Syncfusion.Blazor.SfPdfViewer/scripts/syncfusion-blazor-sfpdfviewer.min.js" type="text/javascript"></script>
</body>| RenderMode | Code |
|---|---|
| Auto | @rendermode InteractiveAuto |
| WebAssembly | @rendermode InteractiveWebAssembly |
| Server | @rendermode InteractiveServer |
---
Code References
All templates and snippets used by the skill are in the references/ folder:
| File | Contents |
|---|---|
| getting-started.md | Foundation setup and minimal PDF Viewer component. |
| toolbar-properties.md | Comprehensive toolbar customization using PdfViewerToolbarSettings for Pdfviewer. |
| toolbar-methods.md | Programmatic control methods for toolbar visibility and behavior for Pdfviewer. |
| navigation-toolbar-settings.md | Settings for configuring the navigation toolbar, including related properties and code examples. |
| magnification.md | Programmatic zoom/magnification control for the Pdfviewer. |
| text-search.md | Complete text search functionality for PDF document content discovery and navigation for Pdfviewer. |
| annotation-events.md | Comprehensive reference for annotation lifecycle, interaction, and signature-specific events for Pdfviewer. |
| signature-annotation-events.md | Events fired when users interact with signature annotations (add, select, move, resize, modify, remove). |
| annotation-properties.md | Reference for enabling/disabling annotation feature types via properties for Pdfviewer. |
| annotation-selector-settings.md | Properties for configuring the default selection appearance for all annotation types in the PDF Viewer. |
| annotation-settings.md | Configuration for default appearance, behavior, size constraints, and restrictions across 20+ annotation types for Pdfviewer. |
| annotation-methods.md | Programmatic API methods for controlling annotation interactions within a PDF document. |
| area-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for area annotations. |
| arrow-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for arrow annotations. |
| circle-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for circle annotations. |
| custom-stamp-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for custom stamp/image annotations. |
| distance-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for distance measurement annotations. |
| free-text-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for free text annotations. |
| handwritten-signature-settings.md | Properties for configuring default appearance, behavior, and restrictions for handwritten signature annotations. |
| highlight-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for highlight annotations. |
| ink-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for ink (freehand drawing) annotations. |
| line-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for line annotations. |
| measurement-annotations-settings.md | Properties for configuring default units and ratio values for measurement annotations. |
| perimeter-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for perimeter measurement annotations. |
| polygon-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for polygon annotations. |
| radius-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for radius measurement annotations. |
| rectangle-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for rectangle annotations. |
| squiggly-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for squiggly (wavy underline) annotations. |
| stamp-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for built-in stamp/image annotations. |
| stickynotes-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for sticky note annotations. |
| strikethrough-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for strikethrough annotations. |
| underline-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for underline annotations. |
| volume-annotation-settings.md | Properties for configuring default appearance, behavior, and restrictions for volume measurement annotations. |
| redaction-settings.md | Complete configuration API for redaction settings to permanently remove sensitive information from PDFs. |
| programmatical-annotation-methods.md | Complete API for programmatic annotation lifecycle management, redaction, and export/import workflows. |
| command-manager.md | Dual feature reference for custom keyboard shortcuts and comment panel customization. |
| command-panel.md | Comment panel feature configuration, including visibility control, module injection, and related settings. |
| document-properties.md | Document-level configuration, metadata, and lifecycle events for PDF handling. |
| file-save-properties.md | File download and annotation export/import functionality with complete event-driven workflows. |
| ui-properties.md | Core UI properties and hyperlink interaction events for customizing the viewer experience. |
| form-field-properties.md | Core form field configuration and design mode control properties for Pdfviewer. |
| form-field-settings.md | Visual appearance and styling configuration for form fields with properties and comprehensive decision guidance. |
| form-designer-events.md | Comprehensive form field event reference for lifecycle, interaction, validation, and data management for Pdfviewer. |
| programmatical-form-field-methods.md | Complete API for programmatic form field lifecycle management, batch operations, and export/import workflows. |
| thumbnail-bookmark.md | Comprehensive reference for programmatic navigation, text selection, and thumbnail/bookmark panel management. |
| contextmenu-settings.md | When the user needs to customize the PDF Viewer's as context menu settings. |
| undo-redo-properties.md | Comprehensive undo/redo functionality for tracking and reversing document changes for Pdfviewer. |
| navigation-methods.md | Programmatic page navigation control and document information retrieval for Pdfviewer. |
| navigation-properties.md | Properties for page state tracking, navigation toolbar customization, and UI synchronization in the PDF viewer. |
| page-organizer.md | Complete API for programmatic page manipulation, document structure editing, and page organizer UI configuration. |
| page-organizer-settings.md | Settings for page organization features such as deletion, insertion, rotation, duplication, and other page manipulation capabilities. |
| print.md | Print capabilities configuration, quality control, and event-driven workflows for PDF documents. |
| text-selection-and-extraction.md | Describes about the funtionlities of the text selection and text extraction. |
| tile-rendering.md | Tile rendering settings, including properties for enabling tile rendering and configuring tile coordinates. |
| pdfviewer-methods.md | All core methods available on the SfPdfViewer component for controlling lifecycle and document operations. |
| pdfviewer-properties.md | General properties of the SfPdfViewer component covering UI appearance, interaction mode, font support, and document configuration. |
| azure-container-deployment.md | Comprehensive guide for deploying Blazor PDF Viewer applications to Azure using Docker containers, Azure Container Registry (ACR), and Azure App Service. |
| annotation-enum-properties.md | Enum definitions for annotation types |
| annotation-general-enum-properties.md | General annotation enum properties (e.g., Bound type) |
| annotation-settings-enum-properties.md | Enum properties for annotation settings |
| form-fields-enum-properties.md | Enum properties for form fields |
| general-enum-properties.md | General enums (InteractionMode, ZoomMode, ContextMenuAction, etc.) |
| keyboard-enum-properties.md | Keyboard shortcut enum properties |
| pdf-annotation-enum-properties.md | PDF-specific annotation enums (e.g., AllowedInteraction) |
| toolbar-enum-properties.md | Toolbar item enums (ToolbarItem, AnnotationToolbarItem, etc.) |
Example Prompts
Mode 1 / Code-Generation Prompts (C# snippets for your project)
Use these when you want C# code to embed in your project (e.g., Program.cs).
Examples:
- "Show me the C# code to create a Pdfviewer with the hide the default toolbar."
- "Generate a C# snippet to add the annotations programmatically for Pdfviewer."
- "Provide C# code to customize the UI for the search functionalities for Pdfviewer."
- "Show me how to set the formfieldsettings for the Pdfviewer"
License
Syncfusion .NET PDF library requires a commercial license for production use. A free community license is available for qualifying organizations.
DynamicStampItem
| Name | Description | Data type |
|---|---|---|
| Approved | Represents a stamp indicating the document is approved. | enum |
| Confidential | Represents a stamp indicating the document is confidential. | enum |
| NotApproved | Represents a stamp indicating the document is not approved. | enum |
| Received | Represents a stamp indicating the document has been received. | enum |
| Reviewed | Represents a stamp indicating the document has been reviewed. | enum |
| Revised | Represents a stamp indicating the document has been revised. | enum |
SignStampItem
| Name | Description | Data type |
|---|---|---|
| Accepted | Represents a stamp indicating the document is accepted. | enum |
| InitialHere | Represents a stamp indicating the initial placement here. | enum |
| Rejected | Represents a stamp indicating the document is rejected. | enum |
| SignHere | Represents a stamp indicating where the sign is needed. | enum |
| Witness | Represents a stamp indicating a witness is required. | enum |
StandardBusinessStampItem
| Name | Description | Data type |
|---|---|---|
| Approved | Represents a stamp indicating the document is approved. | enum |
| Completed | Represents a stamp indicating the document is completed. | enum |
| Confidential | Represents a stamp indicating the document is confidential. | enum |
| Draft | Represents a stamp indicating the document is a draft. | enum |
| Final | Represents a stamp indicating the document is final. | enum |
| ForComment | Represents a stamp indicating the document is for comment. | enum |
| ForPublicRelease | Represents a stamp indicating the document is for public release. | enum |
| InformationOnly | Represents a stamp indicating the document is for information only. | enum |
| NotApproved | Represents a stamp indicating the document is not approved. | enum |
| NotForPublicRelease | Represents a stamp indicating the document is not for public release. | enum |
| PreliminaryResults | Represents a stamp indicating the document contains preliminary results. | enum |
| Void | Represents a stamp indicating the document is void. | enum |
PdfViewerCustomStamp
| Name | Description | Data 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 |
PdfViewerSignatureDialogSettings
| Name | Description | Data type |
|---|---|---|
| DisplayMode | Get or set the required signature options will be enabled in the signature dialog. | DisplayMode |
| HideSaveSignature | Hide the save signature checkbox in the signature dialog box. | bool |
| SignatureFonts | Gets or sets the array of font families that will be available in the signature dialog's "Type" tab for signature fields. | string[] |
DisplayMode
| Name | Description | Data type |
|---|---|---|
| Draw | Display only the draw option in the signature dialog. | enum |
| Text | Display only the type option in the signature dialog. | enum |
| Upload | Display only the upload option in the signature dialog. | enum |
CalibrationUnit
| Name | Description | Data type |
|---|---|---|
| Cm | Represents the unit of centi meter. | enum |
| Ft | Represents the unit of feet. | enum |
| In | Represents the unit of inch. | enum |
| Mm | Represents the unit of meter | enum |
| P | Represents the unit of points | enum |
| Pt | Represents the unit of points | enum |
Annotation Events in Blazor SfPdfViewer Component
Table of Contents
Overview
Annotation events notify your application when users interact with annotations—adding, selecting, moving, resizing, modifying, or removing them. Use these events to track annotation changes, implement custom workflows, validate modifications, or synchronize annotation state with your application data.
When to Use Annotation Events
Guide users to subscribe to annotation events when they need to:
- It allowing users to handle interactions, changes, and actions performed within the viewer for annotation (Except Signature Annotation).
- When we do such action while annotation interaction process, the we can use the annotation events to handle to acheive those scenaios.
Complete Event List
Below is the comprehensive reference of all annotation events, their arguments, and properties. Use this as a lookup when you know which event you need.
AnnotationAdded
Triggers when an annotation is added to a page in the PDF document.
Value
EventCallback<AnnotationAddEventArgs>
AnnotationAdded Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
AnnotationProperties | PdfAnnotationProperties | Gets the settings of the annotation added to the PDF document. |
Bound | Bound | Gets the bound of the annotations. |
Bounds | List<Bound> | Gets the textmark annotation bounds details. |
CustomStampName | string | Defines the name of the custom stamp added to the PDF page. |
LabelSettings | PdfViewerShapeLabelSettings | LabelSettings for shape and measure annotation. |
MultiplePageCollection | List<PdfAnnotation> | Defines the multi page annotation collections. |
Name | string | Specifies name of the event. |
AnnotationId | string | Defines the id of the annotation added in the page of the PDF document. |
AnnotationType | AnnotationType | Define the type of the annotation added in the page of the PDF document. |
PageNumber | int | Defines the page number in which the annotation is added. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationAdded="AnnotationAdded"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationAdded(AnnotationAddEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationMouseover
Triggers when the mouse pointer moves over an annotation object.
Value
EventCallback<AnnotationMouseoverEventArgs>
AnnotationMouseover Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
AnnotationProperties | PdfAnnotationProperties | Defines the settings of the annotation added to the PDF document. |
Bound | Bound | Gets the bound of the annotations. |
Bounds | List<Bound> - Gets the textmark annotation bounds details. | |
PageX | double | Gets the pageX co-ordinate. |
PageY | double | Gets the PageY co-ordinate. |
X | double | Gets the X co-orinate of the annotation. |
Y | double | Gets the Y co-orinate of the annotation. |
Name | string | Specifies name of the event. |
AnnotationId | string | Defines the id of the annotation added in the page of the PDF document. |
AnnotationType | AnnotationType | Define the type of the annotation added in the page of the PDF document. |
PageNumber | int | Defines the page number in which the annotation is added. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationMouseover="AnnotationMouseovered"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationMouseOvered(AnnotationMouseoverEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationMoved
Triggers when an annotation is moved on a page in the PDF document.
Value
EventCallback<AnnotationMoveEventArgs>
AnnotationMoved Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
AnnotationProperties | PdfAnnotationProperties | Gets the settings of the annotation moved in the PDF document. |
CurrentPosition | Bound | Current position of annotations in the page text content. |
PreviousPosition | Bound | Previous position of annotations in the page text content. |
Name | string | Specifies name of the event. |
AnnotationId | string | Defines the id of the annotation added in the page of the PDF document. |
AnnotationType | AnnotationType | Define the type of the annotation added in the page of the PDF document. |
PageNumber | int | Defines the page number in which the annotation is added. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationMoved="AnnotationMove"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationMove(AnnotationMoveEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationPropertiesChanged
Triggers when annotation properties are modified on a PDF page.
Value
EventCallback<AnnotationPropertiesChangeEventArgs>
AnnotationPropertiesChanged Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
IsBorderDashArrayChanged | bool | It returns true when the border dash array of the annotation is changed.By default it is false. |
IsColorChanged | bool | It returns true when the color of the annotation is changed.By default it is false. |
IsCommentsChanged | bool | It returns true when the comment of the annotation is changed.By default it is false. |
IsLineHeadEndStyleChanged | bool | It returns true when the line head end style of the annotation is changed.By default it is false. |
IsLineHeadStartStyleChanged | bool | Specifies that the line head start style of the annotation is changed. |
IsOpacityChanged | bool | Specifies that the opacity of the annotation is changed. |
IsStrokeColorChanged | bool | Specifies that the stroke color of the annotation is changed. |
IsTextChanged | bool | Specifies that the Text of the annotation is changed. |
IsThicknessChanged | bool | Specifies that the thickness of the annotation is changed. |
MultiplePageCollection | List<PdfAnnotation> - Gets the multipage text markup annotation collection. | |
TextMarkupContent | string | Gets the selected text content in the text markup annotation. |
TextMarkupEndIndex | int | Gets the end index of text markup annotation in the page text content. |
TextMarkupStartIndex | int | Gets the starting index of text markup annotation in the page text content. |
Name | string | Specifies name of the event. |
AnnotationId | string | Defines the id of the annotation added in the page of the PDF document. |
AnnotationType | AnnotationType | Define the type of the annotation added in the page of the PDF document. |
PageNumber | int | Defines the page number in which the annotation is added. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationPropertiesChanged="AnnotationModified"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationModified(AnnotationPropertiesChangeEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationRemoved
Triggers when an annotation is removed / deleted from a page in the PDF document.
Value
EventCallback<AnnotationRemoveEventArgs>
AnnotationRemoved Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Bound | Bound | Gets the bound of the annotations. |
Bounds | List<Bound> | Gets the textmark annotation bounds details. |
MultiplePageCollection | List<PdfAnnotation> | Defines the multi page annotation collections. |
TextMarkupContent | string | Defines the selected text content in the text markup annotation. |
TextMarkupEndIndex | int | End index of text markup annotation in the page text content. |
TextMarkupStartIndex | int | Starting index of text markup annotation in the page text content. |
Name | string | Specifies name of the event. |
AnnotationId | string | Defines the id of the annotation added in the page of the PDF document. |
AnnotationType | AnnotationType | Define the type of the annotation added in the page of the PDF document. |
PageNumber | int | Defines the page number in which the annotation is added. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationRemoved="AnnotationDeleted"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationDeleted(AnnotationRemoveEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationResized
Triggers when an annotation is resized on a page in the PDF document.
Value
EventCallback<AnnotationResizeEventArgs>
AnnotationResized Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
AnnotationProperties | PdfAnnotationProperties | Gets the settings of the annotation added to the PDF document. |
Bound | Bound | Gets the bound of the annotations. |
Bounds | List<Bound> | Gets the textmark annotation bounds details. |
CustomStampName | string | Defines the name of the custom stamp added to the PDF page. |
LabelSettings | PdfViewerShapeLabelSettings | LabelSettings for shape and measure annotation. |
MultiplePageCollection | List<PdfAnnotation> | Defines the multi page annotation collections. |
Name | string | Specifies name of the event. |
AnnotationId | string | Defines the id of the annotation added in the page of the PDF document. |
AnnotationType | AnnotationType | Define the type of the annotation added in the page of the PDF document. |
PageNumber | int | Defines the page number in which the annotation is added. |
TextMarkupContent | string | Gets the selected text content in the text markup annotation. |
TextMarkupEndIndex | int | Gets the end index of text markup annotation in the page text content. |
TextMarkupStartIndex | int | Gets the Starting index of text markup annotation in the page text content. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationResized="AnnotationResized"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationResized(AnnotationResizeEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationSelected
Triggers when an annotation is selected on a page in the PDF document.
Value
EventCallback<AnnotationSelectEventArgs>
AnnotationSelected Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
AnnotationCollection | List<PdfAnnotation> | Defines the overlapped annotations of the selected annotation. |
AnnotationId | string | Defines the id of the annotation selected in the page of the PDF document. |
AnnotationProperties | PdfAnnotationProperties | Defines the annotation selected in the PDF document. |
IsProgrammaticSelection | bool | Defines the annotation selection by mouse. |
MultiplePageCollection | List<PdfAnnotation> | Gets the multi page annotation collections. |
PageNumber | int | Gets the page number in which the annotation is selected. |
Name | string | Specifies name of the event. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationSelected="AnnotationSelected"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationSelected(AnnotationSelectEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}AnnotationUnselected
Triggers when an annotation is unselected on a page in the PDF document.
Value
EventCallback<AnnotationUnselectEventArgs>
AnnotationUnselected Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Annotation | PdfAnnotation | Gets the instance of Annotation which is unselected by the user. |
AnnotationId | string | Gets the ID of Annotation which is unselected by the user. |
PageNumber | int | Gets the page number in which the annotation is unselected. |
Name | string | Specifies name of the event. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents AnnotationUnselected="AnnotationUnselected"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void AnnotationUnselected(AnnotationUnselectEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}OnAnnotationDoubleClick
Triggers when an annotation is double-clicked.
Value
EventCallback<AnnotationDoubleClickEventArgs>
OnAnnotationDoubleClick Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
AnnotationId | string | Gets the id of the annotation double clicked in the page of the PDF document. |
AnnotationProperties | PdfAnnotationProperties | Gets the annotation double clicked in the PDF document. |
PageNumber | int | Defines the page number in which the annotation is double clicked. |
Name | string | Specifies name of the event. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents OnAnnotationDoubleClick="OnAnnotationDoubleClicked"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void OnAnnotationDoubleClicked(AnnotationDoubleClickEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}ExportStarted
Triggers when exporting annotations starts in the SfPdfViewer. | ExportStartEventArgs | No Properties | Show loading indicators or prevent UI interactions during export |
Value
EventCallback<ExportStartEventArgs>
ExportStarted Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Name | string | Specifies name of the event. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents ExportStarted="ExportStarted"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void ExportStarted(ExportStartEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}ExportSucceed
Triggers when exporting annotations succeeds in the SfPdfViewer.
Value
EventCallback<ExportSuccessEventArgs>
ExportSucceed Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Name | string | Specifies name of the event. |
FileName | string | Gets the exported annotations json file name. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents ExportSucceed="ExportSucceed"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void ExportSucceed(ExportSuccessEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}ExportFailed
Triggers when exporting annotations fails in the SfPdfViewer.
Value
EventCallback<ExportFailureEventArgs>
ExportFailed Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Name | string | Specifies name of the event. |
ErrorDetails | string | Gets the error details for export annotations. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents ExportFailed="ExportFailed"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void ExportFailed(ExportFailureEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}ImportStarted
Triggers when importing annotations starts in the PDF document. | | No Properties | Show loading indicators or prevent UI interactions during import |
Value
EventCallback<ImportStartEventArgs>
ImportStarted Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Name | string | Specifies name of the event. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents ImportStarted="ImportStarted"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void ImportStarted(ImportStartEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}ImportSucceed
Triggers when importing annotations succeeds in the PDF document.
Value
EventCallback<ImportSuccessEventArgs>
ImportSucceed Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Name | string | Specifies name of the event. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents ImportSucceed="ImportSucceed"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void ImportSucceed(ImportSuccessEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}ImportFailed
Triggers when importing annotations fails in the PDF document.
Value
EventCallback<ImportFailureEventArgs>
ImportFailed Events Arguments
| Event Arguments | Data Type | Description |
|---|---|---|
Name | string | Specifies name of the event. |
ErrorDetails | string | Error details for import annotations. |
Code Example
<SfPdfViewer2>
<PdfViewerEvents ImportFailed="ImportFailed"></PdfViewerEvents>
</SfPdfViewer2>
@code {
private void ImportFailed(ImportFailureEventArgs args) {
// customize your code in based on the requirements and check above table for event argument details
}
}Bound
| Property Name | Description | Data type |
|---|---|---|
| Height | Gets or sets the the height of the annotation or form field. | double |
| Width | Gets or sets the the width of the annotation or form field. | double |
| X | Gets or sets the the x co-ordinate value of the annotation or form field. | double |
| Y | Gets or sets the the y co-orinate value of the annotation or form field. | double |
PdfAnnotationProperties
| Property Name | Description | Data type |
|---|---|---|
| Author | Gets the author value of the annotation. | string |
| BorderColor | Gets the border color of the free text annotation. | string |
| BorderDashArray | Gets the border dash array of the annotation. | string |
| BorderWidth | Gets the border width of the free text annotation. | int |
| Color | Gets the color of the textmarkup annotations - highlight, underline and strikethrough and squiggly. | string |
| Data | Gets the path data for ink and signature annotation. | string |
| DefaultText | Gets the text of freetext annotaton. | string |
| FillColor | Gets the fill color of the annotation. | string |
| FontColor | Gets font color for label text of shape and measure annotation. | string |
| FontFamily | Gets font family for label text of shape and measure annotation. | string |
| FontSize | Gets font size for label text of shape and measure annotation. | int |
| FontStyle | Gets or sets font style of the freetext annotation. | FontStyle |
| IsLock | Gets the value to check whether annotation is editable or not. By default it false. If set as true, can't interact with the annotation. | bool |
| LabelSettings | Gets the label settings for the measure and shape annotation. | PdfViewerShapeLabelSettings |
| LineHeadEnd | Gets the head end style of the line, arrow, distance, perimeter annotations. | LineHeadStyle |
| LineHeadStart | Gets the head start style of the line, arrow, distance, perimeter annotations. | LineHeadStyle |
| MaxHeight | Gets the maxHeight value for the annotations. | int |
| MaxWidth | Gets the maxWidth value for the annotations. | int |
| MinHeight | Gets the minHeight value for the annotations. | int |
| MinWidth | Gets the minwidth value for the annotations. | int |
| ModifiedDate | Gets the modified date of the annotation. | string |
| Opacity | Gets the opacity value of the annotation. | double |
| StrokeColor | Gets the stroke color of the annotation. | string |
| Subject | Gets the subject value of the annotation. | string |
| TextAlignment | Gets text alignment of freetext annotaton. | TextAlignment |
| TextMarkupContent | Gets or sets the text content of the textmarkup annotation. | string |
| TextMarkupEndIndex | Gets the text content end index of the textmarkup annotation. | int |
| TextMarkupStartIndex | Gets the text content start index of the textmarkup annotation. | int |
| Thickness | Gets the thickness value of the annotation. | int |
| Type | Gets or sets the type of the PDF annotation. | AnnotationType |
FontStyle
| Name | Description | Data type |
|---|---|---|
| Bold | Represents the text content style will be bold. | enum |
| Italic | Represents the text content style will be italic. | enum |
| None | Represents the text content style does not set. | enum |
| Strikethrough | Represents the text content style will be strikethrough. | enum |
| Underline | Represents the text content style will be underline. | enum |
PdfViewerShapeLabelSettings
| Name | Description | Data type |
|---|---|---|
| FillColor | specifies the fill color of the label. | string |
| FontColor | specifies the border color of the label. | string |
| FontFamily | specifies the max-width of the label. | string |
| FontSize | specifies the font size of the label. | int |
| LabelContent | specifies the default content of the label. | string |
| Notes | specifies the default content of the label. | string |
| Opacity | specifies the opacity of the label. | double |
LineHeadStyle
| Name | Description | Data type |
|---|---|---|
| Arrow | Represents the line with Arrow head style. | enum |
| Closed | Represents the line with closed head style. | enum |
| ClosedArrow | Represents the line with Closed Arrow head style. | enum |
| Diamond | Represents the line with diamond head style. | enum |
| None | Represents the line with no head style. | enum |
| Open | Represents the line with open arrow head style. | enum |
| OpenArrow | Represents the line with Open Arrow head style. | enum |
| Round | Represents the line with round head style. | enum |
| Square | Represents the line with square head style. | enum |
TextAlignment
| Name | Description | Data type |
|---|---|---|
| Center | Represents the text alignment in Center. The text content will be shown at center. | enum |
| Justify | Represents the text alignment of Justify. The text is aligned along the left margin. | enum |
| Left | Represents the text alignment in left. The text content will be shown in left side. | enum |
| Right | Represents the text alignment in Right. The text content will be shown in right side. | enum |
AnnotationType
| Name | Description | Data type |
|---|---|---|
| Area | Represents the Area annotation | enum |
| Arrow | Represents the Arrow annotation | enum |
| Circle | Represents the Circle annotation | enum |
| Distance | Represents the Distance annotation | enum |
| FreeText | Represents the FreeText annotation | enum |
| HandWrittenSignature | Represents the HandWrittenSignature annotation | enum |
| Highlight | Represents the Highlight annoation | enum |
| Image | Represents the Image annotation | enum |
| Ink | Represents the Ink annotation | enum |
| Line | Represents the Line annotation | enum |
| None | Represents the annoation type by None | enum |
| Perimeter | Represents the Perimeter annotation | enum |
| Polygon | Represents the Polygon annotation | enum |
| Radius | Represents the Radius annotation | enum |
| Rectangle | Represents the Rectangle annotation | enum |
| Redaction | Represents the Redaction annotation | enum |
| Squiggly | Represents the Squiggly annotation | enum |
| Stamp | Represents the Stamp annotation | enum |
| StickyNotes | Represents the StickyNotes annotation | enum |
| Strikethrough | Represents the Strikethrough annoation | enum |
| Underline | Represents the Underline annoation | enum |
| Volume | Represents the volume annotation | enum |
Syncfusion Blazor PDF Viewer - Annotation Methods
Table of Contents
Overview
The Syncfusion Blazor PDF Viewer offers powerful APIs to programmatically control annotation interactions within a PDF document. Using these APIs, you can enable or modify annotation behavior without direct user toolbar interaction, making them especially useful for custom UI workflows, automated annotation scenarios, and advanced PDF interaction logic.
Methods List
The following APIs provide access to annotation-related methods available in the Syncfusion Blazor PDF Viewer.
SetAnnotationModeAsync
Set annotation type to be added in next user interaction of the loaded PDF Document in the PDF Viewer. We can customize the annotation based on the user need. It will set annotation interaction thorugh the method.
Parameters
- AnnotationType
Return Type
Task
Code Example
// We can bind the method for click action based the user requirement.
await viewer.SetAnnotationModeAsync(AnnotationType.Highlight);SetAnnotationModeAsync (Only for stamp annotation)
Switch on the annotation mode for stamp annotations. By the methods overloading of the SetAnnotationModeAsync, we can able to set the annotation type that we need to add the types(DynamicStampItem, SignStampItem, StandardBusinessStampItem) | Task | When we need annotation interatcion for stamp annotation programmatically |
Parameters
- AnnotationType
- DynamicStampItem?
- SignStampItem?
- StandardBusinessStampItem?
Note - ? is means to be optional paramter.
Return Type
Task
Code Example
// We can bind the method for click action based the user requirement.
// We need to add dynamic stamp annotation, set the second paramter alone as needed type.
await viewer.SetAnnotationModeAsync(AnnotationType.Stamp, DynamicStampItem.Approved);
// We need to add sign here stamp annotation, set the second parameter as null and thrid parameter with needed type.
await viewer.SetAnnotationModeAsync(AnnotationType.Stamp, null, SignStampItem.Accepted);
// We need to add standard business stamp annotation, set the second and third parameter as null and fourth parameter with needed type.
await viewer.SetAnnotationModeAsync(AnnotationType.Stamp, null, null, StandardBusinessStampItem.Approved);UpdateMeasurementSettingsAsync
Update measure settings for existing measure annotations | - | Task | When we want to update the measure annotation settings | Programmatically |
Parameters
No Paramters
Return Type
Task
Code Example
// We can bind the method for click action based the user requirement.
await viewer.UpdateMeasurementSettingsAsync();Syncfusion Blazor PDF Viewer - Annotation Properties
Table of Contents
Overview
The Syncfusion Blazor PDF Viewer provides comprehensive annotation support that allows users to interact with PDF documents through various annotation tools. The annotation properties control which annotation features are enabled or disabled, and how they behave within the PDF Viewer component.
Properties List
The following APIs provides the annotation-related properties available in the Syncfusion Blazor PDF Viewer:
EnableAnnotation
If set to false, annotation support in the PDF Viewer will be disabled. By default it is true.
false- Disabled the annotation module from the PDF viewer and don't get interact with the annotation. It won't hide the annotation button from UI, it disables the button.true- Enabled the annotation module from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableAnnotation="true"></SfPdfViewer2>EnableFreeText
If set to false, the free text annotation tool in the annotation toolbar will be disabled. By default it is true.
false- Disabled the free text annotation from the PDF viewer and don't get interact with the annotation. It won't hide the free text annotation button from UI, it disables the button.true- Enabled the free text annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableFreeText="true"></SfPdfViewer2>EnableHandwrittenSignature
If set to false, the handwritten signature tool in the annotation toolbar will be disabled. By default it is true.
false- Disabled the handwritten signature annotation from the PDF viewer and don't get interact with the annotation. It won't hide the handwritten signature annotation button from UI, it disables the button.true- Enabled the handwritten signature annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableHandwrittenSignature="true"></SfPdfViewer2>EnableImportAnnotationMeasurement
Enable or disables the customization of measure values in PdfViewer.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableImportAnnotationMeasurement="true"></SfPdfViewer2>EnableInkAnnotation
If set to false, ink annotation support in the PDF Viewer will be disabled. By default it is true.
false- Disabled the ink annotation from the PDF viewer and don't get interact with the annotation. It won't hide the ink annotation button from UI, it disables the button.true- Enabled the ink annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableInkAnnotation="true"></SfPdfViewer2>EnableMeasureAnnotation
If set to false, the measurement annotation tool in the annotation toolbar will be disabled. By default it is true.
false- Disabled the measurement annotation from the PDF viewer and don't get interact with the annotation. It won't hide the measurement annotation button from UI, it disables the button.true- Enabled the measurement annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableMeasureAnnotation="true"></SfPdfViewer2>EnableShapeAnnotation
If set to false, the shape annotation tool in the annotation toolbar will be disabled. By default it is true.
false- Disabled the shape annotation from the PDF viewer and don't get interact with the annotation. It won't hide the shape annotation button from UI, it disables the button.true- Enabled the shape annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableShapeAnnotation="true"></SfPdfViewer2>EnableStampAnnotations
If set to false, the stamp annotation tool in the annotation toolbar will be disabled. By default it is true.
false- Disabled the stamp annotation from the PDF viewer and don't get interact with the annotation. It won't hide the stamp annotation button from UI, it disables the button.true- Enabled the stamp annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableStampAnnotations="true"></SfPdfViewer2>EnableStickyNotesAnnotation
If set to false, the sticky notes annotation tool in the toolbar will be disabled. By default it is true.
false- Disabled the sticky notes annotation from the PDF viewer and don't get interact with the annotation. It won't hide the sticky notes annotation button from UI, it disables the button.true- Enabled the sticky notes annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableStickyNotesAnnotation="true"></SfPdfViewer2>EnableTextMarkupAnnotation
If set to false, the text markup tools (highlight, strikethrough, squiggly and underline) are disabled in annotation toolbar. By default it is true.
false- Disabled the text markup annotation from the PDF viewer and don't get interact with the annotation. It won't hide the text markup annotation button from UI, it disables the button.true- Enabled the text markup annotation from the PDF Viewer and also enables the button in the UI.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 EnableTextMarkupAnnotation="true"></SfPdfViewer2>ExportAnnotationFileName
Gets or sets the file name of annotations to be exported. When we set the file name through this API, it will set the file name for the exported file.
Data Type
string
Code Example
<SfPdfViewer2 ExportAnnotationFileName="ExportFile"></SfPdfViewer2>IsSignatureEditable
If it is set as true, the signature can editable in the PDF Viewer after saved as ink annotation on download action.
false- It disables the edit functionalities after saved on the downloaded document.true- It enables the edit functionalities after saved on the downloaded document.
Data Type and default value
bool - false(Default)
Code Example
<SfPdfViewer2 IsSignatureEditable="true"></SfPdfViewer2>ShowDigitalSignatureAppearance
Gets or sets a value that indicates whether to show the digital signature appearance in the document.
Data Type and default value
bool - true(Default)
Code Example
<SfPdfViewer2 ShowDigitalSignatureAppearance="true"></SfPdfViewer2>Annotation Selector Settings in Blazor SfPdfViewer Component
Table of Contents
Overview
Annotation Selector settings allow you to configure default appearance of the selection for all the types of annotations in the PDF Viewer.
When we need to set the selector settings for all the annotations as common, then we can use this properties. Then we can use this settings for common for all the annotation not for individual annotation.
Properties List
| Property Name | Description | Data type |
|---|---|---|
| ResizerBorderColor | Defines the annotation resizer border color. By default it is black. | string |
| ResizerCursorType | Defines the annotation resizer Type. By default it is null. | CursorType |
| ResizerFillColor | Defines the annotation resizer fill color. | string |
| ResizerLocation | Defines the location for the resizer of the annotation. It is used to customize the resizer location of the annotation. | AnnotationResizerLocation |
| ResizerShape | Defines the shape of the resizer. By default it is Square. Different shapes of resizer are circle and square. | AnnotationResizerShape |
| ResizerSize | Defines the size of the resizer used for annotations. | int |
| SelectionBorderColor | Defines the selection border color for the annotation. By default it is empty. It is used to customize the selection border color for the annotation. | string |
| SelectionBorderThickness | Defines the selection border thickness for the annotation. By default it is 1. It is used to customize the selection border thickness for the annotation. It's range varies from 1 to 10. | double |
| SelectorLineDashArray | Defines the selector line dash array. By default it is empty. | double[] |
Code Example
- We can customize the options, based on the user requirements.
<SfPdfViewer2>
<PdfViewerAnnotationSelectorSettings ResizerBorderColor="black" ResizerCursorType="CursorType.CrossHair" ResizerFillColor="blue" ResizerLocation="AnnotationResizerLocation.Corners" ResizerShape="AnnotationResizerShape.Circle" ResizerSize="4" SelectionBorderColor="green" SelectionBorderThickness="3" SelectorLineDashArray="[2, 3]"></PdfViewerAnnotationSelectorSettings>
</SfPdfViewer2>PdfViewerAnnotationSelectorSettings
| Property Name | Description | Data type |
|---|---|---|
| ResizerBorderColor | Defines the annotation resizer border color. By default it is black. | string |
| ResizerCursorType | Defines the annotation resizer Type. By default it is null. | CursorType |
| ResizerFillColor | Defines the annotation resizer fill color. | string |
| ResizerLocation | Defines the location for the resizer of the annotation. It is used to customize the resizer location of the annotation. | AnnotationResizerLocation |
| ResizerShape | Defines the shape of the resizer. By default it is Square. Different shapes of resizer are circle and square. | AnnotationResizerShape |
| ResizerSize | Defines the size of the resizer used for annotations. | int |
| SelectionBorderColor | Defines the selection border color for the annotation. By default it is empty. It is used to customize the selection border color for the annotation. | string |
| SelectionBorderThickness | Defines the selection border thickness for the annotation. By default it is 1. It is used to customize the selection border thickness for the annotation. It's range varies from 1 to 10. | double |
| SelectorLineDashArray | Defines the selector line dash array. By default it is empty. | double[] |
CursorType
| Property Name | Description | Data type |
|---|---|---|
| Auto | Represents the default cursor type Auto. | enum |
| CrossHair | Represents the cursor type CrossHair. | enum |
| E_resize | The cursor indicates that an edge of a box is to be moved right (east). | enum |
| EastResize | The cursor indicates that an edge of a box is to be moved right (east). | enum |
| EastWestResize | Represents a bidirectional resize cursor. | enum |
| Ew_resize | Represents a bidirectional resize cursor. | enum |
| Grab | Represents a grab cursor. | enum |
| GrabHandle | Represents GrabHandle cursor type. | enum |
| Grabbing | Represents a grabbing cursor. | enum |
| Move | Represents a Move cursor when moving on something. | enum |
| N_resize | The cursor indicates that an edge of a box is to be moved up (north). | enum |
| Ne_resize | The cursor indicates that an edge of a box is to be moved up and right (north/east). | enum |
| NorthEastResize | The cursor indicates that an edge of a box is to be moved up and right (north/east). | enum |
| NorthResize | The cursor indicates that an edge of a box is to be moved up (north). | enum |
| NorthSouthResize | Represents a bidirectional resize cursor. | enum |
| NorthWestResize | The cursor indicates that an edge of a box is to be moved up and left (north/west). | enum |
| Ns_resize | Represents a bidirectional resize cursor. | enum |
| Nw_resize | The cursor indicates that an edge of a box is to be moved up and left (north/west). | enum |
| Pointer | Represents Pointer cursor type. | enum |
| S_resize | The cursor indicates that an edge of a box is to be moved down (south). | enum |
| Se_resize | The cursor indicates that an edge of a box is to be moved down and right (south/east). | enum |
| SouthEastResize | The cursor indicates that an edge of a box is to be moved down and right (south/east). | enum |
| SouthResize | The cursor indicates that an edge of a box is to be moved down (south). | enum |
| SouthWestResize | The cursor indicates that an edge of a box is to be moved down and left (south/west). | enum |
| Sw_resize | The cursor indicates that an edge of a box is to be moved down and left (south/west). | enum |
| Text | The cursor indicates text that may be selected. | enum |
| W_resize | The cursor indicates that an edge of a box is to be moved left (west). | enum |
| WestResize | The cursor indicates that an edge of a box is to be moved left (west). | enum |
AnnotationResizerLocation
| Property Name | Description | Data type |
|---|---|---|
| Corners | When resizing annotation, Resizer location is represented by corners. | enum |
| Edges | When resizing annotation, Resizer location is represented by Edges. | enum |
AnnotationResizerShape
| Property Name | Description | Data type |
|---|---|---|
| Circle | Represent the Resizer shape by Circle when resizing annotations. | enum |
| Square | Represent the Resizer shape by Square when resizing annotations. | enum |
PageInfo Class
| Property | Type | Description |
|---|---|---|
| PageNumber | int | The 1-based page number (first page is 1, not 0) |
| Width | double | The width of the page in pixels |
| Height | double | The height of the page in pixels |
| RotationAngle | PageRotation | The current rotation angle applied to the page |
DocumentInfo Class
| Property | Type | Description |
|---|---|---|
| PageCount | int | Total number of pages in the document |
| PageSizes | Dictionary<int, SizeF> | Dictionary containing page sizes for each page in the document |
PageRotation
| Property | Type | Description |
|---|---|---|
| RotateAngle0 | No rotation applied to the page (0 degrees). | enum |
| RotateAngle180 | Rotates the page by 180 degrees. | enum |
| RotateAngle270 | Rotates the page by 270 degrees clockwise (or 90 degrees counterclockwise). | enum |
| RotateAngle90 | Rotates the page by 90 degrees clockwise. | enum |
FooterButton
| Name | Description | Data type |
|---|---|---|
| None | No buttons are shown in the Page Organizer dialog footer. | |
| Save | Show the "Save" button in the Page Organizer dialog footer. | |
| SaveAs | Show the "SaveAs" button in the Page Organizer dialog footer. |
Annotation Settings in Blazor SfPdfViewer Component
Table of Contents
Overview
Annotation settings allow you to configure default appearance, behavior, and restrictions for all the types of annotations in the PDF Viewer. Use these settings to control properties of the all types of annotations.
When we need to set the settings for all the annotations as common, then we can use this property. Then we can use this settings for common for all the annotation not for individual annotation.
Properties List
| Property Name | Description | Data type |
|---|---|---|
| AllowedInteractions | Gets or sets the allowed interactions for the locked annotations. IsLock can be configured using settings. | List<AllowedInteraction> |
| Author | Specifies the author's name to add annotation or review the PDF document. By default it is Guest. | string |
| CustomData | Specifies the user's defined information related to the annotations. By default it is null. | object |
| IsLock | If it is set as true, can't interact with annotation. Otherwise can interact the annotations. By default it is false. | bool |
| IsPrint | Gets or sets the value for the individual annotations are included or not in print actions. | bool |
| MaxHeight | Sets the maximum height of annotations. It prevents the height of the annotation becoming larger than the values provided in MaxHeight.By default it is 0. | int |
| MaxWidth | Sets the maximum width of annotations. It prevents the width of the annotation becoming larger than values provided in MaxWidth.By default it is 0. | int |
| MinHeight | Sets the minimum height of annotations. It prevents the height of the annotation becoming smaller than values provided in MinHeight.By default it is 0. | int |
| MinWidth | Sets the minimum width of annotations. It prevents the width of the annotation becoming smaller than values provided in MinWidth.By default it is 0. | int |
| SkipDownload | If it is set as true, newly added annotations won't be included in downloaded file. By default it is false. | bool |
| SkipPrint | If it is set as true, newly added annotations won't be included in printing. By default it is false. | bool |
Code Example
- We can customize the options, based on the user requirements.
<SfPdfViewer2>
<PdfViewerAnnotationSettings AllowedInteractions="allowedInteractions" Author="Syncfusion" CustomData="CustomData" IsLock="true" IsPrint="false" MaxHeight="100" MaxWidth="100" MinHeight="50" MinWidth="50" SkipDownload="false" SkipPrint="false"></PdfViewerAnnotationSettings>
</SfPdfViewer2>
@code {
List<AllowedInteraction> allowedInteractions = new List<AllowedInteraction>() {
AllowedInteraction.Select,
AllowedInteraction.Delete
};
private object CustomData = new
{
Owner = "Syncfusion"
};
}Area Settings in Blazor SfPdfViewer Component
Table of Contents
Overview
Area settings allow you to configure default appearance, behavior, and restrictions for area annotations in the PDF Viewer. Use these settings to control properties of the area annotation.
Properties List
| Property Name | Description | Data type |
|---|---|---|
| AllowedInteractions | Gets or sets the allowed interactions for the locked annotations. IsLock can be configured using settings. | List<AllowedInteraction> |
| Author | Specifies the author's name to add annotation or review the PDF document. By default it is Guest. | string |
| CustomData | Specifies the user's defined information related to the annotations. By default it is null. | object |
| IsLock | If it is set as true, can't interact with annotation. Otherwise can interact the annotations. By default it is false. | bool |
| IsPrint | Gets or sets the value for the individual annotations are included or not in print actions. | bool |
| MaxHeight | Sets the maximum height of annotations. It prevents the height of the annotation becoming larger than the values provided in MaxHeight.By default it is 0. | int |
| MaxWidth | Sets the maximum width of annotations. It prevents the width of the annotation becoming larger than values provided in MaxWidth.By default it is 0. | int |
| MinHeight | Sets the minimum height of annotations. It prevents the height of the annotation becoming smaller than values provided in MinHeight.By default it is 0. | int |
| MinWidth | Sets the minimum width of annotations. It prevents the width of the annotation becoming smaller than values provided in MinWidth.By default it is 0. | int |
| SkipDownload | If it is set as true, newly added annotations won't be included in downloaded file. By default it is false. | bool |
| SkipPrint | If it is set as true, newly added annotations won't be included in printing. By default it is false. | bool |
| AnnotationSelectorSettings | Defines the annotaton selector settings for the annotation. | PdfViewerAnnotationSelectorSettings |
| BorderDashArray | Defines the border dash array. | int[] |
| FillColor | Specifies the fill color of the annotation. | string |
| Opacity | Defines the opacity for the annotations. By default it is 1. It's range varies 0 to 1. | double |
| StrokeColor | Defines the stroke color of the annotations | string |
| Thickness | Defines the thickness of the annotations. By default it is 1. It's range varies 1 to 10. | int |
Code Example
- We can customize the options, based on the user requirements.
<SfPdfViewer2>
<PdfViewerAreaSettings AllowedInteractions="allowedInteractions" AnnotationSelectorSettings="selectorSettings" Author="Syncfusion" BorderDashArray="[1, 3]" CustomData="CustomData" FillColor="green" IsLock="true" IsPrint="false" MaxHeight="100" MaxWidth="100" MinHeight="50" MinWidth="50" Opacity="0.5" SkipDownload="false" SkipPrint="false" StrokeColor="yellow" Thickness="3"></PdfViewerAreaSettings>
</SfPdfViewer2>
@code {
List<AllowedInteraction> allowedInteractions = new List<AllowedInteraction>() {
AllowedInteraction.Select,
AllowedInteraction.Delete
};
PdfViewerAnnotationSelectorSettings selectorSettings = new PdfViewerAnnotationSelectorSettings() {
SelectionBorderColor = "black",
ResizerBorderColor = "blue",
ResizerCursorType= CursorType.CrossHair,
ResizerFillColor="orange",
ResizerLocation=AnnotationResizerLocation.Corners,
ResizerShape=AnnotationResizerShape.Circle,
ResizerSize=4,
SelectionBorderThickness=2,
SelectorLineDashArray=[1, 2]
};
private object CustomData = new
{
Owner = "Syncfusion"
};
}Arrow Settings in Blazor SfPdfViewer Component
Table of Contents
Overview
Arrow settings allow you to configure default appearance, behavior, and restrictions for arrow annotations in the PDF Viewer. Use these settings to control properties of the arrow annotation.
Properties List
| Property Name | Description | Data type |
|---|---|---|
| AllowedInteractions | Gets or sets the allowed interactions for the locked annotations. IsLock can be configured using settings. | List<AllowedInteraction> |
| Author | Specifies the author's name to add annotation or review the PDF document. By default it is Guest. | string |
| CustomData | Specifies the user's defined information related to the annotations. By default it is null. | object |
| IsLock | If it is set as true, can't interact with annotation. Otherwise can interact the annotations. By default it is false. | bool |
| IsPrint | Gets or sets the value for the individual annotations are included or not in print actions. | bool |
| MaxHeight | Sets the maximum height of annotations. It prevents the height of the annotation becoming larger than the values provided in MaxHeight.By default it is 0. | int |
| MaxWidth | Sets the maximum width of annotations. It prevents the width of the annotation becoming larger than values provided in MaxWidth.By default it is 0. | int |
| MinHeight | Sets the minimum height of annotations. It prevents the height of the annotation becoming smaller than values provided in MinHeight.By default it is 0. | int |
| MinWidth | Sets the minimum width of annotations. It prevents the width of the annotation becoming smaller than values provided in MinWidth.By default it is 0. | int |
| SkipDownload | If it is set as true, newly added annotations won't be included in downloaded file. By default it is false. | bool |
| SkipPrint | If it is set as true, newly added annotations won't be included in printing. By default it is false. | bool |
| AnnotationSelectorSettings | Defines the annotaton selector settings for the annotation. | PdfViewerAnnotationSelectorSettings |
| BorderDashArray | Defines the border dash array. | int[] |
| FillColor | Specifies the fill color of the annotation. | string |
| Opacity | Defines the opacity for the annotations. By default it is 1. It's range varies 0 to 1. | double |
| StrokeColor | Defines the stroke color of the annotations | string |
| Thickness | Defines the thickness of the annotations. By default it is 1. It's range varies 1 to 10. | int |
| LineHeadEndStyle | Defines the head end style of the annotation. | LineHeadStyle |
| LineHeadStartStyle | Defines the head end style of the annotation. | LineHeadStyle |
Code Example
- We can customize the options, based on the user requirements.
<SfPdfViewer2>
<PdfViewerArrowSettings AllowedInteractions="allowedInteractions" AnnotationSelectorSettings="selectorSettings" Author="Syncfusion" BorderDashArray="[1,3]" CustomData="CustomData" FillColor="green" IsLock="true" IsPrint="false" LineHeadEndStyle="LineHeadStyle.Diamond" LineHeadStartStyle="LineHeadStyle.Diamond" MaxHeight="100" MaxWidth="100" MinHeight="50" MinWidth="50" Opacity="0.5" SkipDownload="false" SkipPrint="false" StrokeColor="yellow" Thickness="3"></PdfViewerArrowSettings>
</SfPdfViewer2>
@code {
List<AllowedInteraction> allowedInteractions = new List<AllowedInteraction>() {
AllowedInteraction.Select,
AllowedInteraction.Delete
};
PdfViewerAnnotationSelectorSettings selectorSettings = new PdfViewerAnnotationSelectorSettings() {
SelectionBorderColor = "black",
ResizerBorderColor = "blue",
ResizerCursorType= CursorType.CrossHair,
ResizerFillColor="orange",
ResizerLocation=AnnotationResizerLocation.Corners,
ResizerShape=AnnotationResizerShape.Circle,
ResizerSize=4,
SelectionBorderThickness=2,
SelectorLineDashArray=[1, 2]
};
private object CustomData = new
{
Owner = "Syncfusion"
};
}Azure Container Deployment for Blazor PDF Viewer
Important Note: This reference is for information and guidance only. Do NOT make any changes to project files, Dockerfiles, or Azure configurations based on this documentation unless explicitly requested by the user.
Overview
This guide provides comprehensive instructions for containerizing and deploying Blazor PDF Viewer applications (both Server and WebAssembly scenarios) to Azure using Azure Container Registry (ACR) and Azure App Service for Containers.
---
Prerequisites
Before proceeding with Azure container deployment:
- Azure Subscription: Active Azure subscription with permissions to create:
- Resource groups
- Azure Container Registry (ACR) instances
- App Services
- Docker: Docker Desktop or Rancher Desktop installed locally
- Blazor PDF Viewer Sample: A working Blazor PDF Viewer application (refer to getting started guide)
---
Deployment Scenarios
1. Docker Web App (Server and WebAssembly)
Dockerfile Configuration for .NET 10/.NET 9/.NET 8 (Server Mode)
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
# install System.Drawing native dependencies
RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev
RUN ln -s libgdiplus.so gdiplus.dll
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["YourServerApp/YourServerApp.csproj", "YourServerApp/"]
RUN dotnet restore "./YourServerApp/YourServerApp.csproj"
COPY . .
WORKDIR "/src/YourServerApp"
RUN dotnet build "./YourServerApp.csproj" -c $BUILD_CONFIGURATION -o /app/build
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./YourServerApp.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "YourServerApp.dll"]Key Points:
- Replace
YourServerApp.dllandYourServerApp.csprojwith actual assembly name - For WebAssembly, add:
RUN dotnet workload install wasm-tools - Native dependencies (
libgdiplus,libc6-dev,libx11-dev) are required for PDF rendering
Local Build and Test Commands
# Build the Docker image
docker build -t pdfviewerwebservice:latest .
# Run the container locally
docker run -d -p 6002:80 pdfviewerwebservice:latest
# Access at http://localhost:6002Troubleshooting Note: If documents fail to load or script errors occur, verify libgdiplus is properly installed in the container image.
---
2. Docker Standalone WebAssembly App
Project Structure Requirements
For standalone WebAssembly samples, add these files to the project:
Dockerfilenginx.confNuGet.Config- Empty
packagefolder
Dockerfile for Standalone WebAssembly
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
# install System.Drawing native dependencies
RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev
RUN ln -s libgdiplus.so gdiplus.dll
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
## Install Python required for WASM tools
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-venv \
&& ln -s /usr/bin/python3 /usr/bin/python || true
## Install WASM tools
RUN dotnet workload install wasm-tools
WORKDIR /src
COPY ["NuGet.Config","/src/"]
COPY ["package", "/src/package"]
RUN dotnet nuget add source package
COPY ["WasmStandalone.csproj", "."]
RUN apt-get update && apt-get install -y emscripten
RUN dotnet restore "WasmStandalone.csproj" --configfile "NuGet.Config"
COPY . .
RUN dotnet build "WasmStandalone.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WasmStandalone.csproj" -c Release -o /app/publish
FROM nginx:alpine AS final
WORKDIR /usr/share/nginx/html
COPY --from=publish /app/publish/wwwroot .
COPY nginx.conf /etc/nginx/nginx.confKey Points:
- Replace
WasmStandalone.csprojwith your actual project name wasm-toolsworkload installation is required:RUN dotnet workload install wasm-tools- Final stage uses nginx for serving static WebAssembly files
Local Build and Test Commands for WebAssembly
# Build the Docker image
docker build -t webassembly .
# List Docker images
docker image ls
# Run the container
docker run -d -p 6003:80 pdfviewer-wasm:latest
# Access at http://localhost:6003---
Azure Container Registry (ACR) Setup
Method 1: Azure Portal (UI-Driven)
Step 1: Create Container Registry
1. In Azure portal, click Create a resource 2. Search for Container Registry → Create 3. Fill in basic details:
- Registry name: Unique name
- Subscription: Select subscription
- Resource group: Create new or use existing
- Location: Choose region
- SKU: Basic (sufficient for testing)
4. Click Review + create, then Create
Step 2: Enable Admin Credentials
1. Open the newly created Container Registry 2. Navigate to Settings → Access keys 3. Toggle Admin user to Enabled 4. Note the following credentials:
- Login server
- Username
- Password
Step 3: Tag and Push Image
Open PowerShell or terminal on your build machine:
# Log in to Azure Container Registry
docker login <login-server>
# Enter username and password from Access keys
# Tag the image for your registry
docker tag pdfviewerwebservice:latest <login-server>/pdfviewerwebservice:latest
# Push the image to ACR
docker push <login-server>/pdfviewerwebservice:latest---
Azure App Service Setup
Create App Service for Container (Linux)
Step 1: Create the App Service
1. In Azure portal, click Create a resource 2. Search for Web App → Create 3. Under Basics tab:
- Subscription: Select subscription
- Resource group: Create new or use existing
- Name: Choose app name (forms the URL)
4. Publish: Choose Docker Container 5. Runtime stack: Choose Linux 6. Choose hosting plan:
- Click Change size
- Select Basic/B1 or higher (recommended for container workloads)
7. Click Review + create, then Create
Step 2: Configure Container Settings
1. Open the created App Service 2. Navigate to Deployment → Container settings (or Settings → Container settings) 3. Image source: Select Azure Container Registry 4. Select your Subscription and Registry (created earlier) 5. Under Image and tag:
- Repository: Select
pdf_viewer_web_service(or your image name) - Tag: Select
latest
6. Click Save
---
Troubleshooting Guide
Common Issues and Solutions
1. App Fails to Start
Possible Causes:
- Check container logs in Azure App Service
- Verify image runs locally first
- Ensure container listens on correct port
Solution:
- Container must listen on port 80 by default
- Or configure App Service container port setting to match your container's port
2. Document Rendering/Script Errors
Possible Causes:
- Missing native dependencies (SkiaSharp,
libgdiplus)
Solution:
- Verify Dockerfile includes:
RUN apt-get update && apt-get install -y --allow-unauthenticated libgdiplus libc6-dev libx11-dev
RUN ln -s libgdiplus.so gdiplus.dll- Test image locally to confirm rendering works
3. WebAssembly WASM Loading Issues
Possible Causes:
- Incorrect MIME types for WASM files
- nginx configuration issues
Solution:
- Ensure
nginx.confincludes proper WASM MIME type configuration - Verify caching headers are set correctly
4. Missing Dependencies
Common Issue: libgdiplus installation issues
Solution:
- Ensure
libgdiplusis installed in the base image - Verify symbolic link is created:
RUN ln -s libgdiplus.so gdiplus.dll
---
Additional Considerations
Using Rancher Desktop / Docker on Windows
- Rancher Desktop can replace Docker Desktop
- Select the docker runtime for standard
dockercommand compatibility - For WSL or Rancher errors during installation, consult Rancher Desktop documentation
SkiaSharp Requirements
- If using
SkiaSharp.Views.Blazoron server or client: - Verify native runtime requirements
- Test rendering in the container environment
- Confirm all native dependencies are present
Server Interactive Scenarios
- Register Syncfusion services in
Program.cs - Configure SignalR message size settings for large-file processing:
builder.Services.AddSignalR(o => {
o.MaximumReceiveMessageSize = 102400000;
});WebAssembly Interactive Render Modes
- Ensure
wasm-toolsworkload is installed:
dotnet workload install wasm-tools- For specific .NET versions:
dotnet workload install wasm-tools-net8 # For .NET 8.0
dotnet workload install wasm-tools-net9 # For .NET 9.0
dotnet workload install wasm-tools-net10 # For .NET 10.0---
Deployment Result
Once successfully deployed, your Blazor PDF Viewer application will be accessible via the Azure App Service URL.
---
Key Deployment Commands Summary
Docker Commands
# Build image
docker build -t pdfviewerwebservice:latest .
# Run locally
docker run -d -p 6002:80 pdfviewerwebservice:latest
# List images
docker image lsAzure Container Registry Commands
# Login to ACR
docker login <login-server>
# Tag image
docker tag pdfviewerwebservice:latest <login-server>/pdfviewerwebservice:latest
# Push to ACR
docker push <login-server>/pdfviewerwebservice:latest---
Important Reminders
1. Read-Only Reference: This documentation is for guidance only 2. No Automatic Changes: Do not apply these changes to project files without explicit user permission 3. User Confirmation Required: Always confirm with the user before modifying:
- Dockerfiles
.csprojfilesProgram.cs- Azure configurations
4. Testing First: Always recommend local testing before Azure deployment 5. Security Considerations: Remind users to secure ACR credentials and manage access keys properly
---
Circle Settings in Blazor SfPdfViewer Component
Table of Contents
Overview
Circle settings allow you to configure default appearance, behavior, and restrictions for circle annotations in the PDF Viewer. Use these settings to control properties of the circle annotation.
Properties List
| Property Name | Description | Data type |
|---|---|---|
| AllowedInteractions | Gets or sets the allowed interactions for the locked annotations. IsLock can be configured using settings. | List<AllowedInteraction> |
| Author | Specifies the author's name to add annotation or review the PDF document. By default it is Guest. | string |
| CustomData | Specifies the user's defined information related to the annotations. By default it is null. | object |
| IsLock | If it is set as true, can't interact with annotation. Otherwise can interact the annotations. By default it is false. | bool |
| IsPrint | Gets or sets the value for the individual annotations are included or not in print actions. | bool |
| MaxHeight | Sets the maximum height of annotations. It prevents the height of the annotation becoming larger than the values provided in MaxHeight.By default it is 0. | int |
| MaxWidth | Sets the maximum width of annotations. It prevents the width of the annotation becoming larger than values provided in MaxWidth.By default it is 0. | int |
| MinHeight | Sets the minimum height of annotations. It prevents the height of the annotation becoming smaller than values provided in MinHeight.By default it is 0. | int |
| MinWidth | Sets the minimum width of annotations. It prevents the width of the annotation becoming smaller than values provided in MinWidth.By default it is 0. | int |
| SkipDownload | If it is set as true, newly added annotations won't be included in downloaded file. By default it is false. | bool |
| SkipPrint | If it is set as true, newly added annotations won't be included in printing. By default it is false. | bool |
| AnnotationSelectorSettings | Defines the annotaton selector settings for the annotation. | PdfViewerAnnotationSelectorSettings |
| BorderDashArray | Defines the border dash array. | int[] |
| FillColor | Specifies the fill color of the annotation. | string |
| Opacity | Defines the opacity for the annotations. By default it is 1. It's range varies 0 to 1. | double |
| StrokeColor | Defines the stroke color of the annotations | string |
| Thickness | Defines the thickness of the annotations. By default it is 1. It's range varies 1 to 10. | int |
Code Example
- We can customize the options, based on the user requirements.
<SfPdfViewer2>
<PdfViewerCircleSettings AllowedInteractions="allowedInteractions" AnnotationSelectorSettings="selectorSettings" Author="Syncfusion" BorderDashArray="[1, 3]" CustomData="CustomData" FillColor="green" IsLock="true" IsPrint="false" MaxHeight="100" MaxWidth="100" MinHeight="50" MinWidth="50" Opacity="0.5" SkipDownload="false" SkipPrint="false" StrokeColor="yellow" Thickness="3"></PdfViewerCircleSettings>
</SfPdfViewer2>
@code {
List<AllowedInteraction> allowedInteractions = new List<AllowedInteraction>() {
AllowedInteraction.Select,
AllowedInteraction.Delete
};
PdfViewerAnnotationSelectorSettings selectorSettings = new PdfViewerAnnotationSelectorSettings() {
SelectionBorderColor = "black",
ResizerBorderColor = "blue",
ResizerCursorType= CursorType.CrossHair,
ResizerFillColor="orange",
ResizerLocation=AnnotationResizerLocation.Corners,
ResizerShape=AnnotationResizerShape.Circle,
ResizerSize=4,
SelectionBorderThickness=2,
SelectorLineDashArray=[1, 2]
};
private object CustomData = new
{
Owner = "Syncfusion"
};
}General Settings in Blazor SfPdfViewer Component
Table of Contents
Overview
When the user needs to customize the PDF Viewer's as context menu settings.
List of Settings
ContextMenuSettings
Defines the settings of context menu for the PDF Viewer. It is used to customize the context menu options to be visible in the PDF Viewer.
Propeties List
| Property Name | Description | Data type | |-----|-----|-----|-----| | EnableContextMenu | Enable or disable context menu in PDF Viewer. By default it is true. | bool | | ContextMenuAction | Defines the context menu action. By default it is RightClick. If it is set as MouseUp, context menu will open on mouse up action instead of right click action. | ContextMenuAction | | ContextMenuItems | Defines the context menu items that should be visible in the PDF Viewer. | List<ContextMenuItem> |
Code Example
<SfPdfViewer2>
<PdfViewerContextMenuSettings ContextMenuAction="ContextMenuAction.MouseUp" ContextMenuItems="contextMenuItems" EnableContextMenu="true"></PdfViewerContextMenuSettings>
</SfPdfViewer2>
@code {
List<ContextMenuItem> contextMenuItems = new List<ContextMenuItem>() {
ContextMenuItem.Copy,
ContextMenuItem.Paste
};
}