Looking for Printing suggestions

49 views
Skip to first unread message

Thomas Mancini

unread,
Jun 7, 2012, 3:11:12 PM6/7/12
to Google Web Toolkit
Hello All,

I am currently working on a GWT application that requires report
printing. The use can select report parameters from a screen, and
upon clicking print we would like to display the file as it is being
generated. Currently we have server side code that is generating HTML
and writing it to a file. When the user clicks print, an RPC is being
made to pass the report parameters to the server and begin the
report. A second RPC is made after the report has started to obtain
the report's URL. From here, we are creating a Frame and setting the
URL to be the URL retrieved by the second RPC.

The issue I am currently running into, is that when setUrl gets
called, it only displays as much HTML that was contained in the file
at the time of the call. What would be the best way to refresh just
the frame containing the HTML report? It appears making subsequent
calls to setUrl passing in the same Url each time would do the trick,
but it actually doesn't seem to contain the additional content that
would've been written since the last call. It is also resetting the
vertical scroll bar's position each time back to the top of the bar
which is something else I would like to prevent. Is there a better
way to go about doing this?

Thanks.

jhulford

unread,
Jun 8, 2012, 10:40:54 AM6/8/12
to google-we...@googlegroups.com
I would probably have the frame page itself be a simple entry point and just have it keep requesting your updated HTML content via an RPC and update your frame's innerHTML to set the content to the HTML returned by the call, you can probably even get it set to only return the "next" chunk of HTML instead of the whole page by remember some file marker (byte count?) that tells the servlet where the last read left off at.  I think this would probably fix your scrollbar issue as well since you're not reloading the page with each request, instead just resetting some innerHTML.

Thomas Mancini

unread,
Jun 8, 2012, 12:20:58 PM6/8/12
to Google Web Toolkit
Thanks for the response. I did try this approach, however it could
potentially become an issue that it's resetting the entire HTML each
time. Even if I only get the next "chunk" each RPC, setInnerHtml
would have to also take in all of the previous chunks that were
retrieved.
Reply all
Reply to author
Forward
0 new messages