Back to Devexpress

DxPdfViewer.ZoomLevel Property

blazor-devexpress-dot-blazor-dot-pdfviewer-dot-dxpdfviewer-8b5e33e6.md

latest2.4 KB
Original Source

DxPdfViewer.ZoomLevel Property

Specifies the document’s zoom level.

Namespace : DevExpress.Blazor.PdfViewer

Assembly : DevExpress.Blazor.PdfViewer.v25.2.dll

NuGet Package : DevExpress.Blazor.PdfViewer

Declaration

csharp
[DefaultValue(-1)]
[Parameter]
public double ZoomLevel { get; set; }

Property Value

TypeDefaultDescription
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

DxPdfViewer Class

DxPdfViewer Members

DevExpress.Blazor.PdfViewer Namespace