Package org.nekosoft.pdffer
Class PdfferProducerBean
java.lang.Object
org.nekosoft.pdffer.PdfferProducerBean
The main Spring bean in PDFfer Core. This uses PDF templates - that must be provided by separate libraries - in
order to generate PDFs on the fly when needed. It needs an instance of
PdfferRegistryBean
, that will be
used when looking for templates.-
Constructor Summary
ConstructorDescriptionPdfferProducerBean(PdfferRegistryBean registry)
Creates a new PdfferProducerBean with the given registry. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
generatePdfDocument(String templateName, Object data)
Generates a new PDF with the given template (that must be present in the root registry) and the given payload.<T> byte[]
generatePdfDocument(String group, String templateName, T data)
Generates a new PDF with a template by the given name and group and with the given payload.byte[]
generatePdfDocumentByPath(String templatePath, Object data)
Generates a new PDF with the template at the given template path and with the given payload.byte[]
generatePdfDocumentByPathFromJsonMap(String templatePath, Map<String,Object> data)
Generates a new PDF with the template at the given template path and with the given payload.byte[]
generatePdfDocumentByPathFromJsonString(String templatePath, String data)
Generates a new PDF with a template at the given path and with the given payload.byte[]
Generates a new PDF with a template by the given name and group and with the given payload.byte[]
generatePdfDocumentFromJsonMap(String templateName, Map<String,Object> data)
Generates a new PDF with the given template (that must be present in the root registry) and the given payload.byte[]
generatePdfDocumentFromJsonString(String templateName, String data)
Generates a new PDF with the given template (that must be present in the root registry) and the given payload.byte[]
generatePdfDocumentFromJsonString(String group, String templateName, String data)
Generates a new PDF with a template by the given name and group and with the given payload.
-
Constructor Details
-
PdfferProducerBean
Creates a new PdfferProducerBean with the given registry. This is not usually invoked manually. Spring will create an instance of this class and inject the registry.- Parameters:
registry
- the registry
-
-
Method Details
-
generatePdfDocumentByPath
Generates a new PDF with the template at the given template path and with the given payload. The path is split into group and name usingPdfTemplate::splitTemplatePath(String)
.- Parameters:
templatePath
- the path (group + separator + name ) of the template to be useddata
- the payload needed by the template for PDF generation- Returns:
- the bytes of the generated PDF document
-
generatePdfDocument
Generates a new PDF with the given template (that must be present in the root registry) and the given payload.- Parameters:
templateName
- the template name (from the root registry)data
- the payload needed by the template for PDF generation- Returns:
- the bytes of the generated PDF document
-
generatePdfDocument
Generates a new PDF with a template by the given name and group and with the given payload.- Type Parameters:
T
- the type parameter- Parameters:
group
- the group where the template residestemplateName
- the template namedata
- the payload needed by the template for PDF generation- Returns:
- the bytes of the generated PDF document
-
generatePdfDocumentByPathFromJsonString
Generates a new PDF with a template at the given path and with the given payload.- Parameters:
templatePath
- the path (group + separator + name ) of the template to be useddata
- a string containing a JSON representation of the payload for the PDF- Returns:
- the bytes of the generated PDF document
-
generatePdfDocumentFromJsonString
Generates a new PDF with the given template (that must be present in the root registry) and the given payload.- Parameters:
templateName
- the template name (from the root registry)data
- a string containing a JSON representation of the payload for the PDF- Returns:
- the bytes of the generated PDF document
-
generatePdfDocumentFromJsonString
Generates a new PDF with a template by the given name and group and with the given payload.- Parameters:
group
- the group where the template residestemplateName
- the template namedata
- a string containing a JSON representation of the payload for the PDF- Returns:
- the bytes of the generated PDF document
-
generatePdfDocumentByPathFromJsonMap
Generates a new PDF with the template at the given template path and with the given payload. The path is split into group and name usingPdfTemplate::splitTemplatePath(String)
.- Parameters:
templatePath
- the path (group + separator + name ) of the template to be useddata
- ajava.util.Map
representation of the payload for the PDF- Returns:
- the bytes of the generated PDF document
-
generatePdfDocumentFromJsonMap
Generates a new PDF with the given template (that must be present in the root registry) and the given payload.- Parameters:
templateName
- the template name (from the root registry)data
- ajava.util.Map
representation of the payload for the PDF- Returns:
- the bytes of the generated PDF document
-
generatePdfDocumentFromJsonMap
public byte[] generatePdfDocumentFromJsonMap(String group, String templateName, Map<String,Object> data)Generates a new PDF with a template by the given name and group and with the given payload.- Parameters:
group
- the group where the template residestemplateName
- the template namedata
- ajava.util.Map
representation of the payload for the PDF- Returns:
- the bytes of the generated PDF document
-