SwingToPDF

True vector PDF output from Java Swing components

Convert any JComponent tree into genuine vector PDF. Text stays selectable, graphics stay sharp at any zoom level, and file sizes stay small. Built on Apache PDFBox.

Why SwingToPDF

Everything you need to turn Swing UIs into production-quality PDFs

Genuine Vector Output

Text, shapes, and lines render as native PDF drawing operations — not rasterized images. Output is crisp at any zoom level and a fraction of the file size.

AcroForm Interactive Fields

Export JTextField, JCheckBox, JRadioButton, JComboBox, JTextArea, and JPasswordField as fillable PDF form fields with a single method call.

Rich Text Support

JTextPane and JEditorPane content renders with full formatting preserved — bold, italic, fonts, colors, and HTML.

20+ Component Handlers

Specialized rendering for JTable, JTree, JList, JTabbedPane, JTextPane, JEditorPane, and more. Each component gets purpose-built handling.

Built on Apache PDFBox

No native dependencies, no commercial PDF engine. Pure Java built on the trusted, open-source Apache PDFBox 3.x library.

Dual License

Free under AGPL-3.0 for open-source projects. One-time commercial license available for proprietary applications — no royalties, no recurring fees.

Get Started in Minutes

Add the dependency, write three lines of code, and you have a PDF

Maven Dependency
<dependency>
    <groupId>com.seaglassfoundry</groupId>
    <artifactId>swingtopdf</artifactId>
    <version>1.0.1</version>
</dependency>
Java Usage
import com.seaglassfoundry.swingtopdf.SwingPdfExporter;
import com.seaglassfoundry.swingtopdf.api.PageSize;

// Any JComponent — JPanel, JTable, JTabbedPane...
JPanel panel = buildYourUI();

SwingPdfExporter.from(panel)
    .pageSize(PageSize.A4)
    .margins(36, 36, 36, 36)
    .title("My Report")
    .export(Path.of("report.pdf"));

Licensing

Choose the license that fits your project

AGPL-3.0

Free for open-source projects

  • Full library functionality
  • Community support via GitHub
  • Source disclosure required
  • Derivative works must use AGPL
View on GitHub

Commercial License

For proprietary applications — from $399

  • No source disclosure required
  • One-time fee, perpetual use
  • Developer, Team, and Site tiers
  • Email support included
View Pricing