Skip to main content
Participating Frequently
April 19, 2017
Answered

Printing a downstream frame in Canvas html 5.0

  • April 19, 2017
  • 1 reply
  • 260 views

Hello again,

I am trying to convert a frame to a PNG and then print it. When I press the button with this code it prints out a blank document. What could be the reason?

this.Interton.addEventListener("click", fl_MouseClickHandler_2.bind(this));

function fl_MouseClickHandler_2() {

print_voucher();

function print_voucher() {

  var Reframed = canvas.toDataURL();

  var win = window.open();

  win.document.write("<br><img src='Reframed’/>");

  //The default format for genarated images is png. I tried  few more options:

  //win.document.write("<br><img src='Reframed.png'/>");

//win.document.write("<br><img src='images/Reframed.png'/>");

//win.document.write("<br><img src='Reframed.jpg'/>");

  win.print();

 

}

}

The final goal is to print a frame downstreams from the current frame that the user viewing rather than printing the current frame in the main time line as I try now. The reason is that the graphics that is printed in the downstream frame is affected by choices the user makes in the current frame using buttons and dropdown menus. The second question then is if there is a code for printing a frame other than the current one.

I was able to print the current frame that the user is viewing using the following code but as far as I understand there is no way of printing any other frame with it.

this.Interton.addEventListener("click", fl_MouseClickHandler_2.bind(this));

function fl_MouseClickHandler_2() {

print_voucher();

function print_voucher() {

  var win = window.open();

  win.document.write("<br><img src='" + canvas.toDataURL() + "'/>");

  win.print();

 

}

}

    This topic has been closed for replies.
    Correct answer ClayUUID

    You can only print what's on the screen. So if you want to print something, it has to be on the screen. You can't print what's not on the screen, because it's not on the screen.

    1 reply

    ClayUUIDCorrect answer
    Legend
    April 19, 2017

    You can only print what's on the screen. So if you want to print something, it has to be on the screen. You can't print what's not on the screen, because it's not on the screen.