File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed
src/BootstrapBlazor.Server Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 6262 <PackageReference Include =" BootstrapBlazor.OfficeViewer" Version =" 10.0.0" />
6363 <PackageReference Include =" BootstrapBlazor.OnScreenKeyboard" Version =" 10.0.0" />
6464 <PackageReference Include =" BootstrapBlazor.OpcDa" Version =" 10.0.0" />
65- <PackageReference Include =" BootstrapBlazor.PdfReader" Version =" 10.0.1-beta05 " />
65+ <PackageReference Include =" BootstrapBlazor.PdfReader" Version =" 10.0.1-beta06 " />
6666 <PackageReference Include =" BootstrapBlazor.PdfViewer" Version =" 10.0.0" />
6767 <PackageReference Include =" BootstrapBlazor.Player" Version =" 10.0.1" />
6868 <PackageReference Include =" BootstrapBlazor.RDKit" Version =" 10.0.0" />
Original file line number Diff line number Diff line change 1010 <section ignore class =" row form-inline g3" >
1111 <div class =" col-12 col-sm-6" >
1212 <BootstrapInputGroup >
13- <BootstrapInputGroupLabel >ShowTwoPagesOnView </BootstrapInputGroupLabel >
14- <Switch @bind-Value =" _options.ShowTwoPagesOnViewButton " ></Switch >
13+ <BootstrapInputGroupLabel >ShowTwoPagesOneView </BootstrapInputGroupLabel >
14+ <Switch @bind-Value =" _showTwoPagesOneViewButton " ></Switch >
1515 </BootstrapInputGroup >
1616 </div >
1717 </section >
18- <PdfReader Options = " _options " ></PdfReader >
18+ <PdfReader Url = " @_url " ShowTwoPagesOneViewButton = " _showTwoPagesOneViewButton " ViewHeight = " 600px " OnDownloadAsync = " OnDownloadAsync " ></PdfReader >
1919</DemoBlock >
Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ namespace BootstrapBlazor.Server.Components.Samples;
1212/// </summary>
1313public partial class PdfReaders
1414{
15+ [ Inject , NotNull ]
16+ private IWebHostEnvironment ? WebHostEnvironment { get ; set ; }
17+
18+ [ Inject , NotNull ]
19+ private DownloadService ? DownloadService { get ; set ; }
20+
1521 [ DisplayName ( "the file in the wwwroot relative path or url" ) ]
1622 private string FileName { get ; set ; } = "/samples/sample.pdf" ;
1723
@@ -21,11 +27,14 @@ public partial class PdfReaders
2127 [ NotNull ]
2228 PdfReader ? PdfReader { get ; set ; }
2329
24- private PdfReaderOptions _options = new ( )
30+ private bool _showTwoPagesOneViewButton = true ;
31+ private string _url = "./samples/sample.pdf" ;
32+
33+ private async Task OnDownloadAsync ( )
2534 {
26- Url = "./ samples/ sample.pdf",
27- ViewHeight = "600px"
28- } ;
35+ var file = Path . Combine ( WebHostEnvironment . WebRootPath , " samples" , " sample.pdf") ;
36+ await DownloadService . DownloadFromFileAsync ( $ "sample_ { DateTime . Now : yyyyMMddHHmmss } .pdf" , file ) ;
37+ }
2938
3039 private string FilenameStream { get ; set ; } = "https://blazor.app1.es/_content/DemoShared/samples/sample2.pdf" ;
3140
You can’t perform that action at this time.
0 commit comments