Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,14 @@
<li><a href="/document-processing/pdf/pdf-viewer/blazor/organize-pages/events">Events</a></li>
</ul>
</li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/print">Print</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/print/overview">Print</a>
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/print/print-modes">Print Modes</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/print/print-quality">Print Quality</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/print/enable-print-rotation">Print rotation</a></li>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/print/events">Events</a></li>
</ul>
</li>
<li> <a href="/document-processing/pdf/pdf-viewer/blazor/document-security-overview">Document security</a>
<ul>
<li><a href="/document-processing/pdf/pdf-viewer/blazor/document-security/password-protected">Password Protected</a></li>
Expand Down
Comment thread
SF4524LogeshKumar marked this conversation as resolved.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
layout: post
title: Enable Print Rotation in Blazor PDF Viewer | Syncfusion
description: Learn how to enable print rotation for landscape documents in the Syncfusion Blazor PDF Viewer component.
platform: document-processing
control: Print
documentation: ug
domainurl: ##DomainURL##
---

# Enable print rotation in Blazor PDF Viewer

This guide shows how to enable automatic rotation of landscape pages during printing so they match the paper orientation and reduce clipping. Use [EnablePrintRotation](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnablePrintRotation) when printing documents that include landscape pages and you want them rotated to match the printer paper orientation.
Comment thread
SF4524LogeshKumar marked this conversation as resolved.
Outdated

## Prerequisites
Comment thread
SF4524LogeshKumar marked this conversation as resolved.
Outdated

- A Blazor app with the Syncfusion PDF Viewer component integrated.

## Steps to enable print rotation

1. Configure the [SfPdfViewer](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.SfPdfViewer.html) component in your Blazor application.
2. Set [EnablePrintRotation](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnablePrintRotation)="true" in the PDF Viewer during initialization.

## Example

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 Height="100%"
Width="100%"
DocumentPath="@DocumentPath"
EnablePrintRotation="true" />

