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.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

vaadin 14 - Exemplo para abrir PDF

Carlos Silva
2 years ago Apr 02, 2020 1:45pm
Rubén Espinoza
2 years ago Apr 05, 2020 11:16pm
Carlos Silva
2 years ago Apr 08, 2020 1:32am

Obrigado, Ruben. Tentei o que me indicou mas só recebia erro. Resolvi depois de muito pesquisar. E compartilho aqui para ajudar aos amigos que precisarem:

    Button downloadButton = new Button("Mostrar");
    Anchor anchor = new Anchor();
    anchor.setHref(new StreamResource("file.pdf", () -> new ByteArrayInputStream(methodFazJasperPDF())));
	public byte[] methodFazJasperPDF(){
	     byte[] bytes = JasperExportManager.exportReportToPdf(impressao);
		 return bytes;
Carlos Silva
2 years ago May 17, 2020 1:37am
Rubén Espinoza
2 years ago May 29, 2020 5:58pm