Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Display PDF in view
Hi,
I'd like to know if it is possible to display the PDF file within a view instead of a table? The user can see automatically the pdf and export it if he need it.
Thx a lot.
If the PDF is dynamic (or it is stored on your local system), then you should access it with a FileResource:
File pdfFile;
//fetch file or write content to the file here
Embedded pdf = new Embedded(null, new FileResource(pdfFile, getApplication()));
pdf.setMimeType("application/pdf");
pdf.setType(Embedded.TYPE_BROWSER);
pdf.setSizeFull();
addComponent(pdf);
If the PDF is stored elsewhere and you have the URL you can use ExternalResource instead.
Olga Avram: Hi,
I'd like to know if it is possible to display the PDF file within a view instead of a table? The user can see automatically the pdf and export it if he need it.
Thx a lot.
Hi,
I think you can build pdf viewers by yourself with the help of some manual tools which can be customized by users according to our own favors. You can also google it and select one whose way of processing is simple and fast to help you with the related work. Remember to check its free trial package first if possible. I hope you success. Good luck.
Best regards,
Arron