[semi-OT] PDF on the fly

matthias_livecode_150811 at m-r-d.de matthias_livecode_150811 at m-r-d.de
Wed Sep 14 15:22:08 EDT 2022

I just checked here with a script i am using for years to provide the download of a csv file and it still works with Version 15.6 (17613.
Is that the newest version?

This is my script:

put header "Content-Type: application/text"
put header "Content-Length:" & the number of chars of tFileContent
put new header "Content-Disposition: attachment; FileName=" & tFileName
put URL("file:" & tFileContent)

The only difference i see is, that i have    put new header instead of put header

> Am 14.09.2022 um 20:58 schrieb jbv via use-livecode <use-livecode at lists.runrev.com>:
> Hi list,
> I have a web site on which end users can select several options,
> and then click a button "show PDF", and a pdf containing various
> contents from a remote DB with a sophisticated layout is built
> server side in a second and automatically downloaded.
> The link of the button is something like :
>  https://domain.com/showPDF.lc?a=parameters
> and the script sets the header of the pdf file as follows :
>  put header "Content-Type: application/pdf"
>  put header "Content-Length: " & number of chars of myPDF
>  put header "Content-Disposition: attachment; filename=" &quote& myFileName &quote
> This has been working fine for years, and still works on Chrome
> and FF, but apparently the latest versions of Safari don't accept it:
> the file is built and the download starts but quickly stalls and that's it.
> And no error message van be found in the console.
> As an alternative solution, I've been thinking of building the pdf server side
> and writing it in a temporary folder, and then on the web page displaying a
> prompt with a button containing the actual url of the file. But that's not
> very elegant IMHO.
> What other options do I have ?
> Thank you in advance.
> Best,
> jbv
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list