mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-11-29 18:49:08 +08:00
!3792 doc(#I6B872): update PdfReader demos
* doc(#I6B872): update PdfReader demos
This commit is contained in:
parent
5998f4626b
commit
db3b73c7c8
@ -17,7 +17,7 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<BootstrapInputGroup>
|
||||
<BootstrapInputGroupLabel @bind-Value="@Search" />
|
||||
<BootstrapInputGroupLabel @bind-Value="@Search" DisplayText="@Localizer["PdfReaderAdvancedSearchLabel"]" />
|
||||
<BootstrapInput @bind-Value="@Search" />
|
||||
<Button Icon="fa-solid fa-magnifying-glass" OnClick="ApplySearch"></Button>
|
||||
</BootstrapInputGroup>
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<BootstrapInputGroup>
|
||||
<BootstrapInputGroupLabel @bind-Value="@Filename" />
|
||||
<BootstrapInputGroupLabel @bind-Value="@Filename" DisplayText="@Localizer["PdfReaderAdvancedFilenameLabel"]" />
|
||||
<BootstrapInput @bind-Value="@Filename" />
|
||||
<Button Color="Color.Primary" OnClick="ApplySearch">@Localizer["PdfReaderAdvancedRefreshPage"]</Button>
|
||||
</BootstrapInputGroup>
|
||||
@ -34,12 +34,16 @@
|
||||
</div>
|
||||
<div class="row mb-3 form-inline">
|
||||
<div class="col-6 col-sm-4 col-md-3 col-lg-auto">
|
||||
<Switch @bind-Value="@StreamMode" ShowLabel="true" />
|
||||
<Switch @bind-Value="@StreamMode" ShowLabel="true" DisplayText="@Localizer["PdfReaderAdvancedStreamModeLabel"]"/>
|
||||
</div>
|
||||
<div class="col-6 col-sm-4 col-md-3 col-lg-auto">
|
||||
<Switch @bind-Value="@ReadOnly" ShowLabel="true" DisplayText="@Localizer["PdfReaderAdvancedReadOnlyLabel"]" ShowLabelTooltip="true" OnValueChanged="_=>ApplySearch()" />
|
||||
</div>
|
||||
<BootstrapInput @bind-Value="@Watermark" DisplayText="@Localizer["PdfReaderAdvancedWatermarkLabel"]" />
|
||||
</div>
|
||||
|
||||
<PdfReader @ref="PdfReader"
|
||||
Filename="@(StreamMode?FilenameStream:Filename)"
|
||||
FileName="@(StreamMode?FilenameStream:Filename)"
|
||||
StreamMode="StreamMode"
|
||||
Page=@Page
|
||||
Zoom=@Zoom
|
||||
@ -56,9 +60,15 @@
|
||||
[DisplayName("流模式")]
|
||||
private bool StreamMode { get; set; }
|
||||
|
||||
private EnumZoomMode Zoom { get; set; } = EnumZoomMode.Auto;
|
||||
[DisplayName("禁用复制/打印/下载")]
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
private EnumPageMode Pagemode { get; set; } = EnumPageMode.Thumbs;
|
||||
[DisplayName("水印内容")]
|
||||
public string Watermark { get; set; } = "www.blazor.zone";
|
||||
|
||||
private EnumZoomMode Zoom { get; set; } = EnumZoomMode.PageHeight;
|
||||
|
||||
private EnumPageMode Pagemode { get; set; } = EnumPageMode.None;
|
||||
|
||||
[DisplayName("文件相对路径或者URL")]
|
||||
private string Filename { get; set; } = "/samples/sample.pdf";
|
||||
@ -76,15 +86,17 @@
|
||||
{
|
||||
Zoom = Zoom switch
|
||||
{
|
||||
EnumZoomMode.Auto => EnumZoomMode.PageFit,
|
||||
EnumZoomMode.Auto => EnumZoomMode.PageActual,
|
||||
EnumZoomMode.PageActual => EnumZoomMode.PageFit,
|
||||
EnumZoomMode.PageFit => EnumZoomMode.PageWidth,
|
||||
EnumZoomMode.PageWidth => EnumZoomMode.PageHeight,
|
||||
EnumZoomMode.PageHeight => EnumZoomMode.Zoom75,
|
||||
EnumZoomMode.Zoom75 => EnumZoomMode.Zoom50,
|
||||
EnumZoomMode.Zoom50 => EnumZoomMode.Zoom25,
|
||||
EnumZoomMode.Zoom25 => EnumZoomMode.Zoom200,
|
||||
_ => EnumZoomMode.Auto
|
||||
};
|
||||
await PdfReader.Refresh();
|
||||
await Refresh();
|
||||
}
|
||||
|
||||
private async Task ApplyPagemode()
|
||||
@ -97,31 +109,34 @@
|
||||
EnumPageMode.Layers => EnumPageMode.None,
|
||||
_ => EnumPageMode.Thumbs
|
||||
};
|
||||
await PdfReader.Refresh(Search, Page, Pagemode, Zoom);
|
||||
await Refresh();
|
||||
}
|
||||
|
||||
async Task Refresh()
|
||||
{
|
||||
if (PdfReader != null)
|
||||
await PdfReader.Refresh(Search, Page, Pagemode, Zoom, ReadOnly, Watermark);
|
||||
}
|
||||
|
||||
private async Task ApplyPage()
|
||||
{
|
||||
Search = null;
|
||||
await PdfReader.Refresh(Search, Page, Pagemode, Zoom);
|
||||
await Refresh();
|
||||
}
|
||||
|
||||
private async Task ApplyPagePrevious()
|
||||
{
|
||||
Page--;
|
||||
Search = null;
|
||||
await PdfReader.Refresh(Search, Page, Pagemode, Zoom);
|
||||
await Refresh();
|
||||
}
|
||||
|
||||
private async Task ApplyPageNext()
|
||||
{
|
||||
Page++;
|
||||
Search = null;
|
||||
await PdfReader.Refresh(Search, Page, Pagemode, Zoom);
|
||||
await Refresh();
|
||||
}
|
||||
|
||||
private async Task ApplySearch()
|
||||
{
|
||||
await PdfReader.Refresh(Search, Page, Pagemode, Zoom);
|
||||
}
|
||||
private async Task ApplySearch() => await Refresh();
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
@using System.ComponentModel;
|
||||
@inject IStringLocalizer<PdfReaderCompatibilityMode> Localizer
|
||||
|
||||
<Tips>
|
||||
<div>@((MarkupString)Localizer["PdfReaderCompatibilityModeTips"].Value)</div>
|
||||
</Tips>
|
||||
|
||||
<h6>CompatibilityMode</h6>
|
||||
<PdfReader FileName=@FileName CompatibilityMode Height="300px" />
|
||||
|
||||
<h6>CompatibilityNoneES5</h6>
|
||||
<PdfReader FileName=@FileName CompatibilityNoneES5 Height="300px" />
|
||||
|
||||
@code {
|
||||
[DisplayName("the file in the wwwroot relative path or url")]
|
||||
private string FileName { get; set; } = "/samples/sample.pdf";
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
@using System.ComponentModel;
|
||||
|
||||
<PdfReader Filename=@Filename Height="500px" />
|
||||
<PdfReader FileName=@Filename Height="500px" />
|
||||
|
||||
@code {
|
||||
[DisplayName("the file in the wwwroot relative path or url")]
|
||||
|
@ -7,7 +7,7 @@
|
||||
</BootstrapInputGroup>
|
||||
</div>
|
||||
</div>
|
||||
<PdfReader @ref="PdfReader" Filename="@FilenameStream" StreamMode="true" Height="500px" />
|
||||
<PdfReader @ref="PdfReader" FileName="@FilenameStream" StreamMode="true" Height="500px" />
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
@ -5990,6 +5990,8 @@
|
||||
"PdfReaderNomalIntro": "Use Filename parameter displays pdf file from local server, or Stream parameter use file stream for rendering",
|
||||
"PdfReaderStreamModeText": "Stream mode",
|
||||
"PdfReaderStreamModeIntro": "read remote files by cross-domain",
|
||||
"PdfReaderCompatibilityModeText": "Compatibility mode",
|
||||
"PdfReaderCompatibilityModeIntro": "Compatible with older browsers",
|
||||
"PdfReaderAdvancedText": "Advanced parameters",
|
||||
"PdfReaderAdvancedIntro": "Can be use advanced parameters",
|
||||
"PdfReaderIssue": "Destructive update reference link: remove pdfoobject",
|
||||
@ -6023,7 +6025,12 @@
|
||||
"PdfReaderAdvancedRefreshPage": "RefreshPage",
|
||||
"PdfReaderAdvancedStreamModeLabel": "StreamMode",
|
||||
"PdfReaderAdvancedFilenameLabel": "The file in the wwwroot relative path or url",
|
||||
"PdfReaderAdvancedSearchLabel": "Search"
|
||||
"PdfReaderAdvancedSearchLabel": "Search",
|
||||
"PdfReaderAdvancedReadOnlyLabel": "Disable copy/print/download",
|
||||
"PdfReaderAdvancedWatermarkLabel": "Watermark content"
|
||||
},
|
||||
"BootstrapBlazor.Shared.Demos.PdfReader.PdfReaderCompatibilityMode": {
|
||||
"PdfReaderCompatibilityModeTips": "- Chrome < 97 automatically uses version 2.4.456<br/>- Chrome < 109 automatically uses version 2.6.347<br/>- Note: ReadOnly and Watermark cannot be used in these two compatibility modes"
|
||||
},
|
||||
"BootstrapBlazor.Shared.Samples.VideoPlayers": {
|
||||
"Title": "VideoPlayer",
|
||||
|
@ -6007,6 +6007,8 @@
|
||||
"PdfReaderNomalIntro": "Filename 参数显示本服务器pdf文件,或 Stream 参数指定用于渲染的文件流",
|
||||
"PdfReaderStreamModeText": "流模式",
|
||||
"PdfReaderStreamModeIntro": "可跨域读取文件",
|
||||
"PdfReaderCompatibilityModeText": "兼容模式",
|
||||
"PdfReaderCompatibilityModeIntro": "兼容旧版浏览器",
|
||||
"PdfReaderAdvancedText": "高级参数",
|
||||
"PdfReaderAdvancedIntro": "可以使用高级参数",
|
||||
"PdfReaderIssue": "破坏性更新参考链接: 移除pdfobject",
|
||||
@ -6040,8 +6042,14 @@
|
||||
"PdfReaderAdvancedRefreshPage": "刷新",
|
||||
"PdfReaderAdvancedStreamModeLabel": "流模式",
|
||||
"PdfReaderAdvancedFilenameLabel": "文件相对路径或者URL",
|
||||
"PdfReaderAdvancedSearchLabel": "搜索"
|
||||
"PdfReaderAdvancedSearchLabel": "搜索",
|
||||
"PdfReaderAdvancedReadOnlyLabel": "禁用复制/打印/下载",
|
||||
"PdfReaderAdvancedWatermarkLabel": "水印内容"
|
||||
},
|
||||
"BootstrapBlazor.Shared.Demos.PdfReader.PdfReaderCompatibilityMode": {
|
||||
"PdfReaderCompatibilityModeTips": "- Chrome < 97 自动使用 2.4.456 版本<br/>- Chrome < 109 自动使用 2.6.347 版本<br/>- 注:ReadOnly 和 Watermark 在这两种兼容模式下不能使用"
|
||||
},
|
||||
|
||||
"BootstrapBlazor.Shared.Samples.VideoPlayers": {
|
||||
"Title": "VideoPlayer 视频播放器",
|
||||
"BaseUsageText": "基础用法",
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
<DemoBlock Title="@Localizer["PdfReaderStreamModeText"]" Introduction="@Localizer["PdfReaderStreamModeIntro"]" Name="StreamMode" Demo="typeof(Demos.PdfReader.PdfReaderStreamMode)" />
|
||||
|
||||
<DemoBlock Title="@Localizer["PdfReaderCompatibilityModeText"]" Introduction="@Localizer["PdfReaderCompatibilityModeIntro"]" Name="CompatibilityMode" Demo="typeof(Demos.PdfReader.PdfReaderCompatibilityMode)" />
|
||||
|
||||
<DemoBlock Title="@Localizer["PdfReaderAdvancedText"]" Introduction="@Localizer["PdfReaderAdvancedIntro"]" Name="Advanced" Demo="typeof(Demos.PdfReader.PdfReaderAdvanced)" />
|
||||
|
||||
<AttributeTable Items="@GetAttributes()" />
|
||||
|
Loading…
Reference in New Issue
Block a user