MCPcopy Index your code
hub / github.com/dhorions/boxable

github.com/dhorions/boxable @1.8.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.8.2 ↗ · + Follow
612 symbols 3,406 edges 86 files 272 documented · 44% updated 4mo ago1.8.2 · 2026-02-13★ 3496 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Boxable - A Java library to build tables in PDF documents.

Java CI with Maven Donate

Boxable is a library that can be used to easily create tables in PDF documents. It uses the PDFBox PDF library under the hood.

Features

  • Build tables in PDF documents
  • Convert CSV data into tables in PDF documents
  • Convert Lists into tables in PDF documents

Boxable supports the following table features

  • HTML tags in cell content (not all! `

,,,

,

    ,
      ,
    1. ,,,

      -

      ,,) - Horizontal & Vertical Alignment of the text - Images inside cells and outside table (image scale is also supported) - Basic set of rendering attributes for lines (borders) - Rotated text (by 90 degrees) - Writing text outside tables - Inner tables using HTML`

      Maven

      <dependency>
          <groupId>com.github.dhorions</groupId>
          <artifactId>boxable</artifactId>
          <version>1.8.2</version>
      </dependency>
      

      For other build systems, check the Maven Central Repository.

      For information about the release process, see RELEASE.md.

      Tutorial

      Comprehensive tutorials are now available in the test package! Each tutorial demonstrates specific features with well-documented, runnable examples:

      Running the Tutorials

      You can run all tutorials at once using the Tutorial Runner:

      mvn test -Dtest=TutorialRunner
      

      Or run individual tutorials:

      mvn test -Dtest=Tutorial01_BasicTable
      

      All generated PDFs will be saved in the target/tutorials/ directory.

      Available Tutorials

      1. Tutorial01_BasicTable - Simple table creation, headers, and cell styling
      2. Tutorial02_HtmlFormatting - All supported HTML tags including <sup> and <sub>
      3. Tutorial03_ColorsAndTransparency - Cell colors, text colors, and alpha channel
      4. Tutorial04_Alignment - Horizontal and vertical text alignment
      5. Tutorial05_Images - Images in cells with scaling and padding control
      6. Tutorial06_BordersAndStyling - Border styles, colors, widths, and selective borders
      7. Tutorial07_HeaderRows - Single and multiple header rows with page repetition
      8. Tutorial08_DataImport - Import data from CSV and Java Lists
      9. Tutorial09_MultiPageTables - Large tables spanning multiple pages
      10. Tutorial10_NestedTables - Tables within cells using HTML <table> tags
      11. Tutorial11_FixedHeightRows - Fixed-height rows with auto-fit text
      12. Tutorial12_AdvancedFeatures - Rotated text, line spacing, and colspan

      Tutorial Source Code

      All tutorial source code is available in src/test/java/be/quodlibet/boxable/tutorial/.

      Each tutorial is self-contained and includes: - Detailed JavaDoc comments explaining the demonstrated features - Well-structured, readable code - Generated PDF output for visual reference

      Wiki Documentation

      Detailed documentation is being created and will be accessible at https://github.com/dhorions/boxable/wiki. If you want to help, please let us know here.

      Usage examples

      Create a PDF from a CSV file

      String data = readData("https://s3.amazonaws.com/misc.quodlibet.be/Boxable/Eurostat_Immigration_Applications.csv");
      BaseTable pdfTable = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true,true);
      DataTable t = new DataTable(pdfTable, page);
      t.addCsvToTable(data, DataTable.HASHEADER, ';');
      pdfTable.draw();
      

      Output : CSVExamplePortrait.pdf

      Create a PDF from a List

      List<List> data = new ArrayList();
      data.add(new ArrayList<>(
                     Arrays.asList("Column One", "Column Two", "Column Three", "Column Four", "Column Five")));
      for (int i = 1; i <= 100; i++) {
        data.add(new ArrayList<>(
            Arrays.asList("Row " + i + " Col One", "Row " + i + " Col Two", "Row " + i + " Col Three", "Row " + i + " Col Four", "Row " + i + " Col Five")));
      }
      BaseTable dataTable = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true, true);
      DataTable t = new DataTable(dataTable, page);
      t.addListToTable(data, DataTable.HASHEADER);
      dataTable.draw();
      

      Output : ListExampleLandscape.pdf

      Build tables in PDF documents

      BaseTable table = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true,
                      drawContent);
      //Create Header row
      Row<PDPage> headerRow = table.createRow(15f);
      Cell<PDPage> cell = headerRow.createCell(100, "Awesome Facts About Belgium");
      cell.setFont(PDType1Font.HELVETICA_BOLD);
      cell.setFillColor(Color.BLACK);
      table.addHeaderRow(headerRow);
      List<String[]> facts = getFacts();
      for (String[] fact : facts) {
                  Row<PDPage> row = table.createRow(10f);
                  cell = row.createCell((100 / 3.0f) * 2, fact[0] );
                  for (int i = 1; i < fact.length; i++) {
                     cell = row.createCell((100 / 9f), fact[i]);
                  }
      }
      table.draw();
      

      Fixed height rows (auto-fit text)

      BaseTable table = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true, true);
      
      // Fixed-height header row (text shrinks to fit)
      Row<PDPage> headerRow = table.createRow(12f);
      headerRow.setFixedHeight(true);
      Cell<PDPage> headerCell = headerRow.createCell(100, "Fixed header with longer text");
      headerCell.setFontSize(14f);
      table.addHeaderRow(headerRow);
      
      // Fixed-height data row (text shrinks to fit)
      Row<PDPage> fixedRow = table.createRow(12f);
      fixedRow.setFixedHeight(true);
      fixedRow.createCell(30, "Fixed row");
      fixedRow.createCell(70, "Some value that should be reduced to fit in 12pt height");
      
      // Flexible row (height grows to fit)
      Row<PDPage> flexibleRow = table.createRow(12f);
      flexibleRow.createCell(30, "Flexible row");
      flexibleRow.createCell(70, "Some value that should keep its font size and expand the row height");
      
      table.draw();
      

      Special Thanks to these awesome contributors : - @joaemel - @johnmanko - @Vobarian - @Giboow - @Ogmios-Voice - @zaqpiotr - Frulenzo - dgautier - ZeerDonker - dobluth - schmitzhermes - lambart

      License

      Copyright 2026 Quodlibet.be

      Source Code : Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

      Bundled Fonts : Liberation Sans fonts are licensed under the SIL Open Font License 1.1. See src/main/resources/fonts/LICENSE for full details.

      By using this library, you agree to comply with both licenses.

      Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Extension points exported contracts — how you extend this code

RowWrappingFunction (Interface)
This interface allows you to specify where in the table page breaks may be inserted. [2 implementers]
src/main/java/be/quodlibet/boxable/RowWrappingFunction.java
UpdateCellProperty (Interface)
Allows changing the cell properties, while the CSV documents is written directly into the PDF tables @author Christoph [1 …
src/main/java/be/quodlibet/boxable/datatable/UpdateCellProperty.java
PageProvider (Interface)
(no doc) [2 implementers]
src/main/java/be/quodlibet/boxable/page/PageProvider.java
CellContentDrawnListener (Interface)
(no doc) [1 implementers]
src/main/java/be/quodlibet/boxable/CellContentDrawnListener.java
WrappingFunction (Interface)
(no doc) [1 implementers]
src/main/java/be/quodlibet/boxable/text/WrappingFunction.java

Core symbols most depended-on inside this repo

createCell
called by 590
src/main/java/be/quodlibet/boxable/Row.java
createRow
called by 339
src/main/java/be/quodlibet/boxable/Table.java
setFillColor
called by 218
src/main/java/be/quodlibet/boxable/Cell.java
setAlign
called by 129
src/main/java/be/quodlibet/boxable/Cell.java
get
called by 128
src/main/java/be/quodlibet/boxable/VerticalAlignment.java
getHeight
called by 125
src/main/java/be/quodlibet/boxable/Row.java
getWidth
called by 112
src/main/java/be/quodlibet/boxable/Row.java
setFontSize
called by 108
src/main/java/be/quodlibet/boxable/Cell.java

Shape

Method 522
Class 81
Interface 5
Enum 4

Languages

Java100%

Modules by API surface

src/main/java/be/quodlibet/boxable/Cell.java75 symbols
src/main/java/be/quodlibet/boxable/Table.java60 symbols
src/main/java/be/quodlibet/boxable/Paragraph.java42 symbols
src/main/java/be/quodlibet/boxable/Row.java35 symbols
src/main/java/be/quodlibet/boxable/TableCell.java25 symbols
src/test/java/be/quodlibet/boxable/TableTest.java21 symbols
src/main/java/be/quodlibet/boxable/datatable/DataTable.java21 symbols
src/main/java/be/quodlibet/boxable/utils/PageContentStreamOptimized.java20 symbols
src/main/java/be/quodlibet/boxable/utils/FontUtils.java17 symbols
src/test/java/be/quodlibet/boxable/DataTableTest.java15 symbols
src/main/java/be/quodlibet/boxable/ImageCell.java15 symbols
src/main/java/be/quodlibet/boxable/image/Image.java14 symbols

For agents

$ claude mcp add boxable \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact