|
| [WB21] How to set the name of the PDF downloaded by user ? |
| Iniciado por guest, 21,jun. 2016 17:13 - 2 respuestas |
| |
| | | |
|
| |
| Publicado el 21,junio 2016 - 17:13 |
Hi,
I am displaying my report as PDF to the user, but when they save the PDF they get a strange name 4N4AABaBBdVWRnJTUGFKS1dwAAA.pdf (always different, seems random ?)
This is the code I use to generate the PDF:
sFilename = DateToString(Today,"YYYY-MM-DD") + " " + TimeToString(Now(),"HHMMSS") + " " + ReportName + ".PDF" iDestination(iGenericPDF,sFilename) // Set language of the logged in user (TODO) // Print the report iPrintReport(MyParameters) // Display IF fFileExist(sFilename) THEN FileDisplay(sFilename,"application/pdf") fDelete(sFilename) END I read the artikel of Pete H. about setting the name of the PDF for Windev, but it seems that these commands are not available for WebDev.
When I add the extra parameter to FileDisplay, the PDF is directly downloaded with the correct filename, but I want a preview of the PDF in the browser !
Does anybody knows how the name can be set ?
Thank Danny |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2016 - 18:01 |
Hi Danny,
This should do the trick: //Display the PDF file FileDisplay(pPDFFile, "application/pdf",pPDFSaveAs) The pPDFFile is the physical file name as it is stored on the server. The pPDFSaveAs is the name that will be proposed to the web user to save the file.
Cheers,
Peter Holemans |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2016 - 20:34 |
Hi Peter,
This does indeed solve the problem of the filename, But this starts a direct download. I would rather open the PDF file in a new tab of the browser so it can be viewed directly and then printed or saved when needed.
Maybe it is not possible to provide a filename because it is streamed to a temporary file ?
Danny |
| |
| |
| | | |
|
| | | | |
| | |
|