Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

C#
[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%:

Razor
@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