Pdfmake: When saving the PDF how to set the name

Created on 9 Mar 2018  路  7Comments  路  Source: bpampuch/pdfmake

Good Morning,Afternoon,Night depending your local time

The title might be confusing but i'm actually looking a way about how to name the PDF, like we do with:

var PDF = pdfMake.createPdf({
pageMargins: [8.5, 8.5, 8.5, 8.5],
content: Content
}).download('Test.pdf');

but now using:

 .open( [Name Here] )

i did use:

pdfMake.createPdf({
                info: {
                         title: 'awesome Document',
                         },
                         pageMargins: [8.5, 8.5, 8.5, 8.5],
                         content: Content
                    }).open();

but when downloading the file it gets a random name with numbers and letters I read # 501 and saw that it got tagged with Feature Request, Did the update realized?

Any help,tip,guidance will be appreciated

Thanks

All 7 comments

This is not supported by browsers. Only title can be used (see https://github.com/bpampuch/pdfmake/issues/501#issuecomment-292787563).

Yes,but the title that got from:

title

can be used for the downloaded document?

Yes, it can be used. title will be used in pdf viewer for display document title (how exactly, depends on viewer).

but when i download the PDF it creates a random name for Save, looks like a base64 kind of, with random numbers and letters

This is a "feature" of browsers while using open. For nice file name you must use download method.

info: {
  title: 'awesome Document',
},

it just pdf left-up name...

2019-01-24 18 23 41

it should use Content-Disposition
Content-Disposition: attachment; filename="myfilename.pdf"

@RicMBM finally did you give up?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dgrice picture dgrice  路  3Comments

kamilkp picture kamilkp  路  3Comments

jokris1 picture jokris1  路  3Comments

ValeSauer picture ValeSauer  路  3Comments

Christian24 picture Christian24  路  3Comments