DxPdfViewer.ZoomLevel Property
Specifies the document’s zoom level.
Namespace: DevExpress.Blazor.PdfViewer
Assembly: DevExpress.Blazor.PdfViewer.v24.2.dll
NuGet Package: DevExpress.Blazor.PdfViewer
#Declaration
[DefaultValue(-1)]
[Parameter]
public double ZoomLevel { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Double | -1 | The zoom level as a percentage: |
#Remarks
Use the ZoomLevel
property to specify the document’s initial zoom level. Set this property to one of the following values:
- A positive value to specify the zoom level as a percentage.
- A ZoomConstants enumeration value.
-1
to fit a whole single page into the PDF Viewer (corresponds to the ZoomConstants.WholePage option).-2
to fit the document into the PDF Viewer’s current width (corresponds to the ZoomConstants.PageWidth option).
#Example
The following code snippet sets the initial zoom level to 125%:
@using System.Reflection
<DxPdfViewer @ref="pdfViewer"
DocumentContent="@DocumentContent"
ZoomLevel="1.25"/>
@code {
DxPdfViewer pdfViewer { get; set; }
byte[] DocumentContent { get; set; }
protected override async Task OnInitializedAsync() {
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("PdfSample.DataSources.Invoice.pdf");
using (var binaryReader = new BinaryReader(stream)) {
DocumentContent = binaryReader.ReadBytes((int)stream.Length);
}
}
}