Class SfPdfViewer
Represents a control that displays a PDF document.
Implements
Inherited Members
Namespace: Syncfusion.Maui.PdfViewer
Assembly: Syncfusion.Maui.PdfViewer.dll
Syntax
public class SfPdfViewer : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, IThemeElement
Constructors
SfPdfViewer()
Initializes a new instance of the SfPdfViewer class.
Declaration
public SfPdfViewer()
Fields
AnnotationModeProperty
Backing store for the AnnotationMode property.
Declaration
public static readonly BindableProperty AnnotationModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
DocumentSourceProperty
Backing store for the DocumentSource property.
Declaration
public static readonly BindableProperty DocumentSourceProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableDocumentLinkNavigationProperty
Backing store for EnableDocumentLinkNavigation property.
Declaration
public static readonly BindableProperty EnableDocumentLinkNavigationProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableHyperlinkNavigationProperty
Backing store for EnableHyperlinkNavigation property.
Declaration
public static readonly BindableProperty EnableHyperlinkNavigationProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableTextSelectionProperty
Backing store for EnableTextSelection property
Declaration
public static readonly BindableProperty EnableTextSelectionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ExtentHeightProperty
Backing store for ExtentHeight property.
Declaration
public static readonly BindableProperty ExtentHeightProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ExtentWidthProperty
Backing store for ExtentWidth property.
Declaration
public static readonly BindableProperty ExtentWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
HorizontalOffsetProperty
Backing store for HorizontalOffset property.
Declaration
public static readonly BindableProperty HorizontalOffsetProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
IsOutlineViewVisibleProperty
Backing store for the IsOutlineViewVisible property.
Declaration
public static readonly BindableProperty IsOutlineViewVisibleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MaxZoomFactorProperty
Backing store for the MaxZoomFactor property.
Declaration
public static readonly BindableProperty MaxZoomFactorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MinZoomFactorProperty
Backing store for the MinZoomFactor property.
Declaration
public static readonly BindableProperty MinZoomFactorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PageCountProperty
Backing store for the PageCount property.
Declaration
public static readonly BindableProperty PageCountProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PageLayoutModeProperty
Backing store for PageLayoutMode property
Declaration
public static readonly BindableProperty PageLayoutModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PageNumberProperty
Backing store for the PageNumber property.
Declaration
public static readonly BindableProperty PageNumberProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowScrollHeadProperty
Backing store for ShowScrollHead property.
Declaration
public static readonly BindableProperty ShowScrollHeadProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowToolbarsProperty
Backing store for the ShowToolbars property.
Declaration
public static readonly BindableProperty ShowToolbarsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TextSearchSettingsProperty
Backing store for TextSearchSettings property.
Declaration
public static readonly BindableProperty TextSearchSettingsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TextSelectionSettingsProperty
Backing store for TextSelectionSettings property
Declaration
public static readonly BindableProperty TextSelectionSettingsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
VerticalOffsetProperty
Backing store for VerticalOffset property.
Declaration
public static readonly BindableProperty VerticalOffsetProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ZoomFactorProperty
Backing store for the ZoomFactorProperty property.
Declaration
public static readonly BindableProperty ZoomFactorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ZoomModeProperty
Backing store for ZoomMode property
Declaration
public static readonly BindableProperty ZoomModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
AnnotationMode
Gets or sets a value indicating the type of annotation that should be drawn using UI interaction on the PDF pages.
Declaration
public AnnotationMode AnnotationMode { get; set; }
Property Value
Type |
---|
AnnotationMode |
Annotations
Gets the list of annotations in the PDF.
Declaration
public ReadOnlyObservableCollection<Annotation> Annotations { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ReadOnlyObservableCollection<Annotation> |
AnnotationSettings
Gets or sets the default annotation settings.
Declaration
public AnnotationSettings AnnotationSettings { get; }
Property Value
Type |
---|
AnnotationSettings |
ClientRectangle
Gets the rectangle that represents the client area (viewport) of the SfPdfViewer control. The client area is the visible portion of the PDF document within the control.
Declaration
public Rect ClientRectangle { get; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Rect |
CustomBookmarks
Gets the list of custom bookmarks in the PDF document.
Declaration
public ObservableCollection<Bookmark> CustomBookmarks { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<Bookmark> |
DocumentOutline
Gets the oultline for the document.
Declaration
public IReadOnlyList<OutlineElement> DocumentOutline { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<OutlineElement> | The outlines in the document. |
DocumentSource
Gets or sets the PDF document source as System.IO.Stream or byte array.
Declaration
public object DocumentSource { get; set; }
Property Value
Type |
---|
System.Object |
EnableDocumentLinkNavigation
Gets or sets a value that indicates whether document link annotations (TOC) in the PDF can be interacted with.
Declaration
public bool EnableDocumentLinkNavigation { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableHyperlinkNavigation
Gets or sets the value that indicates whether the hyperlink navigation can be performed or not.
Declaration
public bool EnableHyperlinkNavigation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
EnablePageNavigationDialog
Gets or sets a value indicating whether the page navigation dialog should be shown when the scroll head is tapped.
Declaration
public bool EnablePageNavigationDialog { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableTextSelection
Gets or sets a value that indicates whether the text selection is enabled or not. The default value is true.
Declaration
public bool EnableTextSelection { get; set; }
Property Value
Type |
---|
System.Boolean |
ExtentHeight
Gets the vertical size of the PDF document displayed by the SfPdfViewer. The value is calculated considering the zoom factor, page spacing, and the overall height of the pages.
Declaration
public double ExtentHeight { get; }
Property Value
Type |
---|
System.Double |
ExtentWidth
Gets the horizontal size of the PDF document displayed by the SfPdfViewer. The value is calculated considering the zoom factor, page spacing, and the overall width of the pages.
Declaration
public double ExtentWidth { get; }
Property Value
Type |
---|
System.Double |
FormFields
Gets the list of form fields in the PDF document.
Declaration
public ReadOnlyObservableCollection<FormField> FormFields { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ReadOnlyObservableCollection<FormField> |
GoToFirstPageCommand
Gets the value that represents the go to first page command.
Declaration
public ICommand GoToFirstPageCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
GoToLastPageCommand
Gets the value that represents the go to last page command.
Declaration
public ICommand GoToLastPageCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
GoToNextPageCommand
Gets the value that represents the go to next page command.
Declaration
public ICommand GoToNextPageCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
GoToPageCommand
Gets the value that represents the go to specific page command.
Declaration
public ICommand GoToPageCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
GoToPreviousPageCommand
Gets the value that represents the go to previous page command.
Declaration
public ICommand GoToPreviousPageCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
HorizontalOffset
Returns the current horizontal scrolled position of the SfPdfViewer.
Declaration
public Nullable<double> HorizontalOffset { get; }
Property Value
Type |
---|
System.Nullable<System.Double> |
IsOutlineViewVisible
Gets or sets a value indicating whether the outline view is visible.
Declaration
public bool IsOutlineViewVisible { get; set; }
Property Value
Type |
---|
System.Boolean |
LoadDocumentCommand
Gets the command that loads a PDF document when executed.
Declaration
public ICommand LoadDocumentCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
MaxZoomFactor
Get or sets the maximum allowed zoom factor.
Declaration
public double MaxZoomFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is 4. The value should not be lower than MinZoomFactor. |
MinZoomFactor
Get or sets the minimum allowed zoom factor.
Declaration
public double MinZoomFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is 0.25 and 1 for desktop and mobile platforms respectively. The value should not exceed the MaxZoomFactor. |
PageCount
Returns the total number of pages in a document.
Declaration
public int PageCount { get; }
Property Value
Type |
---|
System.Int32 |
PageLayoutMode
Gets or sets the layout mode in which the pages will be displayed .
Declaration
public PageLayoutMode PageLayoutMode { get; set; }
Property Value
Type |
---|
PageLayoutMode |
PageNumber
Returns the current page number.
Declaration
public int PageNumber { get; }
Property Value
Type |
---|
System.Int32 |
PrintDocumentCommand
Gets the command to print the PDF document.
Declaration
public ICommand PrintDocumentCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
RedoCommand
Gets the command that performs the redo operation.
Declaration
public ICommand RedoCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
RemoveAllAnnotationsCommand
Gets the command that removes all annotations from the PDF document.
Declaration
public ICommand RemoveAllAnnotationsCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
SaveDocumentCommand
Gets the command that saves the PDF document.
Declaration
public ICommand SaveDocumentCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
ScrollToOffsetCommand
Gets the value that represents the scroll to specific offset command.
Declaration
public ICommand ScrollToOffsetCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
SearchTextCommand
Gets the command to search a text in the PDF document asynchronously.
Declaration
public ICommand SearchTextCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
ShowScrollHead
Gets or sets the value indicates whether or not the scroll head can be shown.
Declaration
public bool ShowScrollHead { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
Remarks
This property is applicable only for the mobile platforms.
ShowToolbars
Gets or sets the value that indicates whether the built-in toolbar is visible
Declaration
public bool ShowToolbars { get; set; }
Property Value
Type |
---|
System.Boolean |
TextSearchSettings
Represents and allows for modification of the text search settings.
Declaration
public TextSearchSettings TextSearchSettings { get; }
Property Value
Type |
---|
TextSearchSettings |
TextSelectionSettings
Gets or sets the text selection settings
Declaration
public TextSelectionSettings TextSelectionSettings { get; set; }
Property Value
Type |
---|
TextSelectionSettings |
Toolbars
Gets the collection of toolbars in the SfPdfViewer
Declaration
public ToolbarCollection Toolbars { get; }
Property Value
Type |
---|
ToolbarCollection |
UndoCommand
Gets the command that performs the undo opertation.
Declaration
public ICommand UndoCommand { get; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
VerticalOffset
Returns the current vertical scrolled position of the SfPdfViewer.
Declaration
public Nullable<double> VerticalOffset { get; }
Property Value
Type |
---|
System.Nullable<System.Double> |
ZoomFactor
Gets or sets the zoom factor for the document loaded in the SfPdfViewer.
Declaration
public double ZoomFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is 1. The value can be set between MinZoomFactor and MaxZoomFactor. If anything set beyond the limit, the value will be clamped. |
ZoomMode
Gets or sets the zoom mode.
Declaration
public ZoomMode ZoomMode { get; set; }
Property Value
Type |
---|
ZoomMode |
Methods
AddAnnotation(Annotation)
Adds the given annotation to the page represented by the annotation’s PageNumber property.
Declaration
public void AddAnnotation(Annotation annotation)
Parameters
Type | Name | Description |
---|---|---|
Annotation | annotation | The annotation to be added. |
Bookmark(Int32, String)
Add the bookmark to the specified page number with the given name.
Declaration
public void Bookmark(int pageNumber, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumber | |
System.String | name |
ClearFormData(Int32)
Clears all form data.
Declaration
public void ClearFormData(int pageNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumber | The page number in which all form fields should be cleared and the fields in the other pages will be left unchanged. This parameter ranges from 1 to the total page count of the document. |
ConvertClientPointToPagePoint(Point, Int32)
Converts a point from the client rectangle (viewport) area coordinates to PDF page coordinates.
Declaration
public Point ConvertClientPointToPagePoint(Point clientPoint, int pageNumber)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Point | clientPoint | The client point to convert. The client point coordinates start from the top-left corner of the client rectangle (viewport) area of the PDF Viewer. |
System.Int32 | pageNumber | The number of the page on which the point conversion will be computed. The required page number on the client position can also be obtained from the GetPageNumberFromClientPoint(Point) method. |
Returns
Type |
---|
Microsoft.Maui.Graphics.Point |
ConvertPagePointToClientPoint(Point, Int32)
Converts a point from PDF page coordinates to client rectangle (viewport) area coordinates.
Declaration
public Point ConvertPagePointToClientPoint(Point pagePoint, int pageNumber)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Point | pagePoint | The PDF page point to convert. The page point coordinates start from the top-left corner of the page corresponding to the given page number. |
System.Int32 | pageNumber | The number of the page on which the point conversion will be computed. |
Returns
Type |
---|
Microsoft.Maui.Graphics.Point |
ConvertPagePointToScrollPoint(Point, Int32)
Converts a point from the PDF page coordinates to the scroll area coordinates of the PDF Viewer.
Declaration
public Point ConvertPagePointToScrollPoint(Point pagePoint, int pageNumber)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Point | pagePoint | The PDF page point to convert. The page point coordinates start from the top-left corner of the page corresponding to the given page number. |
System.Int32 | pageNumber | The number of the PDF page on which the point will be computed. |
Returns
Type |
---|
Microsoft.Maui.Graphics.Point |
Remarks
The scroll coordinates start at the top-left of the first page and end at the bottom-right of the last page. The scroll coordinates are subject to Zoom changes.
DeselectAnnotation(Annotation)
Deselects the given annotation.
Declaration
public void DeselectAnnotation(Annotation annotation)
Parameters
Type | Name | Description |
---|---|---|
Annotation | annotation | Deselects the given annotation. |
ExportAnnotations(Stream, AnnotationDataFormat, List<Annotation>)
Exports the annotations in the PDF document to the specified format and writes the exported data to the given output stream.
Declaration
public void ExportAnnotations(Stream stream, AnnotationDataFormat dataFormat, List<Annotation> annotations = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream that contains the exported annotation data. |
AnnotationDataFormat | dataFormat | The data format in which the annotations should be exported. |
System.Collections.Generic.List<Annotation> | annotations | The annotations to be exported. |
Remarks
If the annotations parameter is not null, only the annotations specified in the collection will be exported and other annotations will be ignored.
ExportAnnotationsAsync(Stream, AnnotationDataFormat, List<Annotation>, CancellationToken)
Exports the annotations in the PDF document to the specified format and writes the exported data to the given output stream.
Declaration
public Task ExportAnnotationsAsync(Stream stream, AnnotationDataFormat dataFormat, List<Annotation> annotations = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream that contains the exported annotation data. |
AnnotationDataFormat | dataFormat | The data format in which the annotations should be exported. |
System.Collections.Generic.List<Annotation> | annotations | The annotations to be exported. |
System.Threading.CancellationToken | cancellationToken | The token to receive notice of the cancellation. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
If the annotations parameter is not null, only the annotations specified in the collection will be exported and other annotations will be ignored.
ExportFormData(Stream, DataFormat)
Exports the form data in the PDF document to the specified format and writes the exported data to the given output stream.
Declaration
public void ExportFormData(Stream stream, DataFormat dataFormat)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream that contains the exported form data. |
DataFormat | dataFormat | The data format in which the form data should be exported. |
ExportFormDataAsync(Stream, DataFormat, CancellationToken)
Exports the form data in the PDF document to the specified format and writes the exported data to the given output stream.
Declaration
public Task ExportFormDataAsync(Stream stream, DataFormat dataFormat, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
DataFormat | dataFormat | |
System.Threading.CancellationToken | cancellationToken |
Returns
Type |
---|
System.Threading.Tasks.Task |
GetPageNumberFromClientPoint(Point)
Gets the page number corresponding to the client point.
Declaration
public int GetPageNumberFromClientPoint(Point clientPoint)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Point | clientPoint | The client point on which the page number need to be computed. The client point coordinates start from the top-left corner of the client rectangle (viewport) area of the PDF Viewer. |
Returns
Type |
---|
System.Int32 |
Remarks
It returns -1, when computed from an invalid area such as page gaps.
GoToBookmark(Bookmark)
Jumps to the specified bookmark of a document.
Declaration
public void GoToBookmark(Bookmark customBookmark)
Parameters
Type | Name | Description |
---|---|---|
Bookmark | customBookmark |
GoToFirstPage()
Jumps to the first page of a document.
Declaration
public void GoToFirstPage()
GoToLastPage()
Jumps to the last page of a document.
Declaration
public void GoToLastPage()
GoToNextPage()
Jumps to the next page of a document.
Declaration
public void GoToNextPage()
GoToOutlineElement(OutlineElement)
Navigates to the location of the given outline element.
Declaration
public void GoToOutlineElement(OutlineElement outlineElement)
Parameters
Type | Name | Description |
---|---|---|
OutlineElement | outlineElement |
GoToPage(Int32)
Jumps to the specified page in a document.
Declaration
public void GoToPage(int pageNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumber | The number of the page to which the control should go. |
GoToPreviousPage()
Jumps to the previous page of a document.
Declaration
public void GoToPreviousPage()
ImportAnnotations(Stream, AnnotationDataFormat)
Imports annotation data into the PDF document.
Declaration
public void ImportAnnotations(Stream stream, AnnotationDataFormat annotationDataFormat)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream that contains the annotation data to be imported. |
AnnotationDataFormat | annotationDataFormat | The data format of the input stream. |
ImportAnnotationsAsync(Stream, AnnotationDataFormat, CancellationToken)
Imports annotation data into the PDF document.
Declaration
public Task ImportAnnotationsAsync(Stream annotationDataStream, AnnotationDataFormat annotationDataFormat, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | annotationDataStream | The stream to which the PDF document is saved. |
AnnotationDataFormat | annotationDataFormat | The data format of the input stream. |
System.Threading.CancellationToken | cancellationToken | The token to receive notice of the cancellation. |
Returns
Type |
---|
System.Threading.Tasks.Task |
ImportFormData(Stream, DataFormat, Boolean)
Imports form data into the PDF document.
Declaration
public void ImportFormData(Stream stream, DataFormat dataFormat, bool continueImportOnError = false)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
DataFormat | dataFormat | |
System.Boolean | continueImportOnError |
ImportFormDataAsync(Stream, DataFormat, Boolean, CancellationToken)
Imports form data into the PDF document.
Declaration
public Task ImportFormDataAsync(Stream stream, DataFormat dataFormat, bool continueImportOnError = false, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
DataFormat | dataFormat | |
System.Boolean | continueImportOnError | |
System.Threading.CancellationToken | cancellationToken |
Returns
Type |
---|
System.Threading.Tasks.Task |
LoadDocument(Byte[], String, Nullable<FlattenOptions>)
Loads the PDF document from the specified bytes.
Declaration
public void LoadDocument(byte[] documentBytes, string password = null, Nullable<FlattenOptions> flattenOptions)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | documentBytes | The document as byte array |
System.String | password | Password for the document. It is required to open a password protected document. |
System.Nullable<FlattenOptions> | flattenOptions | The option that represents whether annotations or form fields should be flattened. |
LoadDocument(Stream, String, Nullable<FlattenOptions>)
Loads the PDF document from the specified stream.
Declaration
public void LoadDocument(Stream documentStream, string password = null, Nullable<FlattenOptions> flattenOptions)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | documentStream | The document stream. |
System.String | password | Password for the document. It is required to open a password protected document. |
System.Nullable<FlattenOptions> | flattenOptions | The option that represents whether annotations or form fields should be flattened. |
LoadDocumentAsync(Byte[], String, Nullable<FlattenOptions>, CancellationTokenSource)
Loads the PDF document asynchronously from the specified bytes.
Declaration
public Task LoadDocumentAsync(byte[] documentBytes, string password = null, Nullable<FlattenOptions> flattenOptions, CancellationTokenSource cancellationTokenSource = null)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | documentBytes | The document as byte array. |
System.String | password | Password for the document. It is required to open a password protected document. |
System.Nullable<FlattenOptions> | flattenOptions | The option that represents whether annotations or form fields should be flattened. |
System.Threading.CancellationTokenSource | cancellationTokenSource | The cancellation token source for cancelling the task. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Returns the task |
LoadDocumentAsync(Stream, String, Nullable<FlattenOptions>, CancellationTokenSource)
Loads the PDF document asynchronously from the specified stream.
Declaration
public Task LoadDocumentAsync(Stream documentStream, string password = null, Nullable<FlattenOptions> flattenOptions, CancellationTokenSource cancellationTokenSource = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | documentStream | The document stream. |
System.String | password | Password for the document. It is required to open a password protected document. |
System.Nullable<FlattenOptions> | flattenOptions | The option that represents whether annotations or form fields should be flattened. |
System.Threading.CancellationTokenSource | cancellationTokenSource | The cancellation token source for cancelling the task. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Returns the task |
OnDraw(ICanvas, RectF)
Declaration
protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.RectF | dirtyRect |
Overrides
OnSizeAllocated(Double, Double)
Called when the control size is allocated
Declaration
protected override void OnSizeAllocated(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Control's new width |
System.Double | height | Control's new height |
PrintDocument()
Prints the PDF document.
Declaration
public void PrintDocument()
RemoveAllAnnotations()
Removes all annotations from the PDF document.
Declaration
public void RemoveAllAnnotations()
RemoveAnnotation(Annotation)
Removes the given annotation from the page.
Declaration
public void RemoveAnnotation(Annotation annotation)
Parameters
Type | Name | Description |
---|---|---|
Annotation | annotation | The annotation to be removed. |
SaveDocument(Stream)
Saves the PDF document and writes the final document into the given output stream.
Declaration
public void SaveDocument(Stream outputStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | outputStream | The stream to which the PDF document is saved. |
SaveDocumentAsync(Stream, CancellationToken)
Saves the PDF document and writes the final document into the given output stream.
Declaration
public Task SaveDocumentAsync(Stream outputStream, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | outputStream | The stream to which the PDF document is saved. |
System.Threading.CancellationToken | cancellationToken | The token to receive notice of the cancellation. |
Returns
Type |
---|
System.Threading.Tasks.Task |
ScrollToOffset(Double, Double)
Scrolls the content to the specified offset.
Declaration
public void ScrollToOffset(double horizontalOffset, double verticalOffset)
Parameters
Type | Name | Description |
---|---|---|
System.Double | horizontalOffset | The value to which the control scrolls horizontally. The value is measured in device-independent units. |
System.Double | verticalOffset | The value to which the control scrolls vertically. The value is measured in device-independent units. |
SearchTextAsync(String, TextSearchOptions, CancellationTokenSource)
Finds and highlights all occurrences of the given text in the PDF document asynchronously.
Declaration
public Task<TextSearchResult> SearchTextAsync(string text, TextSearchOptions searchOption, CancellationTokenSource cancellationTokenSource = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text or keyword to be searched. |
TextSearchOptions | searchOption | The constant to specify the text search options. |
System.Threading.CancellationTokenSource | cancellationTokenSource | The cancellation token to cancel the current search progress. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TextSearchResult> | Provides the search result obtained from searching a given text. |
SelectAnnotation(Annotation)
Selects the given annotation.
Declaration
public void SelectAnnotation(Annotation annotation)
Parameters
Type | Name | Description |
---|---|---|
Annotation | annotation | The annotation to be selected. |
UnloadDocument()
Unloads the current PDF document.
Declaration
public void UnloadDocument()
UnloadDocumentAsync()
Unloads the current PDF document asynchronously.
Declaration
public Task UnloadDocumentAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
Events
AnnotationAdded
Occurs when an annotation is added to a page.
Declaration
public event EventHandler<AnnotationEventArgs> AnnotationAdded
Event Type
Type |
---|
System.EventHandler<AnnotationEventArgs> |
AnnotationDeselected
Occurs when a selected annotation gets deselected.
Declaration
public event EventHandler<AnnotationEventArgs> AnnotationDeselected
Event Type
Type |
---|
System.EventHandler<AnnotationEventArgs> |
AnnotationEdited
Occurs when annotation is modified.
Declaration
public event EventHandler<AnnotationEventArgs> AnnotationEdited
Event Type
Type |
---|
System.EventHandler<AnnotationEventArgs> |
AnnotationRemoved
Occurs when an annotation is removed from the page.
Declaration
public event EventHandler<AnnotationEventArgs> AnnotationRemoved
Event Type
Type |
---|
System.EventHandler<AnnotationEventArgs> |
AnnotationSelected
Occurs when an annotation is selected.
Declaration
public event EventHandler<AnnotationEventArgs> AnnotationSelected
Event Type
Type |
---|
System.EventHandler<AnnotationEventArgs> |
CustomStampModalViewAppearing
Occurs when the custom stamp modal view is about to appear.
Declaration
public event EventHandler<AnnotationModalViewAppearingEventArgs> CustomStampModalViewAppearing
Event Type
Type |
---|
System.EventHandler<AnnotationModalViewAppearingEventArgs> |
CustomStampModalViewDisappearing
Occurs when the custom stamp modal view is about to disappear after being dismissed.
Declaration
public event EventHandler<EventArgs> CustomStampModalViewDisappearing
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
DocumentLoaded
Occurs when a PDF document is loaded.
Declaration
public event EventHandler<EventArgs> DocumentLoaded
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
DocumentLoadFailed
Occurs when the PDF Viewer fails to load a PDF document.
Declaration
public event EventHandler<DocumentLoadFailedEventArgs> DocumentLoadFailed
Event Type
Type |
---|
System.EventHandler<DocumentLoadFailedEventArgs> |
DocumentUnloaded
Occurs when a PDF document is unloaded.
Declaration
public event EventHandler<EventArgs> DocumentUnloaded
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
FormFieldFocusChanged
Occurs when a form field receives or loses focus.
Declaration
public event EventHandler<FormFieldFocusChangedEvenArgs> FormFieldFocusChanged
Event Type
Type |
---|
System.EventHandler<FormFieldFocusChangedEvenArgs> |
Remarks
The event will occur only for text and signature fields.
FormFieldValueChanged
Occurs when form field value changes.
Declaration
public event EventHandler<FormFieldValueChangedEventArgs> FormFieldValueChanged
Event Type
Type |
---|
System.EventHandler<FormFieldValueChangedEventArgs> |
FreeTextModalViewAppearing
Occurs when the free text modal view is about to appear.
Declaration
public event EventHandler<AnnotationModalViewAppearingEventArgs> FreeTextModalViewAppearing
Event Type
Type |
---|
System.EventHandler<AnnotationModalViewAppearingEventArgs> |
FreeTextModalViewDisappearing
Occurs when the free text modal view is about to disappear after being dismissed.
Declaration
public event EventHandler<EventArgs> FreeTextModalViewDisappearing
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
HyperlinkClicked
Occurs when hyperlink is clicked or tapped.
Declaration
public event EventHandler<HyperlinkClickedEventArgs> HyperlinkClicked
Event Type
Type |
---|
System.EventHandler<HyperlinkClickedEventArgs> |
PasswordRequested
Occurs when a security password is required to open a PDF document.
Declaration
public event EventHandler<PasswordRequestedEventArgs> PasswordRequested
Event Type
Type |
---|
System.EventHandler<PasswordRequestedEventArgs> |
SignatureCreated
Occurs when a signature is created using the built-in signature pad.
Declaration
public event EventHandler<SignatureCreatedEventArgs> SignatureCreated
Event Type
Type |
---|
System.EventHandler<SignatureCreatedEventArgs> |
SignatureModalViewAppearing
Occurs when the signature modal view is about to appear.
Declaration
public event EventHandler<FormFieldModalViewAppearingEventArgs> SignatureModalViewAppearing
Event Type
Type |
---|
System.EventHandler<FormFieldModalViewAppearingEventArgs> |
SignatureModalViewDisappearing
Occurs when the signature modal view is about to disappear after being dismissed.
Declaration
public event EventHandler<EventArgs> SignatureModalViewDisappearing
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
StickyNoteModalViewAppearing
Occurs when the sticky note modal view is about to appear.
Declaration
public event EventHandler<AnnotationModalViewAppearingEventArgs> StickyNoteModalViewAppearing
Event Type
Type |
---|
System.EventHandler<AnnotationModalViewAppearingEventArgs> |
StickyNoteModalViewDisappearing
Occurs when the sticky note modal view is about to disappear after being dismissed.
Declaration
public event EventHandler<EventArgs> StickyNoteModalViewDisappearing
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
Tapped
Occurs when the SfPdfViewer is tapped.
Declaration
public event EventHandler<GestureEventArgs> Tapped
Event Type
Type |
---|
System.EventHandler<GestureEventArgs> |
TextSearchProgress
Occurs when the text search is in progress.
Declaration
public event EventHandler<TextSearchProgressEventArgs> TextSearchProgress
Event Type
Type |
---|
System.EventHandler<TextSearchProgressEventArgs> |
TextSelectionChanged
Occurs when the text is selected or when the selected text is changed.
Declaration
public event EventHandler<TextSelectionChangedEventArgs> TextSelectionChanged
Event Type
Type |
---|
System.EventHandler<TextSelectionChangedEventArgs> |