Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 1 Monat
Letzter Beitrag:
vor 2 Jahren, 1 Monat
Beteiligte Autoren:
Danny Lauwers, Peter Holemans

[WB21] How to set the name of the PDF downloaded by user ?

Startbeitrag von Danny Lauwers am 21.06.2016 15:13


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"

// Set language of the logged in user (TODO)

// Print the report

// Display
IF fFileExist(sFilename) THEN

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 ?



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.


Peter Holemans

von Peter Holemans - am 21.06.2016 16:01
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 ?


von Danny Lauwers - am 21.06.2016 18:34
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.