How do I send content to the user's printer from the Layout?

Get help using Construct 2

Post » Wed Jul 23, 2014 4:47 pm

Ouch, same as me... okay. At this rate, I think I may try to tackle the issue slightly differently and save the contents to an image file instead of printing, and hope that I don't run into any further compatibility issues.

Thank you for all your help.
B
7
S
1
Posts: 61
Reputation: 588

Post » Wed Jul 23, 2014 8:48 pm

I tried using an iframe to print the resulting canvas snapshot, and it seems to be working in Chrome.

Use the "On canvas snapshot" trigger and add the following executeJS :
Code: Select all
"var iframe = document.getElementById(""iframe"");
if(!iframe) iframe = document.createElement(""iframe"");
iframe.frameBorder=0;
iframe.width=""0px"";
iframe.height=""0px"";
iframe.id=""iframe"";
iframe.setAttribute(""src"", ""about:blank"");
document.body.appendChild(iframe);
var image = new Image(); image.src = """ & CanvasSnapshot & """; $(""#iframe"")[0].contentWindow.document.open(); $(""#iframe"")[0].contentWindow.document.appendChild(image); $(""#iframe"")[0].contentWindow.document.close();
window.frames[""iframe""].focus();
window.frames[""iframe""].print();"
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Sat Sep 23, 2017 6:23 pm

Good afternoon. I'm also creating a game and I need to print a form, I think like this (Character Image = character information), to create a type of album ...
Have you been able to print or not yet?
Huemerson
B
19
S
14
G
20
Posts: 90
Reputation: 14,871

Previous

Return to How do I....?

Who is online

Users browsing this forum: Fenix18 and 62 guests