Is there a way to set the download file name dynamically on the pdf viewer component?
When i call the Load () function the "downloadfilename" in the component turns null. I tried many ways and the result its the same.
How can i force the "downloadfilename" to be setted?
Index:
<button @onclick="ShowAndLoadPdfViewer" style="margin:100px">SHOW PDF VIEWER</button>
<PdfVisorComponent @ref="PDFViewer"></PdfVisorComponent>
@code
{
PdfVisorComponent PDFViewer = new PdfVisorComponent();
public async Task ShowAndLoadPdfViewer()
{
await PDFViewer.LoadPdfViewerAsync();
}
}
Blazor Component (PdfVisorComponent):
SfDialog ID="PdfModal" @ref="PdfModal" AllowDragging="true"
Visible="false" Target="Grid" Height="770px" Width="1140px"
ShowCloseIcon="true" CssClass="e-dlg-header-viewer">
<DialogTemplates>
<Header></Header>
<Content>
<SfPdfViewerServer @ref="@PDFViewer"
DocumentPath="@DocumentPath"
DownloadFileName="@DownloadName"
Height="500px"
Width="1060px">
</SfPdfViewerServer>
</Content>
</DialogTemplates>
</SfDialog>
@code
{
private SfDialog PdfModal = new SfDialog();
private SfPdfViewerServer PDFViewer = new SfPdfViewerServer();
public string DocumentPath { get; set; }
public string DownloadName { get; set; }
public async Task LoadPdfViewerAsync()
{
DocumentPath = "wwwroot/data/test.pdf";
DownloadName = "NameTestdinamic.pdf";
await PDFViewer.LoadAsync("wwwroot/data/test.pdf", null);
await PdfModal.ShowAsync();
}
}
Attachment: TestApp_d7d9bf16.rar
|
public async Task LoadPdfViewerAsync()
{
PDFViewer.DownloadFileName = "NameTestdinamic.pdf";
await PDFViewer.LoadAsync("wwwroot/data/test.pdf", null);
await PdfModal.ShowAsync();
}
|
Hi, thanks for the reply.
I upgraded to the version
19.2.0.57 and tried the code but still not loading the
downloadfile name (I tried in the sample atached) . Can you
please atach a sample working?
Thanks again