• ✓ Rendered into HTML

  • ✓ Rendered into PDF

  • ❏ Rendered into CSV

DSL for printable documents, that is responsible for arranging page graphical elements onto a static doc (typically a PDF, but other formats can be added in the future).

Printable Block Building Code Sample

Basic PDF
def p = new UiPrintableSpecifier().ui {
    printableHeader "3.5cm", {                  (1)
        show new UiShowSpecifier().ui {
            fieldLabeled u.username_            (2)
        }, BlockSpec.Width.THIRD
        show new UiShowSpecifier().ui {
            field """
            <div style="text-align: center;">
                <img style="height: 2.5cm;"
        }, BlockSpec.Width.THIRD
        show new UiShowSpecifier().ui {
            field 'Print Date', new Date().toString(),
        }, BlockSpec.Width.THIRD
    printableBody {                             (3)
        def a = book.author
        show new UiShowSpecifier().ui {
            field """<h1>${book.name}</h1>""",
            fieldUnlabeled Style.MARKDOWN_BODY,
        }, BlockSpec.Width.MAX
        show new UiShowSpecifier().ui {
                fieldLabeled book.isbn_
            section 'Author', {
                fieldLabeled book.author_, a.firstName_
                fieldLabeled book.author_, a.lastName_
        }, BlockSpec.Width.HALF
        show new UiShowSpecifier().ui {
            section 'Stock', {
                fieldLabeled book.number_
                fieldLabeled book.stock_
        }, BlockSpec.Width.HALF
        table bookstoreUiService.buildBorrowedBookTable(),
              BlockSpec.Width.MAX               (4)
    printableFooter {                           (5)
  1. printableHeader allows to define a header that will be repeated on all pages, the height parameter is mandatory if you need a height different from 2cm.

  2. You can use regular show closures

  3. printableBody defines the content of the PDF on many pages.

  4. You can use regular table closures

  5. printableFooter allows to define the footer that will be repeated on all pages the size must not be greater than 2cm.

screenshot pdf

Printable Block DSL Symbols Hierarchy

Figure 1. Symbols hierachy diagram for Printable Block DSL