WebApp PDF creation?

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

WebApp PDF creation?

Post by seaniepie » Thu Jun 20, 2019 10:47 am

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

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: WebApp PDF creation?

Post by [-hh] » Thu Jun 20, 2019 3:02 pm

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?
shiftLock happens

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: WebApp PDF creation?

Post by seaniepie » Thu Jun 20, 2019 4:46 pm

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'?

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: WebApp PDF creation?

Post by [-hh] » Thu Jun 20, 2019 5:12 pm

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.
shiftLock happens

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: WebApp PDF creation?

Post by seaniepie » Fri Jun 21, 2019 12:47 am

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

Post Reply

Return to “HTML5”