@code{
public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
{% endhighlight %}
{% endtabs %}

![Print rotation demo showing landscape pages rotated for printing](../images/print-rotate.gif)

[View Sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Print)

## Troubleshooting

- If you need to preserve original page orientation for archival printing, set [EnablePrintRotation](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnablePrintRotation)="false".
- Confirm that the PDF Viewer component is properly configured with the correct resource URL.

## See also

- [Overview](./overview)
- [Print quality](./print-quality)
- [Print modes](./print-modes)
- [Print events](./events)
84 changes: 84 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/blazor/print/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
layout: post
title: Print Events in Blazor PDF Viewer | Syncfusion
description: Learn how to configure print events and track usage and implements workflows in the Syncfusion Blazor PDF Viewer component.
platform: document-processing
control: Print
documentation: ug
domainurl: ##DomainURL##
---

# Print events in Blazor PDF Viewer

This page lists each event emitted by the Blazor PDF Viewer's print feature, the argument schema, and the minimal behavior notes needed for implementation.

## Events

| Name | Description |
|--------------|-------------|
| [PrintStart](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_PrintStart) | Raised when a print action begins. Use the event to log activity or cancel printing. |
| [PrintEnd](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_PrintEnd) | Raised after a print action completes. Use the event to notify users or clean up resources. |

### PrintStart Event

The [PrintStart](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_PrintStart) event triggers when a print action begins.

#### Event arguments

See [PrintStartEventArgs](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PrintStartEventArgs.html) for details such as `FileName` and the `Cancel` option.

- If the [Cancel](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PrintStartEventArgs.html#Syncfusion_Blazor_SfPdfViewer_PrintStartEventArgs_Cancel) property is set to `true` in the `PrintStart` event handler, the print operation is canceled and the print dialog does not open.
- By default, `Cancel` is `false`.

The following example illustrates how to handle the `PrintStart` event.

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer
<SfPdfViewer2 DocumentPath="@DocumentPath" Height="100%" Width="100%">
<PdfViewerEvents PrintStart="@PrintStart"></PdfViewerEvents>
</SfPdfViewer2>
@code{
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf";
public async Task PrintStart(PrintStartEventArgs args)
{
Console.WriteLine($"Printed File Name: {args.FileName}");
}
}
{% endhighlight %}
{% endtabs %}

### PrintEnd Event

The [PrintEnd](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerEvents.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerEvents_PrintEnd) event triggers when a print action completes.

#### 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.

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer
<SfPdfViewer2 DocumentPath="@DocumentPath" Height="100%" Width="100%">
<PdfViewerEvents PrintEnd="@PrintEnd"></PdfViewerEvents>
</SfPdfViewer2>
@code{
private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succintly.pdf";
public async Task PrintEnd(PrintEndEventArgs args)
{
Console.WriteLine($"Printed File Name: {args.FileName}");
}
}
{% endhighlight %}
{% endtabs %}

[View Sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Print)

## See also

- [Overview](./overview)
- [Print quality](./print-quality)
- [Enable print rotation](./enable-print-rotation)
- [Print modes](./print-modes)
88 changes: 88 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/blazor/print/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
layout: post
title: Print PDF in Blazor PDF Viewer | Syncfusion
description: Enable and customize printing, configure print events, cancel print, and monitor printing in the Syncfusion Blazor PDF Viewer component.
platform: document-processing
control: Print
documentation: ug
domainurl: ##DomainURL##
---

# Print PDF in Blazor PDF Viewer

The Blazor PDF Viewer includes built-in printing via the toolbar and APIs so users can control how documents are printed and monitor the process.

Select **Print** in the built-in toolbar to open the browser print dialog.

![Browser print dialog from PDF Viewer](../images/print.gif)

## Enable or Disable Print in Blazor PDF Viewer

The Syncfusion Blazor PDF Viewer component lets users print a loaded PDF document through the built-in toolbar or programmatic calls. Control whether printing is available by setting the [EnablePrint](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnablePrint) property (`true` enables printing; `false` disables it).

The following Blazor example renders the PDF Viewer with printing disabled.

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 Height="100%"
Width="100%"
DocumentPath="@DocumentPath"
EnablePrint="false" />

@code{
public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
{% endhighlight %}
{% endtabs %}

## Print programmatically in Blazor PDF Viewer

To start printing from code, call the [PrintAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.SfPdfViewer.html#Syncfusion_Blazor_SfPdfViewer_SfPdfViewer_PrintAsync) method after the document is fully loaded. This approach is useful when wiring up custom UI or initiating printing automatically; calling print before the document finishes loading can result in no output or an empty print dialog.

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer
@using Syncfusion.Blazor.Buttons

<SfButton OnClick="OnClick">Print</SfButton>
<SfPdfViewer2 Width="100%"
Height="100%"
DocumentPath="@DocumentPath"
@ref="@Viewer" />

@code{
SfPdfViewer2 Viewer;
public string DocumentPath { get; set; } = "wwwroot/data/PDF_Succinctly.pdf";

public async void OnClick(MouseEventArgs args)
{
await Viewer.PrintAsync();
}
}
{% endhighlight %}
{% endtabs %}

## Key capabilities

- Enable or disable printing with the [EnablePrint](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_EnablePrint) property
- Start printing from UI (toolbar Print) or programmatically using [PrintAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.SfPdfViewer.html#Syncfusion_Blazor_SfPdfViewer_SfPdfViewer_PrintAsync).
- Control output quality with the [PrintScaleFactor](./print-quality) property (0.5–5)
Comment thread
SF4524LogeshKumar marked this conversation as resolved.
Outdated
- Auto‑rotate pages during print using [EnablePrintRotation](./enable-print-rotation)
- Choose where printing happens with [PrintMode](./print-modes) (Default or NewWindow)
- Track the life cycle with [PrintStart and PrintEnd events](./events)

## Troubleshooting

- Ensure the resource URL value matches the deployed `ej2-pdfviewer-lib` version.
- Calling [PrintAsync()](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.SfPdfViewer.html#Syncfusion_Blazor_SfPdfViewer_SfPdfViewer_PrintAsync) launches the browser print dialog; behavior varies by browser and may be affected by popup blockers or browser settings.

[View Sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Print)

## See Also

- [Print quality](./print-quality)
- [Enable print rotation](./enable-print-rotation)
- [Print modes](./print-modes)
- [Print events](./events)
67 changes: 67 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/blazor/print/print-modes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
layout: post
title: Print Modes in Blazor PDF Viewer | Syncfusion
description: Learn how to configure print modes for PDF Documents in the Syncfusion Blazor PDF Viewer component and more.
platform: document-processing
control: Print
documentation: ug
domainurl: ##DomainURL##
---

# Print Modes in the Blazor PDF Viewer
Comment thread
SF4524LogeshKumar marked this conversation as resolved.
Outdated

This guide shows how to set the PDF Viewer [`PrintMode`](https://ej2.syncfusion.com/blazor/documentation/api/pdfviewer/pdfviewer#printmode) so PDFs print from the current window or from a new window/tab.

## Prerequisites

- A Blazor app with the Syncfusion PDF Viewer component integrated.

## Steps to set print mode

**Step 1:** Decide which [PrintMode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintMode) you need:
- `PrintMode.Default` — print from the same browser window.
- `PrintMode.NewWindow` — print from a new window or tab (may be blocked by pop-up blockers).

**Step 2:** Set [PrintMode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintMode) during viewer initialization (recommended):

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 Height="100%"
Width="100%"
DocumentPath="@DocumentPath"
PrintMode="PrintMode.NewWindow" />

@code{
public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
{% endhighlight %}
{% endtabs %}

![Print in New Window](../images/print-newwindow.gif)

**Step 3:** Print mode can also be changed at runtime after the viewer is created:

{% tabs %}
{% highlight razor %}
// switch to NewWindow at runtime
pdfViewerRef.PrintMode = "NewWindow";
{% endhighlight %}
{% endtabs %}

## Quick reference

- `PrintMode.Default`: Print from the same window (default).
- `PrintMode.NewWindow`: Print from a new window or tab.

N> Browser pop-up blockers must allow new windows or tabs when using `PrintMode = PrintMode.NewWindow`.

[View samples on GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Print)

## See also

- [Overview](./overview)
- [Print quality](./print-quality)
- [Enable print rotation](./enable-print-rotation)
- [Print events](./events)
70 changes: 70 additions & 0 deletions Document-Processing/PDF/PDF-Viewer/blazor/print/print-quality.md
Comment thread
SF4524LogeshKumar marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
layout: post
title: Customize Print Quality in Blazor PDF Viewer | Syncfusion
description: Learn how to customize print quality for PDF Documents in the Syncfusion Blazor PDF Viewer component.
platform: document-processing
control: Print
documentation: ug
domainurl: ##DomainURL##
---

# Customize Print Quality in Blazor PDF Viewer

This article shows a concise, task-oriented workflow to set and verify print quality for documents rendered by the Blazor PDF Viewer by using the [PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) property.

**Goal:** Set a suitable [PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) to improve printed output sharpness while balancing performance and memory use.

## Steps

### 1. Choose a target print quality.

- Valid [PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) values: **0.5 – 5**. Higher values increase image sharpness and resource use.
- Default value: **1**.

### 2. Set `PrintScaleFactor` during initialization

It is recommended that you set the [PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) in the viewer options during initialization.

{% tabs %}
{% highlight razor %}
@using Syncfusion.Blazor.SfPdfViewer

<SfPdfViewer2 Height="100%"
Width="100%"
DocumentPath="@DocumentPath"
PrintScaleFactor="2" />

@code{
public string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf";
}
{% endhighlight %}
{% endtabs %}

### 3. Set `PrintScaleFactor` after instantiation

As an alternative option, the [PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) can be dynamically changed during runtime

{% tabs %}
{% highlight razor %}
// Update PrintScaleFactor at runtime
pdfViewerRef.PrintScaleFactor = 2; // increase print resolution for upcoming prints
{% endhighlight %}
{% endtabs %}

### 4. Verify output

Use browser Print Preview or produce a printed/PDF copy to confirm sharpness and acceptable render time.

## Notes

- Values outside the supported range **0.5 – 5** will be ignored and fall back to the default (`1`).
- Increasing [PrintScaleFactor](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_PrintScaleFactor) raises CPU, memory, and rendering time requirements. Test on target machines and documents before setting a higher factor.

[View samples on GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Print)

## See Also

- [Overview](./overview)
- [Enable print rotation](./enable-print-rotation)
- [Print modes](./print-modes)
- [Print events](./events)