diff --git a/src/components/BootstrapBlazor.Html2Pdf/BootstrapBlazor.Html2Pdf.csproj b/src/components/BootstrapBlazor.Html2Pdf/BootstrapBlazor.Html2Pdf.csproj
index 29e7dc3d..bca9d00b 100644
--- a/src/components/BootstrapBlazor.Html2Pdf/BootstrapBlazor.Html2Pdf.csproj
+++ b/src/components/BootstrapBlazor.Html2Pdf/BootstrapBlazor.Html2Pdf.csproj
@@ -1,7 +1,7 @@
- 9.0.4
+ 9.0.6-beta01
@@ -10,7 +10,7 @@
-
+
diff --git a/src/components/BootstrapBlazor.Html2Pdf/Extensions/ServiceCollectionExtensions.cs b/src/components/BootstrapBlazor.Html2Pdf/Extensions/ServiceCollectionExtensions.cs
index 8d2b2169..daccd909 100644
--- a/src/components/BootstrapBlazor.Html2Pdf/Extensions/ServiceCollectionExtensions.cs
+++ b/src/components/BootstrapBlazor.Html2Pdf/Extensions/ServiceCollectionExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
+// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
diff --git a/src/components/BootstrapBlazor.Html2Pdf/Services/DefaultPdfService.cs b/src/components/BootstrapBlazor.Html2Pdf/Services/DefaultPdfService.cs
index 935e3bbc..cf60fc51 100644
--- a/src/components/BootstrapBlazor.Html2Pdf/Services/DefaultPdfService.cs
+++ b/src/components/BootstrapBlazor.Html2Pdf/Services/DefaultPdfService.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
+// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
@@ -19,10 +19,7 @@ class DefaultPdfService(ILogger logger) : IHtml2Pdf
///
public IWebProxy? WebProxy { get; set; }
- ///
- ///
- ///
- public async Task PdfDataAsync(string url)
+ public async Task PdfDataAsync(string url, PdfOptions? options = null)
{
try
{
@@ -30,7 +27,7 @@ public async Task PdfDataAsync(string url)
await using var page = await browser.NewPageAsync();
await page.GoToAsync(url);
- return await page.PdfDataAsync();
+ return await page.PdfDataAsync(GetOptions(options));
}
catch (Exception ex)
{
@@ -39,10 +36,7 @@ public async Task PdfDataAsync(string url)
}
}
- ///
- ///
- ///
- public async Task PdfStreamAsync(string url)
+ public async Task PdfStreamAsync(string url, PdfOptions? options = null)
{
try
{
@@ -50,7 +44,7 @@ public async Task PdfStreamAsync(string url)
await using var page = await browser.NewPageAsync();
await page.GoToAsync(url);
- return await page.PdfStreamAsync();
+ return await page.PdfStreamAsync(GetOptions(options));
}
catch (Exception ex)
{
@@ -59,13 +53,7 @@ public async Task PdfStreamAsync(string url)
}
}
- ///
- /// Export method
- ///
- /// html raw string
- ///
- ///
- public async Task PdfDataFromHtmlAsync(string html, IEnumerable? links = null, IEnumerable? scripts = null)
+ public async Task PdfDataFromHtmlAsync(string html, IEnumerable? links = null, IEnumerable? scripts = null, PdfOptions? options = null)
{
try
{
@@ -76,7 +64,7 @@ public async Task PdfDataFromHtmlAsync(string html, IEnumerable?
await AddStyleTagAsync(page, links);
await AddScriptTagAsync(page, scripts);
- return await page.PdfDataAsync();
+ return await page.PdfDataAsync(GetOptions(options));
}
catch (Exception ex)
{
@@ -85,13 +73,7 @@ public async Task PdfDataFromHtmlAsync(string html, IEnumerable?
}
}
- ///
- /// Export method
- ///
- /// html raw string
- ///
- ///
- public async Task PdfStreamFromHtmlAsync(string html, IEnumerable? links = null, IEnumerable? scripts = null)
+ public async Task PdfStreamFromHtmlAsync(string html, IEnumerable? links = null, IEnumerable? scripts = null, PdfOptions? options = null)
{
try
{
@@ -102,7 +84,7 @@ public async Task PdfStreamFromHtmlAsync(string html, IEnumerable PdfStreamFromHtmlAsync(string html, IEnumerable? links = null)
{
var styles = new List();
@@ -161,13 +151,16 @@ private async Task LaunchBrowserAsync()
private void Log(Exception? exception, string? message, params object?[] args)
{
- if (args.Length != 0)
- {
- logger.LogInformation(exception, "{Message} | Args: {Args}", message, args);
- }
- else
+ if (logger.IsEnabled(LogLevel.Information))
{
- logger.LogInformation(exception, "{Message}", message);
+ if (args.Length != 0)
+ {
+ logger.LogInformation(exception, "{Message} | Args: {Args}", message, args);
+ }
+ else
+ {
+ logger.LogInformation(exception, "{Message}", message);
+ }
}
}
}