I’m Wondering if we can preview pdf file in the embedded component instead of a separate page in the browser. For example, by using the following code (from the documentation) I can display JPEG image:
FileDescriptor fd = salesOrderAttachmentsTable.getSingleSelected().getAttachment(); if (fd != null) { imageView.setSource(FileDescriptorResource.class).setFileDescriptor(fd); imageView.setVisible(true); } else { imageView.setVisible(false); } }
I tried the following code to display pdf in browser that works (here pdfView is embedded component).
pdfView.setSource(String.format("%s.pdf", fd.getUuid()), new FileDataProvider(fd)); pdfView.setType(Embedded.Type.BROWSER); pdfView.setVisible(true);
How can I display pdf in preview within screen?