Package org.cyclos.impl.utils.pdf
Interface PdfTemplate
-
public interface PdfTemplateRenders an HTML using Thymeleaf. Then transforms it into XHTML using JSoup. Finally, transform the XHTML in PDF using Flying Saucer. All HTML templates are in src/main/resources/pdf-templates. The template called 'layout' is always used to generate the general page structure: styles, header, footer, etc. The actual content page to be rendered is included in the layout template in the content section.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description PdfTemplatebind(String name, Object value)Binds a Thymeleaf variablePdfTemplatebindAll(Map<String,Object> variables)Binds a set of Thymeleaf variablePdfTemplatelandscape(boolean landscape)Sets the template to be rendered in landscape orientation (if true) or portrait (default, if false)PdfTemplatenoFooter()Suppresses the default PDF footerPdfTemplatenoHeader()Suppresses the default PDF header.SerializableInputStreamrender()Actually renders the PDF filedefault FileInforenderToFile(String name)Renders the PDF as aFileInfoPdfTemplatestreamFactory(StreamFactory factory)Registers a StreamFactory, that is, a handler for a custom URL protocol in the HTML templatePdfTemplatetitle(String title)Sets the PDF title.PdfTemplatetitle(MessageKey key, Object... args)Sets the PDF title from a translation key.
-
-
-
Method Detail
-
bind
PdfTemplate bind(String name, Object value)
Binds a Thymeleaf variable
-
bindAll
PdfTemplate bindAll(Map<String,Object> variables)
Binds a set of Thymeleaf variable
-
landscape
PdfTemplate landscape(boolean landscape)
Sets the template to be rendered in landscape orientation (if true) or portrait (default, if false)
-
noFooter
PdfTemplate noFooter()
Suppresses the default PDF footer
-
noHeader
PdfTemplate noHeader()
Suppresses the default PDF header. As the header contains the title, suppressing the header will make it useless to set a title.
-
render
SerializableInputStream render()
Actually renders the PDF file
-
streamFactory
PdfTemplate streamFactory(StreamFactory factory)
Registers a StreamFactory, that is, a handler for a custom URL protocol in the HTML template
-
title
PdfTemplate title(MessageKey key, Object... args)
Sets the PDF title from a translation key. Only used if the header is not suppressed.
-
title
PdfTemplate title(String title)
Sets the PDF title. Only used if the header is not suppressed.
-
-