Yes

2010/10/28 Stefan Lindner <lind...@visionet.de>

> Do you want to open the PDF in a separate window? Klick on some button and
> open a new browser window with pdf?
>
> Stefan
>
> -----Ursprüngliche Nachricht-----
> Von: Alex Zeit [mailto:zeita...@googlemail.com]
> Gesendet: Donnerstag, 28. Oktober 2010 15:14
> An: users@wicket.apache.org
> Betreff: Problems displaying a PDF from stream
>
> While trying to display a PDF document from stream following problems
> arrise:
> IE7:
> Resource can not be displaied at all.
>
> Firefox 3.6.12:
> PDF is displaied but if Chronk is cleared in Firefox while document is open
> then it cannot be displaied again. It is possible only after restarting
> Firefox.
>
> No errors in log.
>
> The code:
> public class PdfGen extends WebResource {
>
>    public PdfGen() {
>        setCacheable(false);
>    }
>
>    @Override
>    public IResourceStream getResourceStream() {
>        IResourceStream resourceStream = new AbstractResourceStreamWriter()
> {
>            private static final long serialVersionUID =
> 1934248394380163944L;
>            public void write(OutputStream output) {
>                testItextDirect(output);
>            }
>            public String getContentType() {
>                return "application/pdf";
>            }
>        };
>        return resourceStream;
>    }
>
>    private void testItextDirect(OutputStream output){
>        try {
>            Document document = new Document();
>            PdfWriter.getInstance(document, output);
>            document.open();
>            document.add(new Paragraph("Hello World"));
>            document.add(new Paragraph(new Date().toString()));
>            document.close();
>        } catch (DocumentException de) {
>            try {
>                throw new IOException(de.getMessage());
>            } catch (IOException e) {
>                e.printStackTrace();
>            }
>        }
>    }
> }
>
>
> in the init() of AuthenticatedWebApplication SharedResource added like
> this:
> getSharedResources().add("pdfGen", new PdfGen());
>
> Any help would be highly appreciated
> Alex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to