Announcement

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

    Callback not called when overriding getPrintHTML()

    By overriding getPrintHTML() for a component the provided callback is not called. Is this by design or is it a bug? Here is the sample code.

    Code:
    @Override
    public String getPrintHTML(PrintProperties printProperties, PrintHTMLCallback callback) {
                SC.logWarn("getPrintHTML called");
                if (callback == null) {
                       String print = super.getPrintHTML(printProperties, null);
                       return print + "my adjusting html code";
                } else {
                      super.getPrintHTML(printProperties, new PrintHTMLCallback() {
                            @Override
                            public void setHTML(String html) {
                                     SC.logWarn("does not enter here");
                                     callback.setHTML(html + "my adjusting html code");
                            }
                     });
                     return null;
              }
    }

    #2
    Printing is an asynchronous process to allow for HTML generation that takes a while. The point is for your code to call the PrintHTMLCallback when you are done generating the HTML.

    You look like you're still on the wrong path (relative to your other threads). Just to take a stab at what might be wrong: do you realize that if you simply put what you want on the screen, and call the core GWT Window.print() function to invoke the native print dialog, you're going to get a printout of whatever is there: widgets, etc, however you've arranged them?

    Because you continue to inexplicably focus on overriding the print HTML, when you've made it clear you don't want the print HTML, but the normal HTML.

    Comment


      #3
      Printing is an asynchronous process to allow for HTML generation that takes a while. The point is for your code to call the PrintHTMLCallback when you are done generating the HTML.
      Well... yes. My code calls the callback it receives when I am done working and your code should call the callback it receives after you are done working. But it doesn't. Unless I am dumb and I lose something from sight...

      You look like you're still on the wrong path (relative to your other threads). Just to take a stab at what might be wrong: do you realize that if you simply put what you want on the screen, and call the core GWT Window.print() function to invoke the native print dialog, you're going to get a printout of whatever is there: widgets, etc, however you've arranged them?

      Because you continue to inexplicably focus on overriding the print HTML, when you've made it clear you don't want the print HTML, but the normal HTML.
      Yes, I know that. There are advantages and disadvantages for both solutions... I am trying to get the advantages from both.

      I would like to talk more about the web printing mechanism(just as a general research and brainstorming ideas with you and other interested developers) but this is not the place.

      Comment


        #4
        We see an issue affecting your situation which we're investigating. It was not caught earlier, presumably, because it only happens if the superclass method is called in the override.

        Comment


          #5
          A fix for this has been applied to SGWT 12.1+ and newer releases as of the nightly builds dated 2020-11-14.

          Comment


            #6
            I confirm the problem is solved. Thank you!

            Comment

            Working...
            X