Print contents of a TextArea - How do i do this?

418 views
Skip to first unread message

RT

unread,
Oct 23, 2006, 4:01:48 PM10/23/06
to Google Web Toolkit
I need to print the contents of a textarea.
I referred
http://groups.google.com/group/Google-Web-Toolkit/browse_frm/thread/1a475f645b0b204/f07319d3d64863f2?lnk=gst&q=print&rnum=3#f07319d3d64863f2
and this tried

private native void printFrame(Element e) /*-{
e.value.print();
}-*/;

Textarea t = new Textarea();
t.setText("Something");
printFrame(t.getElement);

I get the following JavaScriptException
com.google.gwt.core.client.JavaScriptException: JavaScript TypeError
exception: Object doesn't support this property or method

Any suggestions?

mP

unread,
Oct 23, 2006, 7:47:06 PM10/23/06
to Google Web Toolkit
Create a new window... with window.open(), copy the content of your
text area to the new window. then print the new window. THe browser
will kick in and prompt the user with the usual print dialog allow the
user to finish the process.

RT

unread,
Oct 24, 2006, 9:55:49 AM10/24/06
to Google Web Toolkit
hello mP,
Thanks for idea. I had already tried that and it works. The problem is
, this workaround forces a print preview ie another browser window to
open before we actually do the printing. I would like the print dialog
to open directly without such a preview. Is tht possible?

KMR

unread,
Nov 1, 2006, 11:33:52 AM11/1/06
to Google Web Toolkit

Hi all,

i'm bit confused on how to print a single VerticalPanel(not the entire
window), i don't understand how i can copy the contents(a sort of
report builded in a verticalpanel with some widgets) to the new window.

The issue about print with native js works fine, but because i don't
need to print entire app window, i want to copy only the vertical panel
that i need to the new window and print only the content of this new
window.

Anyone that could enlight me ?

Best regards and thanks in advance.
KMR

Reply all
Reply to author
Forward
0 new messages