Get pdf and send

Hi!!
Now, i’m trying to converse a html file to a pdf file in my web app and then send it to an email of the user.
To convert the html to pdf i made the next with Javascript:

"<script type=""text/javascript"">"+_ "$('#cmd').click(function() {"+_ "var options = {"+_ "};"+_ "var pdf = new jsPDF('p', 'pt','letter');"+_ "pdf.internal.scaleFactor = 1.133;"+_ "pdf.addHTML($(""#content"")[0],0,0, {}, function () {"+_ "pdf.save('pageContent3.pdf');"+_ "}); "+_ "});"+_ "</script> "+_
to do this i use jspdf library.
The problem is that i don’t know how to get the pdf in xojo to make an email attachement file. I think i can read frow xojo the object pdf and send this to email. But i don’t know how do that.
If someone have any other idea, please help me.
I can’t use MBS solutions.

How are you running this script? If you hack and slashed it into a HTMLViewer, I don’t think it’s possible to get the PDF out. If you’re using the WebSDK, raise an event to pass the data to Xojo with triggerServerEvent.

Edit: It may be possible to extract from iframe, see https://stackoverflow.com/a/11107977/6047977

Hi Tim! Yes, I use HTMLViewer…

With the Xojo Web framework, HTMLViewer is simply an iframe. There’s details for how to extract the contents of an iframe here.

I would very much so recommend using the WebSDK to build a custom control that does this more efficiently.

Yes… I use the HTMLViewer cause i put in a document html with a qr code and all this i made it with Javascript. This document i need to convert to a pdf and send to an email.
Thanks to your recommendations. And sorry for my bad english

You are very welcome! I only know one human language, English; so you’re doing better than me! :slight_smile:

I really would recommend the WebSDK (documentation for it can be found with your Xojo installation in the Extras folder). Though I could imagine this might be challenging, as it’s very wordy and only in English.

In theory, the custom control would display the QR code in the web app, and send the PDF to the Xojo server using the server event. This won’t be as easy to implement as it is to describe.

Thanks a lot Tim!!
I will read the WebSDK to found something that helps me.
I like your positive comments, thanks for that. I will continue investigate.

Hola Alejandra, puedes revisar https://graffitisuite.com/wiki/doku.php?id=web:pdf, es una opcion de pago, pero tiene muchos controles para Xojo Web y la opci{on de PDF pueden generar uno a desde HTML