Skip to main content
All docs
V25.1
  • DxPdfViewer.ZoomLevel Property

    Specifies the document’s zoom level.

    Namespace: DevExpress.Blazor.PdfViewer

    Assembly: DevExpress.Blazor.PdfViewer.v25.1.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:
    -1 to fit a whole single page into the PDF Viewer.
    -2 to fit the document into the PDF Viewer’s current width.
    A ZoomConstants enumeration value.

    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);
            }
        }
    }
    
    See Also