Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose documentTitle option from PrintJS #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions source/Append.Blazor.Printing/PrintOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public PrintOptions(string printable, string modalMessage, PrintType printType =
/// </summary>
public PrintType Type { get; init; }
/// <summary>
/// When printing html, image or json, this will be shown as the document title.
/// </summary>
public string DocumentTitle { get; set; } = "Document";
/// <summary>
/// Enable this option to show user feedback when retrieving or processing large PDF files.
/// </summary>
public bool ShowModal { get; init; }
Expand Down
3 changes: 3 additions & 0 deletions source/Append.Blazor.Printing/PrintOptionsAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal record PrintOptionsAdapter
{
public string Printable { get; init; }
public string Type { get; init; }
public string DocumentTitle { get; set; } = "Document";
public bool ShowModal { get; init; }
public string ModalMessage { get; init; } = "Retrieving Document...";
public bool? Base64 { get; set; }
Expand All @@ -18,6 +19,8 @@ public PrintOptionsAdapter(PrintOptions options)
{
Printable = options.Printable;
Type = options.Type.ToPrintJsString();
if (!string.IsNullOrWhiteSpace(options.DocumentTitle))
DocumentTitle = options.DocumentTitle;
ShowModal = options.ShowModal;
ModalMessage = options.ModalMessage;
Base64 = options.Base64 == true ? true : null;
Expand Down