i Freller can u send me the full code for printing a doc in gwt2.4(rahul.ranja...@gmail.com) Actually i very new to gwt so plz help me out.
On Monday, January 15, 2007 8:05:55 PM UTC+5:30, Freller wrote: > > > Following the thread about printing at > > > http://groups-beta.google.com/group/Google-Web-Toolkit/browse_frm/thread/53624cb05aa85624/247e890d73a76948?lnk=gst&q=print&rnum=2#247e890d73a76948 > > > > I created a simple class that can print any HTML, DOM.Element or Widget > without opening a new window. > > Regards, > Freller > > /** > * <pre> > * Generic printing class > * can be used to print the Window it self, DOM.Elements, UIObjects > (Widgets) and plain HTML > * > * Usage: > * You must insert this iframe in your host page: > * <iframe id="__printingFrame" > style="width:0;height:0;border:0"></iframe> > * > * Window: > * Print.it(); > * > * Objects/HTML: > * Print.it(RootPanel.get("myId")); > * > Print.it(DOM.getElementById("myId")); > > > * Print.it("Just <b>Print.it()</b>!"); > * > * Objects/HTML using styles: > * Print.it("<link rel='StyleSheet' type='text/css' > media='paper' href='/paperStyle.css'>", RootPanel.get('myId')); > * Print.it("<style type='text/css' media='paper'> .newPage { > page-break-after: always; } </style>", > * > > "Hi<p class='newPage'></p>By"); > * </pre> > */ > > package org.gwtcommons.user.client; > > import com.google.gwt.user.client.Element; > import com.google.gwt.user.client.ui.UIObject; > > public class Print { > > public static native void it() /*-{ > $wnd.print(); > }-*/; > > public static native void it(String html) /*-{ > var frame = $doc.getElementById('__printingFrame'); > if (!frame) { > $wnd.alert("Error: Can't find printing frame."); > return; > } > frame = frame.contentWindow; > var doc = frame.document; > doc.open(); > doc.write(html); > doc.close(); > frame.focus(); > frame.print(); > }-*/; > > public static void it(UIObject obj) { > it("", obj.getElement().toString()); > } > > public static void it(Element element) { > it("", element.toString()); > } > > public static void it(String style, String it) { > it("<it><header>"+style+"</header><body>"+it+"</body></it>"); > } > > public static void it(String style, UIObject obj) { > it(style, obj.getElement().toString()); > } > > public static void it(String style, Element element) { > it(style, element.toString ()); > } > > } // end of class Print > > > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/w8Ed0Xm4M6sJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.