imprimir en GWT

en el evento del boton para imprimir

Element nodoiFrame = display.getDetalle().getElement().getChild(1).getChild(0).getChild(0).getChild(0).getParentElement();
//nodoiFrame.getFirstChildElement().setId(«imprimir«);
it(nodoiFrame.getFirstChildElement());

buscando el compone iframe donde esta el conetado de lo que queremos imprimir

// display.getDetalle().getElement().getChild(1).getChild(0).getChild(0).getChild(0).getChild(0).getParentElement().setId(«imprimir«);
Element nodoiFrame = display.getDetalle().getElement().getChild(1).getChild(0).getChild(0).getChild(0).getParentElement();
nodoiFrame.getFirstChildElement().setId(«imprimir»);

el codigo que hace imprimir

public static native void it() /*-{ 
        $wnd.print();
    }-*/;
    public static native void it(String html) /*-{
        var frame = $doc.getElementById(‘imprimir’);
        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(«

«+style+«

«+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 ());
    }

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *