alvarcarto / url-to-pdf-api

Web page PDF/PNG rendering done right. Self-hosted service for rendering receipts, invoices, or any content.
MIT License
7.01k stars 774 forks source link

PDF name is always "render" can we change it? #152

Open Valnexus opened 3 years ago

Valnexus commented 3 years ago

Hi, I have everything set up and all works great, but the files are always called "render" and when you want to save the file name is "render" too, how can I change the file name? And I don't mean "attachmentName" I am talking about the pdf file name that is open in a new tab, I want it to say "David's CV File", but they are all "render" is there a parameter to change that?

cdwiegand commented 3 years ago

Not sure that there is - when it's set as a downloaded attachment, you can specify the name in the Content-Disposition header. But if it's inline (which it is if it's in a browser tab), the filename isn't an option, and it would use the "filename" from the url - which in this case ends in render, so it uses render as the title (since it's not an HTML document). Note: I'm not the developer, just someone who uses the software and is a developer.

Mizar01 commented 3 years ago

Actually the best and recommended way to use this tool is to call "/api/render" in a background service (your server page). The stream of bytes returned can then be treated as you like, with a redirect to a new page and a filename or whatsoever.