Welcome to the lib-utils tutorials! This directory contains a series of tutorials to help you learn how to use the utilities provided by the lib-utils library, with a focus on the powerful TemplateRenderUtil class.
Before starting these tutorials, make sure you have:
-
Added the lib-utils dependency to your project:
<dependency> <groupId>org.fireflyframework</groupId> <artifactId>lib-utils</artifactId> <version>1.0.0</version> </dependency>
-
Basic knowledge of Java programming
-
Familiarity with Maven or Gradle for dependency management
The tutorials are designed to be followed in sequence, starting with the basics and progressing to more advanced topics:
This tutorial introduces the basic concepts and usage of the TemplateRenderUtil class. You'll learn:
- How to render FreeMarker templates to HTML
- How to convert HTML to PDF
- How to configure template locations
- Basic error handling
This tutorial covers the FreeMarker template syntax and how to structure your templates effectively:
- FreeMarker syntax basics
- Variables, expressions, and directives
- Template inheritance and inclusion
- Best practices for template organization
This tutorial explores the various options available for customizing PDF output:
- Page size and margins
- Fonts and styling
- Headers and footers
- Bookmarks and metadata
- Security features (passwords and permissions)
This tutorial covers advanced features of the TemplateRenderUtil class:
- Template caching for improved performance
- Shared variables across templates
- Pre-processing and post-processing hooks
- Asynchronous rendering
- Template validation
- HTML to image conversion
- Custom template loaders
- Start with the Introduction: Begin with the first tutorial to understand the basics.
- Follow the Sequence: The tutorials build on each other, so it's best to follow them in order.
- Try the Examples: Each tutorial includes code examples that you can copy and adapt for your own projects.
- Experiment: Don't hesitate to experiment with the examples and try different options.
- Refer to the API Documentation: For more detailed information, refer to the Javadoc documentation.
- Main README: Overview of the entire lib-utils library
- FreeMarker Documentation: Official documentation for the FreeMarker template engine
- Flying Saucer Documentation: Documentation for the Flying Saucer HTML renderer used for PDF generation
If you encounter any issues or have questions about the tutorials or the lib-utils library:
- Check the GitHub Issues for existing problems and solutions
- Create a new issue if your problem hasn't been addressed
- Contribute improvements to the tutorials by submitting a pull request
Happy learning!