Skip to end of metadataGo to start of metadata
From time to time people ask this question, or similar or related ones, on the list. So, I'll try to summarize the answer I gave on the list...
Here Mudassar Ahmed Khan has explained how to upload and save PDF files to SQL Server Database table using File Upload control and then retrieve and display the PDF Files from database in browser. The PDF File will be embedded in browser and displayed using HTML OBJECT tag. TAGs: ASP.Net, SQL Server.
Suppose we want to show a PDF (an Excel/ a Word) document embedded in a Wicket page. If you look into Wicket sources you will find the class org.apache.wicket.markup.html.link.InlineFrame. This class is suitable for displaying a Wicket page embedded inside an IFRAME contained in another Wicket page. So, let's clone and modify this class to make it suitable for displaying other types of contents (e.g. a generated PDF).
So, this class instead of implementing ILinkListener implements IResourceListener and generates an URL for the src attribute of IFRAME that points back to itself. The class receives an IResourceListener as an attribute on the constructor and delegates the production of the IFRAME contents to this IResourceListener. If you want to know which of the implementations of IResourceListener you need just open it with your favorite IDE and search for all classes implementing it (on Eclipse you can easily do that typing Ctr-T.
Now that we have our main class let's use it to display a PDF.
On the same package as class above I create the following class:
This class just reads a PDF named test.pdf from the same package some.example. So, to make the example work take you favorite PDF file and drop it on that folder and rename it to test.pdf.
Then lets show this PDF in a Wicket panel:
and
If you now include previous panel in a Wicket page you will be able to see your test PDF embedded on that page!