From the course: Complete Guide to Spring MVC

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

PDF and Excel overview

PDF and Excel overview

- [Instructor] PDF and Excel. Spring MVC supports generating documents, like PDF and Excel files, dynamically using AbstractPdfView and AbstractXlsxView classes. These views are ideal for exporting reports, invoices, or other structured data directly from your web application. Let's look at creating PDF documents in Spring MVC. First, we want to create a custom PDF view. So here I've created a PdfView class that extends AbstractPdfView to define the content and structure of the PDF. In this class, you'll want to retrieve data from the model and then add content to the PDF document. Next, configure the ViewResolver. Map the custom view to its corresponding route in your configuration, and then of course, add your required dependencies. Add the iText, which is deprecated for commercial use, or OpenPDF library to your project. When I say deprecated for commercial use, there are a few open source options that you can use for personal projects. Now we'll look at creating Excel documents in…

Contents