Create a servlet which can go to your database and return the PDF
when you do a "get" call. Lets assume that the url to that is:
http://mycompany.com/gwtmodule/pdfservlet/
where the GWT module name is gwtmodule and the web.xml has a servlet
definition with a
<url-pattern>/pdfservlet/*.pdf</url-pattern>
So, to get a PDF file called file1.pdf
add a link somewhere on your GWT page which is
<a href='" + GWT.getModuleBaseURL() + "pdfservlet/file1.pdf"
+ "'>Link to file1</a>
You can do this by
A. generating the HTML directly and injecting it into an HTML
widget
B. or by using an InlineHyperlink
C. or a Hyperlink widget. See the javadocs for details.
D. or an Anchor widget (possibly the easiest)
For example:
Anchor anchor = new Anchor();
anchor.setText("Link to file1.pdf");
anchor.setHref(GWT.getModuleBaseURL() + "pdfservlet/file1.pdf");
and then add the anchor to the container widget you want to place it on.
When your user clicks on that link it will generate an HTTP GET
request to
http://mycompany.com/gwtmodule/pdfservlet/file1.pdf.
Your servlet should then render the PDF as a stream of bytes using
the response.getOutputStream() method of the servlet. Don't forget
to set the length and the content type into the response as well.
HTH
Alan