This is a migrated thread and some comments may be shown as answers.

Default File Name

2 Answers 648 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 31 Jul 2019, 12:52 PM

When downloading the pdf from the viewer, the file name is showing as Document.pdf.   Is there anyway to customize that?

Thanks

Peter

 

                @(Html.Kendo().PDFViewer()
                            .Name("pdfviewer")
                            .PdfjsProcessing(config => config.File(file => file.Data(Model.PdfInformation.PDFBase64)))
                            .Height(1200)
                )

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 01 Aug 2019, 06:41 AM
Hello Peter,

Yes, this is provided built-in. You can use the following property to achieve that:
https://docs.telerik.com/kendo-ui/api/javascript/ui/pdfviewer/configuration/messages.defaultfilename

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik

Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
commented on 03 Sep 2021, 02:04 PM

when you set this propery using setOptions 

https://dojo.telerik.com/utOdediD/18

search stops working

any ideas?

 

Neli
Telerik team
commented on 07 Sep 2021, 09:00 AM

Hi Aleksandr,

It is recommended to use the setOptions method in PDFViewer to "update the dimensions of the widget, the active page or the processor".

- https://docs.telerik.com/kendo-ui/api/javascript/ui/pdfviewer/methods/setoptions

You could either configure the defaultFileName initially or you could destroy and recreate the PDFViewer widget using the needed configuration. Here is a Dojo example where this is demonstrated. 

I hope you will find the provided suggestion helpful.

Regards,

Neli

Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
commented on 07 Sep 2021, 10:29 AM

any chances to have the filename changed in a more friendly way?
Neli
Telerik team
commented on 08 Sep 2021, 09:05 AM

Hi Aleksandr,

In case the defaultFileName is set on initialization of the PDFViewer there should be no issue and the PDFViewer functionalities should work as expected. However, setOptions as mentioned earlier is not suitable for changing all the configuration options of the widget. I am afraid it is not suitable for DefaultFileName as well and in case you need to change the DefaultFileName after initialization of the widget, you will need to use the approach described above. 

Regards,

Neli

0
Peter
Top achievements
Rank 1
answered on 01 Aug 2019, 11:55 AM
Thanks, that works great.
Tags
PDFViewer
Asked by
Peter
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Peter
Top achievements
Rank 1
Share this question
or