Export & LC8 & Browser widget
Mark Waddingham
mark at livecode.com
Wed Mar 2 08:53:06 EST 2016
On 2016-03-02 14:26, Terence Heaford wrote:
> Thanks for the comments.
>
> As I am using a Browser to display amCharts it would be good to be
> able to print the contents of the Browser.
>
> This workaround of snapshot gives a poor printout when it is copied to
> an image for printing.
>
> Would there be a better way to achieve this?
>
> I understand the need to create widgets to showcase what can be
> achieved with LC8 but I am thinking it is counter productive
> to include widgets that are not completed, particularly when LC8 is
> released.
>
> The Browser is a good example in that without printing functionality,
> it’s not useless but is severely limited.
For a use-case which requires printing the browser contents then yes,
that is a limitation. However, it would be a huge stretch to assert that
'all uses of a browser require printing functionality' because they
don't, quite frankly. So, 'severely limited' - no; not ideal for your
use-case - yes.
To be fair, if you are trying to print the current image in the browser
window as part of a larger document rather than just the browser window
contents itself then I'm not sure that is actually going to be generally
possible. I *think* it can be done on Mac (as the WebView component has
the standard Cocoa-based printing ability at first sight at least),
however I'm not so sure on the other platforms - particularly mobile. (I
just had a quick look into CEF and the options there do appear to be
very very limited as well).
If you are printing the browser content on its own, then you could try
using JavaScript - something along the lines of 'window.print()'.
However, I'm not sure how controllable that is - perhaps someone with
more intimate knowledge of doing such things in JavaScript in browsers
could chime in and comment :)
Looking into amCharts there does seem to be a way to 'export' a chart as
an image using JS - either as images or SVG. You could export as a PNG /
JPG at 2-4x the size in pixels and then print that using LiveCode - that
would give a better fidelity result. Once we have SVG support integrated
(which won't happen for LC8 unfortunately, but should shortly
afterwards), then that would be another approach which will give much
better fidelity.
Alternatively, you could consider generating a PDF from JavaScript
(there's a tutorial of that on the amCharts site), or building a web
page with all that you wish to print and using the 'window.print()'
method - taking LiveCode out of the equation entirely.
Warmest Regards,
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list