!3631 doc(#I66LXV): update document for PdfReaders

* update document for PdfReaders
This commit is contained in:
alex_zou 2022-12-18 15:26:44 +00:00 committed by Argo
parent 35b7b07a1d
commit 4673664969
4 changed files with 59 additions and 77 deletions

View File

@ -5388,12 +5388,10 @@
"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.",
"BaseUsageIntro": "Use Filename parameter displays pdf file from local server, or Stream parameter use file stream for rendering",
"BaseUsageText2": "Stream mode",
"BaseUsageIntro2": "read remote files by cross-domain",
"BaseUsageText3": "Advanced parameters",
"BaseUsageIntro3": "Can be use advanced parameters",
"P1": "Precautions",
"P2": "This component relies on <a href='https://www.nuget.org/packages?q=BootstrapBlazor.PdfReader' target='_blank'><code>BootstrapBlazor.PdfReader</code></a>, which needs to reference its component package when using this component",

View File

@ -5393,13 +5393,11 @@
"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": "可用高级参数定义默认行为",
"BaseUsageIntro": "Filename 参数显示本服务器pdf文件,或 Stream 参数指定用于渲染的文件流",
"BaseUsageText2": "流模式",
"BaseUsageIntro2": "可跨域读取文件",
"BaseUsageText3": "高级参数",
"BaseUsageIntro3": " ",
"P1": "注意事项",
"P2": "本组件依赖于 <a href='https://www.nuget.org/packages?q=BootstrapBlazor.PdfReader' target='_blank'><code>BootstrapBlazor.PdfReader</code></a>,使用本组件时需要引用其组件包",
"P3": "Nuget 包安装",

View File

@ -21,12 +21,8 @@
<div class="code-label">Package Manager</div>
<Pre class="no-highlight">Install-Package BootstrapBlazor.PdfReader</Pre>
<Tips>
<p>@((MarkupString)Localizer["Tips"].Value)</p>
</Tips>
<DemoBlock Title="@Localizer["BaseUsageText"]" Introduction="@Localizer["BaseUsageIntro"]" Name="Nomal">
<PdfReader PdfFile=@PdfFile Height=500/>
<PdfReader Filename=@Filename Height="500px"/>
</DemoBlock>
<DemoBlock Title="@Localizer["BaseUsageText2"]" Introduction="@Localizer["BaseUsageIntro2"]" Name="Nomal">
@ -35,16 +31,12 @@
<div class="col-12">
<BootstrapInputGroup>
<BootstrapInput @bind-Value="@UrlBaseStream" />
<BootstrapInput @bind-Value="@PdfFileStream" />
<BootstrapInput @bind-Value="@FilenameStream" />
<Button Color="Color.Primary" OnClick="Apply">Go!</Button>
</BootstrapInputGroup>
</div>
</div>
<PdfReader @ref="pdfReader" UrlBase="@UrlBaseStream" PdfFile="@PdfFileStream" EnableStreamingMode="true" Height=500/>
<br/>
<Tips>
<p>@((MarkupString)Localizer["Tips2"].Value)</p>
</Tips>
<PdfReader @ref="pdfReader" UrlBase="@UrlBaseStream" Filename="@FilenameStream" StreamMode="true" Height="500px"/>
</DemoBlock>
<DemoBlock Title="@Localizer["BaseUsageText3"]" Introduction="@Localizer["BaseUsageIntro3"]" Name="Nomal">
@ -57,18 +49,19 @@
</div>
<div class="col-7">
<BootstrapInputGroup>
<BootstrapInput @bind-Value="@PdfFile" DisplayText="PDF" ShowLabel="true" />
<BootstrapInput @bind-Value="@Filename" DisplayText="PDF" ShowLabel="true" />
<Checkbox @bind-Value="ForcePDFJS" DisplayText="PDF.js" ShowAfterLabel="true" />
<Button Color="Color.Primary" OnClick="Apply5">GO</Button>
</BootstrapInputGroup>
</div>
</div>
<PdfReader @ref="pdfReader2"
PdfFile="@PdfFile"
ForcePDFJS=@ForcePDFJS
Filename="@Filename"
Page=@Page
Search=@Search
Height=500 />
Height="500px" />
</DemoBlock>
<AttributeTable Items="@GetAttributes()" />
<a href="https://gitee.com/LongbowEnterprise/BootstrapBlazor/issues/I66LXV">破坏性更新参考链接: 移除pdfobject</a>

View File

@ -19,9 +19,9 @@ public partial class PdfReaders
private int Page { get; set; } = 3;
private bool ForcePDFJS { get; set; } = true;
private string PdfFile = "/_content/BootstrapBlazor.Shared/sample.pdf";
private string Filename = "/_content/BootstrapBlazor.Shared/sample.pdf";
private string UrlBaseStream = "https://blazor.app1.es/_content/DemoShared/";
private string PdfFileStream = "sample.pdf";
private string FilenameStream = "sample.pdf";
private async Task Apply()
@ -41,35 +41,21 @@ public partial class PdfReaders
{
// TODO: 移动到数据库中
new AttributeItem() {
Name = "PdfStream",
Name = "Stream",
Description = "用于渲染的文件流,为空则用URL参数读取文件",
Type = "Stream?",
ValueList = "-",
DefaultValue = "-"
},
new AttributeItem() {
Name = "PdfFile",
Name = "Filename",
Description = "PDF文件路径(Url或相对路径)",
Type = "string?",
ValueList = "-",
DefaultValue = "-"
},
new AttributeItem() {
Name = "OnInfo",
Description = "信息回调",
Type = "Func<string, Task>??",
ValueList = "-",
DefaultValue = "-"
},
new AttributeItem() {
Name = "OnError",
Description = "错误回调",
Type = "Func<string, Task>??",
ValueList = "-",
DefaultValue = "-"
},
new AttributeItem() {
Name = "EnableStreamingMode",
Name = "StreamMode",
Description = "使用流化模式,可跨域读取文件",
Type = "bool",
ValueList = "-",
@ -84,60 +70,67 @@ public partial class PdfReaders
},
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 浏览器页面路径",
Description = "宽 单位(px/%)",
Type = "string",
ValueList = "-",
DefaultValue = "内置"
DefaultValue = "100%"
},
new AttributeItem() {
Name = "Height",
Description = "高 单位(px/%)",
Type = "string",
ValueList = "-",
DefaultValue = "700px"
},
new AttributeItem() {
Name = "Page",
Description = "指定页码,如果浏览器支持将加载PDF并自动滚动到第n页 (PDF.js 专有)",
Description = "页码",
Type = "int",
ValueList = "-",
DefaultValue = "1"
},
new AttributeItem() {
Name = "Search",
Description = "查询字符串 (PDF.js 专有)",
Type = "string?",
Name = "Page",
Description = "显示工具栏",
Type = "int",
ValueList = "-",
DefaultValue = "-"
DefaultValue = "1"
},
new AttributeItem() {
Name = "Statusbar",
Description = "显示状态栏",
Type = "int",
ValueList = "-",
DefaultValue = "1"
},
new AttributeItem() {
Name = "View",
Description = "视图模式 (PDF.js 专有)",
Description = "视图模式",
Type = "string?",
ValueList = "-",
DefaultValue = "FitV"
},
new AttributeItem() {
Name = "Pagemode",
Description = "页面模式 (PDF.js 专有)",
Description = "页面模式",
Type = "string?",
ValueList = "-",
DefaultValue = "thumbs"
},
new AttributeItem() {
Name = "Search",
Description = "查询字符串",
Type = "string?",
ValueList = "-",
DefaultValue = "-"
},
new AttributeItem() {
Name = "ViewerBase",
Description = "浏览器页面路径",
Type = "string",
ValueList = "-",
DefaultValue = "内置"
},
};
}