diff --git a/Document-Processing/PDF/PDF-Viewer/blazor/print.md b/Document-Processing/PDF/PDF-Viewer/blazor/print.md index ec68af2b6..95efecff4 100644 --- a/Document-Processing/PDF/PDF-Viewer/blazor/print.md +++ b/Document-Processing/PDF/PDF-Viewer/blazor/print.md @@ -52,6 +52,127 @@ The SfPdfViewer supports printing the loaded PDF by default. Enable or disable t ``` +## EnablePrintRotation in the Blazor SfPdfViewer + +[EnablePrintRotation](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnablePrintRotation) controls whether landscape pages are auto-rotated to best fit when printing. Default: true. Set to false to preserve the original page orientation and suppress automatic rotation during print. + +```cshtml + +@using Syncfusion.Blazor.SfPdfViewer + + + +@code{ + public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf"; +} + +``` + +## Print modes in the Blazor SfPdfViewer + +[PrintMode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintMode) specifies how the print dialog is opened. Default: PrintMode.Default (prints from the same window). Supported values: + +- [PrintMode.Default](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PrintMode.html#Syncfusion_Blazor_SfPdfViewer_PrintMode_Default) — Opens the print dialog in the same window. +- [PrintMode.NewWindow](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PrintMode.html#Syncfusion_Blazor_SfPdfViewer_PrintMode_NewWindow) — Opens the print dialog from a new browser window/tab, which can be useful depending on browser popup policies. + +```cshtml + +@using Syncfusion.Blazor.SfPdfViewer + + + +@code{ + public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf"; +} + +``` + +## PrintScaleFactor in the Blazor SfPdfViewer + +[PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) sets the scale used when rendering pages for printing. By default the scale factor set as 1.0 (prints at the on-screen scale). Valid range from 0.5 to 5.0. Higher values can improve output clarity for documents with smaller page dimensions and may increase print processing time. + +```cshtml + +@using Syncfusion.Blazor.SfPdfViewer + + + +@code{ + public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf"; +} + +``` + +## Print Events in Blazor SfPdfViewer + +The following events are available in the SfPdfViewer component. + +|Name|Description| +|---|---| +|PrintStart|Triggers when a print action starts.| +|PrintEnd|Triggers when a print action is completed.| + +### PrintStart Event + +The [PrintStart](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_PrintStart) event triggers when the print action is started. + +#### Event Arguments + +See [PrintStartEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PrintStartEventArgs.html) for details such as Filename, Cancel option. + +The following example illustrates how to handle the PrintStart event. + +```cshtml + +@using Syncfusion.Blazor.SfPdfViewer + + + +@code{ + private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf"; + public async Task PrintStart(PrintStartEventArgs args) + { + Console.WriteLine($"Printed File Name: {args.FileName}"); + } +} + +``` + +### PrintEnd Event + +The [PrintEnd](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_PrintEnd) event triggers when an annotation is added to a page in the PDF document. + +#### Event Arguments + +See [PrintEndEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PrintEndEventArgs.html) for details such as Filename. + +The following example illustrates how to handle the PrintEnd event. + +```cshtml + +@using Syncfusion.Blazor.SfPdfViewer + + + +@code{ + private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf"; + public async Task PrintEnd(PrintEndEventArgs args) + { + Console.WriteLine($"Printed File Name: {args.FileName}"); + } +} + +``` + ## See also * [Download in Blazor SfPdfViewer component](https://help.syncfusion.com/document-processing/pdf/pdf-viewer/blazor/saving-pdf-file#download-in-blazor-sfpdfviewer-component)