Page 1 of 1

WebApp PDF creation?

Posted: Thu Jun 20, 2019 10:47 am
by seaniepie
Hi all,
I'm only just now testing with HTML5 for a client (so a bit of a newbie to this side of LC) with the aim of porting their existing LC projects over to become WebApps (Win/Mac Desktop only). What would be the way to output PDFs from a series of cards generated in LC?

Currently, the desktop app gathers all the data to produce a report or proposal document over a series of cards which are added one by one to a pdf using the pdf library. But I understand that this library has not been converted for Emsripten usage.

So, perhaps there is a method using JS or similar that someone can give hints to outputting either a series of cards or snapshots or canvas areas for print via the print() js to the native Windows/Mac print dialogue for PDF creation. (??)

Thanks in advance
Sean
Pi Digital

Re: WebApp PDF creation?

Posted: Thu Jun 20, 2019 3:02 pm
by [-hh]
You can't access the browsers print dialogue directly with LC-content from a HTML5 standalone.

Of course you can write to the webpage that calls the HTML5 standalone. So you could write images/text or even a self-created pdf output to a special div there and then print that div, all using javaScript.

p.s. You have in mind that MS IE/Edge can NOT be used for HTML5 standalones?

Re: WebApp PDF creation?

Posted: Thu Jun 20, 2019 4:46 pm
by seaniepie
Thanks H,
Yes, I'm aware of the weird (and unexplained) lack of IE support. We will need to insist our clients use chrome or safari (There is no way IT departments will install Safari on business machines so we have to hope they are ok with Chrome instead).

What did you mean by 'a self-created pdf output'?

Re: WebApp PDF creation?

Posted: Thu Jun 20, 2019 5:12 pm
by [-hh]
seaniepie wrote:What did you mean by 'a self-created pdf output'?
There are javaScript libraries for creating pdf-output in a webpage (client-side pdf printing). The input is text or images.

I have (90% finished) a sample stack "PDFWriter" that uses pdfMake in a browser widget. So it's very similar (and clear that it will work) to do that in the browser from a HTML5 standalone.

p.s. AFAIK the lacking support of MS IE/Edge is due to Emscripten, not due to LiveCode.
On Windows is Firefox also OK, sometimes even faster than Chrome with HTML5 standalones.

Re: WebApp PDF creation?

Posted: Fri Jun 21, 2019 12:47 am
by seaniepie
Ok. I can work with that. I’ll script an LC to pdfMake conversion library as well as the mySQL lib we need.

Thanks for the excellent tips. And all your other examples on the forum too