Pdfmake: [REQUEST] Change filename of downloadable PDF

Created on 18 Oct 2014  路  6Comments  路  Source: bpampuch/pdfmake

Hi!

I've looked through the docs and simply can't seem to find a configuration option/parameter, where I can state the filename of the pdf-file that is being generated. I simply want to dynamically change .pdf

I guess this might not be possible as the filename is hardcoded as far as I can see:

d.prototype.download=function(a){a=a||"file.pdf" and so on.

Thanks in advance,

Chris

Most helpful comment

is it possible to give a custom default name to the pdf while the user opens the document in a new tab with the
pdfMake.createPdf(docDefinition).open() method and then uses the save as option?

All 6 comments

it's not hardcoded, as you can see the download function takes a parameter with the file name

so you can call download('myFileName.pdf') as described in Getting Started :)

I hope this helps

Hi bpampuch!

I don't know how I could've missed that, thanks! closing this one.

is it possible to give a custom default name to the pdf while the user opens the document in a new tab with the
pdfMake.createPdf(docDefinition).open() method and then uses the save as option?

@erdemlal Yes. I hope it. now it is random Hexadecimal name.

@bpampuch is it impossible?

I thought I should do like .open('hoge.pdf');

but error...

TypeError: Cannot create property 'autoPrint' on string 'hoge.pdf'
.open({defaultFileName: 'hoge.pdf'});

it didn't error but not changed file name

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kumarandena picture kumarandena  路  3Comments

jkd003 picture jkd003  路  3Comments

dgrice picture dgrice  路  3Comments

dmatesic picture dmatesic  路  3Comments

svenyonson picture svenyonson  路  3Comments