How to keep filename when download: open enabled

How to keep filename when download: open enabled

nasimul007nasimul007 Posts: 3Questions: 1Answers: 0
edited February 2021 in Free community support

I added my code snippet here. when "download: 'open'" is enabled and i try to download the pdf, browser auto generates the filename, but i want to keep my custom filename. If "download: 'open'" is disabled "filename" works perfectly.

Thank you

{
       extend: 'pdf',
       download: 'open',
       filename: 'custom filename'
}

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Try using title, as in this example - that should do the trick,

    Colin

  • nasimul007nasimul007 Posts: 3Questions: 1Answers: 0
    edited February 2021

    title doesn't work when download: 'open' is enabled. Browser provides automated filename.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Try filename - this example here is keeping the name in that dialogue (see Excel - it's putting a time stamp on the file),

    Colin

  • nasimul007nasimul007 Posts: 3Questions: 1Answers: 0

    perfectly works for excel and csv but not for pdf. here, i attached the code used for pdf

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.