PDF generated name
Closed this issue ยท 4 comments
Hello !
First of all, thanks for your app, I use it on my domotic server to automaticly generate my attestation every time I leave ๐
I checked the code, and saw there was a function name pdfName which is supposed to named the PDF based on name, lastName & time of generation.
However, every time I want to save the PDF on my phone (or computer), the name generated is get.pdf
Is it because your app on Heroku is not up-to-date ?
Hey!
Thanks for you message, your use case is so fun I haven't even though that would be possible :)
I've noticed that too, its not because of the version hosted on Heroku, its because of this line. The returned object is described here: send, type. Here is the problematic part of the code:
async function downloadPDF(profile, reasons){
const pdf = await certificatePDF(profile, reasons)
return type('application/pdf').send(new Buffer(pdf));
}
I looked for a solution but that's the very first time I use this library so I'm not too sure what's the best option. I think it's based on express.js so maybe the answer is not within the library itself.
The name simply comes from the URL route /get?
, so if I change the URL route that would allow to rename the output, but it would still be a static name. I would like to use the pdfName
function to rename the PDF dynamically.
If you wonder why 'datesortie'
and 'heuresortie'
are in french where all other identifiers are in english, well, I have no idea.
It should be working now, let me know if it seems fine to you ;).
So it was about a header to send :)
That's great for me, thank you ๐
Yes apparently, I would never have guessed. I learned something today ๐.