We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How can I specify programmatically the download file name?

Hi,

How can I specify programmatically the download file name?

Now when I download a file the name is "undefined.pdf", I have searched the tutorial but I can't find the solution.

Thank you very much!



3 Replies 1 reply marked as answer

VV Visvesvar Venkatesan Syncfusion Team October 20, 2022 06:51 AM

Hi Pere,


We can assign the file name to downloading file name using the downloadFileName property.


Api link - https://ej2.syncfusion.com/angular/documentation/api/pdfviewer#downloadfilename


Kindly find the sample and code snippet below.


Sample - https://stackblitz.com/edit/nmquat?file=index.html,index.js


Code Snippet: 

viewer.downloadStart = function (args) {
  console.log(args);
  viewer.properties.downloadFileName = 'Great';
};


Kindly let us know if you have any concerns.


Regards,

Visvesvar K V 


Marked as answer

PA Pere Argelich Romà replied to Visvesvar Venkatesan October 20, 2022 08:58 AM

Hi Visvesvar,

Perfect! now works fine!

Thank you very much!



VV Visvesvar Venkatesan Syncfusion Team October 21, 2022 02:04 AM

Hi Pere,


Thank you for your update.



Regards,

Visvesvar K V 


Loader.
Live Chat Icon For mobile
Up arrow icon