BootstrapBlazor.SignaturePad
, which needs to reference its component package when using this component",
+ "P2": "This component relies on BootstrapBlazor.Bluetooth
, which needs to reference its component package when using this component",
"P3": "Nuget package installation",
- "P4": "Install the components of BootstrapBlazor.SignaturePad using nuget.org",
+ "P4": "Install the
components of BootstrapBlazor.Bluetooth using nuget.org",
"Tips": "ServiceUUID, Default 0xff00
Common Printers ServiceUUID:
0000ff00-0000-1000-8000-00805f9b34fb
e7810a71-73ae-499d-8c15-faa9aef0c3f2
0000fee7-0000-1000-8000-00805f9b34fb
Set up component services UUID : printer.Opt.ServiceUuid=?
"
},
- "BootstrapBlazor.Shared.Samples.FileIcons": {
+ "BootstrapBlazor.Shared.Samples.FileIcons": {
"Title": "File Icon",
"Intro": "The icon show the file extension",
"BaseUsageTitle": "Base Usage",
@@ -5369,5 +5371,20 @@
"ExtensionAttr": "The extension of file",
"IconColorAttr": "The backgound color for badge of extension",
"BackgroundTemplateAttr": "The template for custom the backgroup file"
+ },
+ "BootstrapBlazor.Shared.Samples.PdfReaders": {
+ "Title": "PDF Reader",
+ "BaseUsageText": "Basic usage",
+ "BaseUsageIntro": "Use PdfFile parameter displays pdf file from local server, or PdfStream parameter use file stream for rendering",
+ "Tips": "Embedded mode is preferred, if not supported, fall back to Pdf.js mode",
+ "BaseUsageText2": "Using streaming mode,can be read remote files by cross-domain",
+ "BaseUsageIntro2": " ",
+ "Tips2": "Cross-domain best experience: EnableStreamingMode=true , ForcePDFJS=true",
+ "BaseUsageText3": "Force use Pdf.js browser.",
+ "BaseUsageIntro3": "Can be use advanced parameters",
+ "P1": "Precautions",
+ "P2": "This component relies on BootstrapBlazor.PdfReader
, which needs to reference its component package when using this component",
+ "P3": "Nuget package installation",
+ "P4": "Install the
components of BootstrapBlazor.PdfReader using nuget.org"
}
}
diff --git a/src/BootstrapBlazor.Shared/Locales/zh.json b/src/BootstrapBlazor.Shared/Locales/zh.json
index cc46502eb63503ab41c5debad0d3c4bce9a5e436..cf2bd3f02215f60ebec11d3a23c7181f34f0976c 100644
--- a/src/BootstrapBlazor.Shared/Locales/zh.json
+++ b/src/BootstrapBlazor.Shared/Locales/zh.json
@@ -1560,7 +1560,8 @@
"NotificationsText": "浏览器通知 Notification",
"OnScreenKeyboardText": "屏幕键盘 OnScreenKeyboard",
"SignaturePadText": "手写签名 SignaturePad",
- "BluetoothText": "蓝牙和打印 Bluetooth & Printer"
+ "BluetoothText": "蓝牙和打印 Bluetooth & Printer",
+ "PdfReaderText": "PDF阅读器 PDF Reader"
},
"BootstrapBlazor.Shared.Pages.Breakpoints": {
"Heading": "断点",
@@ -4369,7 +4370,8 @@
"OnScreenKeyboard": "屏幕键盘 OnScreenKeyboard",
"RibbonTab": "选项卡菜单 RibbonTab",
"PulseButton": "心跳按钮 PulseButton",
- "Bluetooth": "蓝牙和打印 Bluetooth & Printer"
+ "Bluetooth": "蓝牙和打印 Bluetooth & Printer",
+ "PdfReader": "PDF阅读器 PDF Reader"
},
"BootstrapBlazor.Shared.Samples.Table.TablesHeader": {
"H1": "表头分组功能",
@@ -5360,7 +5362,7 @@
"P4": "使用 nuget.org 进行 BootstrapBlazor.Bluetooth
组件的安装",
"Tips": "服务UUID/ServiceUUID, 默认0xff00
常见打印机ServiceUUID:
0000ff00-0000-1000-8000-00805f9b34fb
e7810a71-73ae-499d-8c15-faa9aef0c3f2
0000fee7-0000-1000-8000-00805f9b34fb
设置组件服务UUID : printer.Opt.ServiceUuid=?
"
},
- "BootstrapBlazor.Shared.Samples.FileIcons": {
+ "BootstrapBlazor.Shared.Samples.FileIcons": {
"Title": "File Icon 文件图标",
"Intro": "通过文件扩展名自定义显示图标",
"BaseUsageTitle": "基本用法",
@@ -5374,5 +5376,20 @@
"ExtensionAttr": "文件扩展名",
"IconColorAttr": "扩展名标签背景色",
"BackgroundTemplateAttr": "自定义背景图模板"
+ },
+ "BootstrapBlazor.Shared.Samples.PdfReaders": {
+ "Title": "PDF Reader PDF阅读器",
+ "BaseUsageText": "基础用法",
+ "BaseUsageIntro": "PdfFile 参数显示本服务器pdf文件,或 PdfStream 参数指定用于渲染的文件流",
+ "Tips": "优先嵌入模式,不支持则回落倒Pdf.js模式",
+ "BaseUsageText2": "使用流化模式,可跨域读取文件",
+ "BaseUsageIntro2": " ",
+ "Tips2": "跨域最佳体验: EnableStreamingMode=true , ForcePDFJS=true",
+ "BaseUsageText3": "强制使用Pdf.js浏览器.",
+ "BaseUsageIntro3": "可用高级参数定义默认行为",
+ "P1": "注意事项",
+ "P2": "本组件依赖于 BootstrapBlazor.PdfReader
,使用本组件时需要引用其组件包",
+ "P3": "Nuget 包安装",
+ "P4": "使用 nuget.org 进行 BootstrapBlazor.PdfReader
组件的安装"
}
}
diff --git a/src/BootstrapBlazor.Shared/Pages/Coms.razor b/src/BootstrapBlazor.Shared/Pages/Coms.razor
index 1421b1dee3570dfc5a5b47c3941c93469215f153..19bdf3fbe299b95e1e10fe6fb1a6d8f49e8288e2 100644
--- a/src/BootstrapBlazor.Shared/Pages/Coms.razor
+++ b/src/BootstrapBlazor.Shared/Pages/Coms.razor
@@ -97,6 +97,7 @@
+
diff --git a/src/BootstrapBlazor.Shared/Samples/PdfReaders.razor b/src/BootstrapBlazor.Shared/Samples/PdfReaders.razor
new file mode 100644
index 0000000000000000000000000000000000000000..2382e10a22c51cb019b3a11803ddabeba6ed7c9a
--- /dev/null
+++ b/src/BootstrapBlazor.Shared/Samples/PdfReaders.razor
@@ -0,0 +1,74 @@
+@page "/PdfReaders"
+@namespace BootstrapBlazor.Shared.Samples
+@inject IStringLocalizer Localizer
+
+@Localizer["Title"]
+
+@Localizer["P1"] :
+
+@((MarkupString)Localizer["P2"].Value)
+
+@Localizer["P3"]
+
+@((MarkupString)Localizer["P4"].Value)
+
+.NET CLI
+dotnet add package BootstrapBlazor.PdfReader
+
+PackageReference
+<PackageReference Include="BootstrapBlazor.PdfReader" />
+
+Package Manager
+Install-Package BootstrapBlazor.PdfReader
+
+
+ @((MarkupString)Localizer["Tips"].Value)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @((MarkupString)Localizer["Tips2"].Value)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BootstrapBlazor.Shared/Samples/PdfReaders.razor.cs b/src/BootstrapBlazor.Shared/Samples/PdfReaders.razor.cs
new file mode 100644
index 0000000000000000000000000000000000000000..63a5ad7ea4f2276e2caadbbceef2486aa3b2bd34
--- /dev/null
+++ b/src/BootstrapBlazor.Shared/Samples/PdfReaders.razor.cs
@@ -0,0 +1,143 @@
+// Copyright (c) Argo Zhang (argo@163.com). 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/
+
+using BootstrapBlazor.Components;
+using BootstrapBlazor.Shared.Common;
+
+namespace BootstrapBlazor.Shared.Samples;
+
+///
+///
+///
+public partial class PdfReaders
+{
+ PdfReader? pdfReader;
+ PdfReader? pdfReader2;
+
+ private string Search { get; set; } = "Performance";
+ private int Page { get; set; } = 3;
+ private bool ForcePDFJS { get; set; } = true;
+
+ private string PdfFile = "/_content/BootstrapBlazor.Shared/sample.pdf";
+ private string UrlBaseStream = "https://blazor.app1.es/_content/DemoShared/";
+ private string PdfFileStream = "sample.pdf";
+
+
+ private async Task Apply()
+ {
+ await pdfReader!.Refresh();
+ }
+ private async Task Apply5()
+ {
+ await pdfReader2!.Refresh();
+ }
+
+ ///
+ /// 获得属性方法
+ ///
+ ///
+ protected IEnumerable GetAttributes() => new AttributeItem[]
+ {
+ // TODO: 移动到数据库中
+ new AttributeItem() {
+ Name = "PdfStream",
+ Description = "用于渲染的文件流,为空则用URL参数读取文件",
+ Type = "Stream?",
+ ValueList = "-",
+ DefaultValue = "-"
+ },
+ new AttributeItem() {
+ Name = "PdfFile",
+ Description = "PDF文件路径(Url或相对路径)",
+ Type = "string?",
+ ValueList = "-",
+ DefaultValue = "-"
+ },
+ new AttributeItem() {
+ Name = "OnInfo",
+ Description = "信息回调",
+ Type = "Func??",
+ ValueList = "-",
+ DefaultValue = "-"
+ },
+ new AttributeItem() {
+ Name = "OnError",
+ Description = "错误回调",
+ Type = "Func??",
+ ValueList = "-",
+ DefaultValue = "-"
+ },
+ new AttributeItem() {
+ Name = "EnableStreamingMode",
+ Description = "使用流化模式,可跨域读取文件",
+ Type = "bool",
+ ValueList = "-",
+ DefaultValue = "false"
+ },
+ new AttributeItem() {
+ Name = "UrlBase",
+ Description = "PDF文件基础路径, (使用流化模式才需要设置)",
+ Type = "string?",
+ ValueList = "-",
+ DefaultValue = "-"
+ },
+ new AttributeItem() {
+ Name = "Height",
+ Description = "高度",
+ Type = "int?",
+ ValueList = "-",
+ DefaultValue = "700"
+ },
+ new AttributeItem() {
+ Name = "ForceIframe",
+ Description = "强制使用 Iframe",
+ Type = "bool",
+ ValueList = "-",
+ DefaultValue = "false"
+ },
+ new AttributeItem() {
+ Name = "ForcePDFJS",
+ Description = "强制使用 PDF.js",
+ Type = "bool",
+ ValueList = "-",
+ DefaultValue = "false"
+ },
+ new AttributeItem() {
+ Name = "PDFJS_URL",
+ Description = "PDF.js 浏览器页面路径",
+ Type = "string",
+ ValueList = "-",
+ DefaultValue = "内置"
+ },
+ new AttributeItem() {
+ Name = "Page",
+ Description = "指定页码,如果浏览器支持,将加载PDF并自动滚动到第n页 (PDF.js 专有)",
+ Type = "int",
+ ValueList = "-",
+ DefaultValue = "1"
+ },
+ new AttributeItem() {
+ Name = "Search",
+ Description = "查询字符串 (PDF.js 专有)",
+ Type = "string?",
+ ValueList = "-",
+ DefaultValue = "-"
+ },
+ new AttributeItem() {
+ Name = "View",
+ Description = "视图模式 (PDF.js 专有)",
+ Type = "string?",
+ ValueList = "-",
+ DefaultValue = "FitV"
+ },
+ new AttributeItem() {
+ Name = "Pagemode",
+ Description = "页面模式 (PDF.js 专有)",
+ Type = "string?",
+ ValueList = "-",
+ DefaultValue = "thumbs"
+ },
+ };
+
+}
diff --git a/src/BootstrapBlazor.Shared/docs.json b/src/BootstrapBlazor.Shared/docs.json
index 65218e13793e96add4402ddbd9ca73262875d922..90222d17a1a28ffe9b0c261fb7a921aeb947778e 100644
--- a/src/BootstrapBlazor.Shared/docs.json
+++ b/src/BootstrapBlazor.Shared/docs.json
@@ -76,7 +76,8 @@
"pulsebuttons": "PulseButtons",
"select-trees": "SelectTrees",
"bluetooths": "Bluetooths",
- "ribbontabs": "RibbonTabs"
+ "ribbontabs": "RibbonTabs",
+ "pdfreaders": "PdfReaders"
},
"video": {
"autorefresh": "BV1ap4y1x7Qn?p=8",
diff --git a/src/BootstrapBlazor.Shared/wwwroot/images/PdfReader.jpg b/src/BootstrapBlazor.Shared/wwwroot/images/PdfReader.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..61e3c2b303205336ac9026510ef3b0fe79fa1bb1
Binary files /dev/null and b/src/BootstrapBlazor.Shared/wwwroot/images/PdfReader.jpg differ
diff --git a/src/BootstrapBlazor.Shared/wwwroot/sample.pdf b/src/BootstrapBlazor.Shared/wwwroot/sample.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..02fa4ea0fffb40a1c7300ce14820775f6386cd8d
Binary files /dev/null and b/src/BootstrapBlazor.Shared/wwwroot/sample.pdf differ