[Gambas-user] Example for download and print in gb.web/gb.web.form

T Lee Davidson t.lee.davidson at gmail.com
Wed Apr 29 17:27:03 CEST 2020


On 4/29/20 3:56 AM, Safiur Rahman wrote:
> Hi
> I included printJS  (https://printjs.crabbly.com/) and I could print
> properly any content. I also created PDF using external application
> (eg. wkhtmltopdf). But during printing the PDF (generated from
> wkhtmltopdf) I couldn't pass the correct path of the file to printJS
> because the PDF file was generated in Temp folder. How can I pass file
> path in Temp folder to javascript function? I have been using
> gb.web.gui.
> 
> ''Generating PDF
> sPath = Temp() & ".pdf
> Shell "wkhtmltopdf " & sHtml & " " & sPath Wait
> 
> ''Printing PDF
>   Me.Exec("printJS('" & "test.pdf" & "')")
> 

I'm not familiar with printJS and have not used gb.web.gui. But, instead of hard-coding the PDF filename, did you try passing 
the path of the created file? Ie.:

Me.Exec("printJS(" & sPath & ")")

Or perhaps Copy the file to the web root, and then pass that path to printJS.


-- 
Lee


More information about the User mailing list