Interface HtmlToPdfAConverter

All Known Implementing Classes:
OpenHtmlToPdfAConverter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface HtmlToPdfAConverter
Functional interface of an HTML-to-PDF/A converter.
Author:
Quentin Ligier
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    convert(NarrativeLanguage lang, Map<String,Object> contextVariables, String templateContent)
    Converts the HTML content to its PDF/A representation, with a custom template.
  • Method Details

    • convert

      byte[] convert(NarrativeLanguage lang, Map<String,Object> contextVariables, String templateContent)
      Converts the HTML content to its PDF/A representation, with a custom template.
      Parameters:
      lang - The document language, as an ISO code.
      contextVariables - The context variables to be added to the template processing. Note that a context variable lang is automatically added with the code value of the received lang parameter. Furthermore, the following context variables – and, possibly, others – are expected by the default templates provided with this module, since they are needed to produce a valid PDF/A document:
      • title - a string with the document's title.
      • subject - a string with the document's subject
      • author - a string with the document's author
      • description - a string with the document's description
      • bookmarks - a map of <String, String> pairs:
        • Key: a string with the bookmark link reference, that is, the value of the href attribute of an anchor element within the processed template.
        • Value: the value of the bookmark, that is, the string that will be used to display the bookmark itself.
        For instance, the pair ("Active Treatments", "#active-treatments") should be used to produce a bookmark to be rendered as Active Treatments that would point to the HTML element with id active-treatments in the processed template.
      Any callers using custom templates must make sure they are still setting these in their templates either by means of these context variables or by any other method (e.g. hardcoded in the template), as well as providing any other context variables that might be required by said templates.
      templateContent - The custom Thymeleaf content.
      Returns:
      The content of the generated PDF/A.