[semi-OT] PDF on the fly

jbv at souslelogo.com jbv at souslelogo.com
Wed Sep 14 14:58:00 EDT 2022


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



More information about the use-livecode mailing list