Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Canvas.showPrintPreview used for email

    I want to email the HTML from the print preview. The general thinking is create a print preview, then add an "Email" button which grabs the HTML from the print preview and sends it as a string to the server for emailing.

    Sound reasonable?

    I actually found my answer, but in case anyone else needs this (or has feedback on the approach)

    Code:
      Canvas.getPrintHTML()

    #2
    This idea only half works. To get it to work correctly, I would also need to inject all the CSS. Ah well.

    I guess I need to write server code to generate nice emails instead of using SmartGWT to render grids for me. And probably consider a report engine.

    Comment


      #3
      When we do this, we just inject the CSS as well. Pretty straightforward.

      Comment


        #4
        Is there any easy way get the current CSS or do I need to create a separate inline CSS definition/string to inject. I presume it is the latter, but if there is a way to get it automatically that would be cool. Otherwise it is Firebug and copy paste I guess.

        Comment


          #5
          The styles are in the skin (skin_styles.css). Right now we don't have a separate file available with just the print styles, sorry.

          Comment


            #6
            Can I load the css file as a string in GWT? The following does not work (and was a wretched hack to start with)

            Code:
            	HTMLPane style = new HTMLPane();
            	String contentsURL = "[skin]/skin_styles.css";
            	style.setContentsURL(contentsURL);
            	style.draw();
            	style.hide();
            	String styleString = style.getContents();
            Sorry for what is probably a pretty basic GWT question. I tried searching for it but could not find the code to load the contents of a URL into a string.

            Comment

            Working...
            X