using WebSite.Data;
namespace WebSite.Docus.View.PdfViews;
class PdfView1 : BaseComponent
{
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
var stream = FileService.GetPdfStream();
builder.Component<PdfView>("pdfView")
.Set(c => c.Style, "demo-pdf")
.Set(c => c.Stream, stream)
.Build();
}
}
using WebSite.Data;
namespace WebSite.Docus.View.PdfViews;
class PdfView2 : BaseComponent
{
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.Button("显示PDF", Callback(OnShowPDF), StyleType.Primary);
}
private void OnShowPDF()
{
var stream = FileService.GetPdfStream();
UI.ShowPdf("查看PDF", 600, 400, stream);
}
}