Generating PDFs in Java: four libraries compared

Five business documents and a batch of letters, made by each library the way its own documentation shows, every PDF checked, in IBM Plex Sans, and all of them again in Noto Sans. The other measurements, the features of each library, the method and the tables of every figure are further down this page.

I wrote PDFjet, one of the four libraries compared here, and have been updating it since 2001. For the last two months I have worked on it using Claude. I commissioned this benchmark; Claude chose the documents, their content and the way each library is used, wrote the programs, ran them and wrote the tables. Both are reasons to be suspicious of the results, so everything needed to check them is published in github.com/edragoev1/pdf-libs-benchmarks: the specification of the documents, every program, the scripts that run and check them, and the raw results.

If we have configured a library badly, or used it in a way its users would not, please tell us or open an issue, and we will fix the configuration and run the benchmark again.

PDFjet's fonts:

PDFjet reads both font formats. .otf fonts make smaller PDFs; the default results use .otf. Only PDFjet's figures change.

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

Time per document. These tests use IBM Plex Sans.

Invoice, 1 page

warm, ms

PDFBox3.1
iText4.5
OpenPDF2.6
PDFjet1.2

Statement, 12 pages

warm, ms

PDFBox5.8
iText68.6
OpenPDF17.6
PDFjet3.4

Report, 18 pages

warm, ms

PDFBox151.8
iText24.3
OpenPDF5.9
PDFjet4.9

Multilingual notice

warm, ms

PDFBox2.0
iText2.5
OpenPDF1.4
PDFjet0.8

1,000 letters, SVG logo

warm, s

PDFBox1.28
iText1.92
OpenPDF1.00
PDFjet0.63

Invoice, 1 page

warm, ms

PDFBox3.1
iText4.5
OpenPDF2.6
PDFjet1.5

Statement, 12 pages

warm, ms

PDFBox5.8
iText68.6
OpenPDF17.6
PDFjet3.5

Report, 18 pages

warm, ms

PDFBox151.8
iText24.3
OpenPDF5.9
PDFjet5.2

Multilingual notice

warm, ms

PDFBox2.0
iText2.5
OpenPDF1.4
PDFjet1.2

1,000 letters, SVG logo

warm, s

PDFBox1.28
iText1.92
OpenPDF1.00
PDFjet0.74

Time per document, Noto Sans. These tests use Noto Sans, which has many more glyphs than IBM Plex Sans.

Invoice, Noto Sans

warm, ms

PDFBox3.1
iText5.9
OpenPDF3.5
PDFjet1.6

Statement, Noto Sans

warm, ms

PDFBox5.5
iText75.4
OpenPDF18.4
PDFjet3.7

Report, Noto Sans

warm, ms

PDFBox150.0
iText28.9
OpenPDF6.8
PDFjet5.7

Multilingual, Noto Sans

warm, ms

PDFBox1.7
iText4.2
OpenPDF2.0
PDFjet1.1

1,000 letters, SVG logo

warm, s

PDFBox1.25
iText3.08
OpenPDF1.85
PDFjet0.99

Invoice, Noto Sans

warm, ms

PDFBox3.1
iText5.9
OpenPDF3.5
PDFjet1.5

Statement, Noto Sans

warm, ms

PDFBox5.5
iText75.4
OpenPDF18.4
PDFjet3.6

Report, Noto Sans

warm, ms

PDFBox150.0
iText28.9
OpenPDF6.8
PDFjet5.5

Multilingual, Noto Sans

warm, ms

PDFBox1.7
iText4.2
OpenPDF2.0
PDFjet1.2

1,000 letters, SVG logo

warm, s

PDFBox1.25
iText3.08
OpenPDF1.85
PDFjet0.85

The size of the PDFs and memory

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

The size of the PDFs. These tests use IBM Plex Sans.

Size, the invoice

KB

PDFBox19
iText24
OpenPDF22
PDFjet17

Size, the statement

KB

PDFBox42
iText62
OpenPDF59
PDFjet40

Size, the report

KB

PDFBox1,816
iText1,824
OpenPDF1,817
PDFjet1,816

Size, the notice

KB

PDFBox22
iText30
OpenPDF25
PDFjet19

Size, one letter

KB

PDFBox11
iText17
OpenPDF15
PDFjet12

Size, the invoice

KB

PDFBox19
iText24
OpenPDF22
PDFjet22

Size, the statement

KB

PDFBox42
iText62
OpenPDF59
PDFjet44

Size, the report

KB

PDFBox1,816
iText1,824
OpenPDF1,817
PDFjet1,820

Size, the notice

KB

PDFBox22
iText30
OpenPDF25
PDFjet26

Size, one letter

KB

PDFBox11
iText17
OpenPDF15
PDFjet15

Memory allocated per document. These tests use IBM Plex Sans.

Memory, the invoice

MB allocated

PDFBox1.5
iText3.6
OpenPDF2.2
PDFjet1.7

Memory, the statement

MB allocated

PDFBox5.6
iText71.6
OpenPDF56.0
PDFjet2.6

Memory, the report

MB allocated

PDFBox29.8
iText26.8
OpenPDF13.4
PDFjet12.2

Memory, the notice

MB allocated

PDFBox1.8
iText1.8
OpenPDF0.6
PDFjet1.2

Memory, one letter

MB allocated

PDFBox1.4
iText2.4
OpenPDF0.5
PDFjet1.2

Memory, the invoice

MB allocated

PDFBox1.5
iText3.6
OpenPDF2.2
PDFjet1.5

Memory, the statement

MB allocated

PDFBox5.6
iText71.6
OpenPDF56.0
PDFjet2.4

Memory, the report

MB allocated

PDFBox29.8
iText26.8
OpenPDF13.4
PDFjet12.0

Memory, the notice

MB allocated

PDFBox1.8
iText1.8
OpenPDF0.6
PDFjet1.0

Memory, one letter

MB allocated

PDFBox1.4
iText2.4
OpenPDF0.5
PDFjet1.0

The first PDF of a fresh process

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

The first PDF of a fresh process, as on a cold start. These tests use IBM Plex Sans.

The invoice

first PDF, ms

PDFBox191.0
iText248.9
OpenPDF189.9
PDFjet50.7

The statement

first PDF, ms

PDFBox202.9
iText534.4
OpenPDF255.8
PDFjet66.7

The report

first PDF, ms

PDFBox398.6
iText367.9
OpenPDF184.3
PDFjet83.0

The notice

first PDF, ms

PDFBox160.8
iText206.6
OpenPDF127.9
PDFjet38.6

The first letter

first PDF, ms

PDFBox320.6
iText354.4
OpenPDF432.0
PDFjet40.9

The invoice

first PDF, ms

PDFBox191.0
iText248.9
OpenPDF189.9
PDFjet49.5

The statement

first PDF, ms

PDFBox202.9
iText534.4
OpenPDF255.8
PDFjet65.7

The report

first PDF, ms

PDFBox398.6
iText367.9
OpenPDF184.3
PDFjet82.6

The notice

first PDF, ms

PDFBox160.8
iText206.6
OpenPDF127.9
PDFjet37.9

The first letter

first PDF, ms

PDFBox320.6
iText354.4
OpenPDF432.0
PDFjet39.4

The peak memory of a fresh process, making its first PDF. These tests use IBM Plex Sans.

The invoice

peak MB, the process

PDFBox81
iText91
OpenPDF83
PDFjet54

The statement

peak MB, the process

PDFBox91
iText170
OpenPDF135
PDFjet59

The report

peak MB, the process

PDFBox116
iText139
OpenPDF101
PDFjet72

The notice

peak MB, the process

PDFBox80
iText85
OpenPDF71
PDFjet54

The first letter

peak MB, the process

PDFBox107
iText136
OpenPDF140
PDFjet55

The invoice

peak MB, the process

PDFBox81
iText91
OpenPDF83
PDFjet54

The statement

peak MB, the process

PDFBox91
iText170
OpenPDF135
PDFjet60

The report

peak MB, the process

PDFBox116
iText139
OpenPDF101
PDFjet71

The notice

peak MB, the process

PDFBox80
iText85
OpenPDF71
PDFjet53

The first letter

peak MB, the process

PDFBox107
iText136
OpenPDF140
PDFjet54

The lines of code of the programs

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

Lines of code of each program. Without blank lines and comments.

The invoice

lines

PDFBox28
iText39
OpenPDF57
PDFjet31

The statement

lines

PDFBox26
iText30
OpenPDF37
PDFjet32

The report

lines

PDFBox53
iText22
OpenPDF32
PDFjet32

The notice

lines

PDFBox24
iText17
OpenPDF23
PDFjet17

The letters

lines

PDFBox34
iText17
OpenPDF32
PDFjet20

The helpers the programs share, and the total. The helpers are counted in the total.

The helpers

lines

PDFBox91
iText45
OpenPDF65
PDFjet37

All the programs

lines

PDFBox256
iText170
OpenPDF246
PDFjet169

PDFjet in Java, C#, Go and Swift

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

Time per document, the four ports. These tests use IBM Plex Sans.

Invoice, 1 page

warm, ms

Java1.2
C#0.9
Go1.1
Swift1.8

Statement, 12 pages

warm, ms

Java3.4
C#2.9
Go2.9
Swift6.4

Report, 18 pages

warm, ms

Java4.9
C#6.7
Go5.6
Swift13.9

Multilingual notice

warm, ms

Java0.8
C#0.6
Go0.8
Swift1.5

1,000 letters, SVG logo

warm, s

Java0.63
C#0.55
Go0.66
Swift1.47

Invoice, 1 page

warm, ms

Java1.5
C#1.0
Go1.4
Swift1.7

Statement, 12 pages

warm, ms

Java3.5
C#3.0
Go3.0
Swift6.6

Report, 18 pages

warm, ms

Java5.2
C#7.4
Go6.0
Swift13.4

Multilingual notice

warm, ms

Java1.2
C#0.8
Go1.0
Swift1.5

1,000 letters, SVG logo

warm, s

Java0.74
C#0.57
Go0.86
Swift1.45

Time per document, Noto Sans, the four ports. These tests use Noto Sans, which has many more glyphs than IBM Plex Sans.

Invoice, Noto Sans

warm, ms

Java1.6
C#1.5
Go1.5
Swift3.0

Statement, Noto Sans

warm, ms

Java3.7
C#3.6
Go3.2
Swift7.8

Report, Noto Sans

warm, ms

Java5.7
C#7.7
Go6.0
Swift15.2

Multilingual, Noto Sans

warm, ms

Java1.1
C#1.1
Go1.2
Swift2.1

1,000 letters, SVG logo

warm, s

Java0.99
C#1.02
Go1.02
Swift2.17

Invoice, Noto Sans

warm, ms

Java1.5
C#1.1
Go1.6
Swift1.8

Statement, Noto Sans

warm, ms

Java3.6
C#3.4
Go3.4
Swift7.2

Report, Noto Sans

warm, ms

Java5.5
C#8.0
Go6.3
Swift14.7

Multilingual, Noto Sans

warm, ms

Java1.2
C#0.9
Go1.3
Swift1.7

1,000 letters, SVG logo

warm, s

Java0.85
C#0.82
Go1.16
Swift1.77

PDFjet in Java, C#, Go and Swift: the size of the PDFs and memory

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

The size of the PDFs, the four ports. These tests use IBM Plex Sans.

Size, the invoice

KB

Java17
C#17
Go18
Swift18

Size, the statement

KB

Java40
C#40
Go41
Swift45

Size, the report

KB

Java1,816
C#1,815
Go1,816
Swift1,817

Size, the notice

KB

Java19
C#19
Go19
Swift20

Size, one letter

KB

Java12
C#12
Go12
Swift12

Size, the invoice

KB

Java22
C#22
Go22
Swift23

Size, the statement

KB

Java44
C#43
Go44
Swift49

Size, the report

KB

Java1,820
C#1,819
Go1,820
Swift1,822

Size, the notice

KB

Java26
C#26
Go27
Swift28

Size, one letter

KB

Java15
C#15
Go15
Swift15

Memory allocated per document, the four ports. These tests use IBM Plex Sans.

Memory, the invoice

MB allocated

Java1.7
C#1.6
Go1.1
Swift3.9

Memory, the statement

MB allocated

Java2.6
C#2.3
Go1.8
Swift5.0

Memory, the report

MB allocated

Java12.2
C#12.7
Go8.6
Swift18.0

Memory, the notice

MB allocated

Java1.2
C#1.3
Go0.8
Swift2.7

Memory, one letter

MB allocated

Java1.2
C#1.2
Go0.9
Swift2.6

Memory, the invoice

MB allocated

Java1.5
C#1.4
Go2.6
Swift4.0

Memory, the statement

MB allocated

Java2.4
C#2.0
Go2.2
Swift5.1

Memory, the report

MB allocated

Java12.0
C#12.5
Go9.0
Swift18.1

Memory, the notice

MB allocated

Java1.0
C#1.0
Go1.3
Swift2.8

Memory, one letter

MB allocated

Java1.0
C#0.9
Go1.5
Swift2.7

PDFjet in Java, C#, Go and Swift: the first PDF

Lower is better, and the best is in navy. Each chart starts at zero and is scaled to its own largest value.

The first PDF of a fresh process, as on a cold start, the four ports. These tests use IBM Plex Sans.

The invoice

first PDF, ms

Java50.7
C#58.5
Go3.1
Swift3.4

The statement

first PDF, ms

Java66.7
C#54.3
Go4.6
Swift9.7

The report

first PDF, ms

Java83.0
C#71.4
Go8.5
Swift18.8

The notice

first PDF, ms

Java38.6
C#45.2
Go2.3
Swift5.2

The first letter

first PDF, ms

Java40.9
C#60.3
Go2.0
Swift3.1

The invoice

first PDF, ms

Java49.5
C#54.7
Go3.4
Swift3.4

The statement

first PDF, ms

Java65.7
C#50.5
Go4.7
Swift9.7

The report

first PDF, ms

Java82.6
C#67.7
Go8.3
Swift18.9

The notice

first PDF, ms

Java37.9
C#41.7
Go2.6
Swift5.3

The first letter

first PDF, ms

Java39.4
C#56.0
Go2.2
Swift3.1

The peak memory of a fresh process, making its first PDF. These tests use IBM Plex Sans.

The invoice

peak MB, the process

Java54
C#45
Go9
Swift29

The statement

peak MB, the process

Java59
C#45
Go9
Swift33

The report

peak MB, the process

Java72
C#54
Go14
Swift34

The notice

peak MB, the process

Java54
C#44
Go8
Swift28

The first letter

peak MB, the process

Java55
C#45
Go9
Swift28

The invoice

peak MB, the process

Java54
C#45
Go10
Swift28

The statement

peak MB, the process

Java60
C#45
Go10
Swift33

The report

peak MB, the process

Java71
C#54
Go14
Swift34

The notice

peak MB, the process

Java53
C#44
Go9
Swift28

The first letter

peak MB, the process

Java54
C#44
Go9
Swift28

The libraries

LibraryVersionLicenseJava
PDFjet (core)9.1.9MIT8 and later
Apache PDFBox3.0.8Apache 2.08 and later
iText Core9.8.0AGPL-3.0 or commercial8 and later
OpenPDF3.0.5LGPL-2.1 or MPL-2.021 and later

The newest releases on Maven Central on 5 November 2026, and PDFjet 9.1.9, released on 17 November. For the letters with an SVG logo, the modules the others need to draw SVG, each at its newest release: iText's svg module 9.8.0, Apache Batik 1.20, and for PDFBox the pdfbox-graphics2d bridge 3.0.5.

Each library is used the way its own documentation shows: iText's and OpenPDF's Document for flowing text, PDFBox's content streams with lines wrapped by hand, as it has no layout of its own, and PDFjet's TextFrame and Table, BigTable for the statement, and for the report TextFlow. Every program reads the font files from disk once, into memory, and each document makes its fonts from those bytes, as a server would: iText and OpenPDF with their own default caches, PDFBox with its TrueType font parsed once and reused, as its API allows; PDFjet has no font cache and parses the bytes for each document. We ran iText both with its font cache and without it: without it, iText takes 1 to 5 ms more per document. The results here are with font caching.

Features

What each library has, as of the versions above, from its source at the release tag, its Maven POM and its documentation; only the features the documents use were tested here. A module is another jar of the same project; an add-on is a separate product of the same company.

PDFBox has no table of its own, so its programs here draw the tables by hand: a gray box behind the header, each cell's text measured to align the numbers right, a rule under each row, the header again on each new page, and the page numbers in a second pass once the pages are counted.

* PDFjet does not shape these scripts itself. Your program shapes the text with a text engine (Java's and Apple's are built in; HarfBuzz or go-text in .NET and Go), and PDFjet draws the glyphs it found as outlines. They look the same on every screen and in print, and screen readers read them in a tagged PDF, but the text cannot be selected, copied or searched. Lines break at spaces only: Khmer, Thai, Lao and Burmese need a line breaker such as ICU's.

The other jars each of the others needs at run time, from its POM: PDFBox pdfbox-io, fontbox and commons-logging; iText io, commons, jackson-databind, slf4j-api and bouncy-castle-connector, and its layout jar for tables and flowing text; OpenPDF none: Maven adds brotli4j, its service jar and a native jar for the platform, needed only for Brotli compression (OpenPDF ran here without them). pdfHTML, pdfSweep and pdfOCR are iText add-ons under the same terms as iText Core, AGPL or commercial; pdfCalligraph, pdfRender and pdfXFA are commercial only. PDFjet Pro is PDFjet's add-on, commercial.

Far more people have worked on PDFBox, iText and OpenPDF than on PDFjet, and far more people use them, with more answers on the web for every question; iText also has a company behind it with paid support.

FeaturePDFBoxiTextOpenPDFPDFjet
Tablesnolayout module✓✓
Text wrapped into paragraphsno, by handlayout module✓✓
Text flowing onto new pagesnolayout module✓✓
Tagged PDF, PDF/UA-1by hand: your code builds the structure tree, numbers the marked content and builds the parent tree✓ tags; pdfua module for PDF/UAby hand: your code marks the content of each element; OpenPDF builds the parent tree✓
PDF/UA-2nopdfua modulenono
PDF/Aby hand; xmpbox module for the metadatapdfa module, 1a to 4f1a to 3u1a to 3b
SVGthrough Apache Batik and pdfbox-graphics2dsvg modulethrough Apache Batik✓
Barcodes, 1Dnobarcodes module✓✓
QR codesnobarcodes moduleno✓
Data Matrixnobarcodes module✓✓
PDF417nobarcodes module✓✓
Chartsnononobar, line, scatter, donut
Markdown to PDFnonono✓
HTML to PDFnopdfHTML add-onopenpdf-html moduleno
ImagesJPEG, PNG, GIF, BMP, TIFFthose, WMF, JPEG 2000, JBIG2; WebP with the webp-image-support modulethose, WMF, JPEG 2000JPEG, PNG, BMP
OpenType fonts of CFF outlines (.otf), embedded as subsetsno: its TrueType parser refuses them, and its OpenType parser loads them but cannot subset them; embedded whole, the statement in IBM Plex Sans's .otf was 205 KB and MuPDF warned of the font's type✓✓✓
KerningnopdfCalligraph, commercialthe old kern table only, which neither font here has; GPOS through Java AWT or Apache FOP✓
Ligatures (GSUB)✓ by default, turned off herepdfCalligraph, commercialthrough Java AWT or Apache FOPno
ArabicnopdfCalligraph, commercial✓✓
Hindi, Khmer and other complex scriptsDevanagari, Bengali, Gujarati, without mark positioning; not KhmerpdfCalligraph, commercialthrough Java AWT or Apache FOPas outlines, shaped by Java's text engine (9.1.9) *
Hyphenationnohyph module✓ patterns not includedsoft hyphens; five languages in Pro, commercial
Extract text✓✓✓no
Render a page to an image✓pdfRender, commercialopenpdf-renderer moduleno
Change existing PDFs✓✓✓add content, merge, split
Fill or create form fields✓forms module✓no
Digital signatures✓ with Bouncy Castlesign module, with Bouncy Castle✓ with Bouncy Castle, PKCS #7, not PAdESPro, commercial
Long-term signatures, PAdES B-LT and B-LTAby copying its example code (AddValidationInformation), not in the librarysign modulenoPro, commercial
Password encryption, AES-256✓✓✓✓
Certificate encryption✓ with Bouncy Castle✓ with Bouncy Castle✓ with Bouncy Castleno
PDF 2.0a 2.0 header, setVersion✓a 2.0 header by defaultno, PDF 1.7
Object streams, for smaller files✓ by default✓ an option✓ an optionno
RedactionnopdfSweep add-onnono
OCRnopdfOCR add-onnono
XFA formsreads the datafills the data, forms module; flattens, pdfXFA, commercialreads, fills the datano
Electronic invoices: ZUGFeRD, Factur-X, XRechnungby hand: PDF/A-3 with the XML attachedby hand, with the pdfa moduleby handPro, commercial
Check existing files for PDF/Apreflight module, PDF/A-1bnonono
No other jars needednono✓; Maven adds brotli4j, needed only for Brotli compression✓
Java8 and later8 and later21 and later8 and later
Also for—.NET—.NET, Go, Swift
LicenseApache 2.0AGPL-3.0 or commercialLGPL-2.1 or MPL-2.0MIT

What was measured

Five tasks, specified exactly in SPEC.md, the same text and the same layout in every library:

All in IBM Plex Sans, embedded as subsets, and all again in Noto Sans, a much larger font.

The fonts. Each library reads the font files it does best with: PDFjet the .otf files, the others the .ttf files (SPEC.md says why). The switch at the top of the web page, and the PDF's pages "PDFjet on the .ttf files", show PDFjet on the .ttf files too: a second run of everything the same night, its PDFjet figures shown beside the other libraries' figures of the first run. Both runs' raw results are published.

Method. Each library in its own fresh JVM, in a random order, three rounds; within a JVM the tasks run in the same fixed order for every library. Each task is warmed up for at least 20 runs and 3 seconds, then timed over 15 runs (the letters: 2 warm-up batches, 5 timed); the figure is the median of the three round medians. An asterisk (*) marks a figure whose rounds differ by more than 5%. The first PDF of a fresh process is the median of 5 processes. OpenJDK 25, .NET 10, Go 1.27, Swift 6.4, on an AMD Ryzen 5 5600G with Linux, after a reboot, in the performance power profile, nothing else running. After the run every PDF is checked, and the log is published: MuPDF opens it with no warning, it has the expected pages, the check strings of SPEC.md are in its text (the last sentence of every language for the notice), both fonts are embedded as subsets, and qpdf --check passes.

Results

Every measurement is drawn as a chart above, and the tables of every figure, with PDFjet in C#, Go and Swift beside the four libraries, are in the appendix at the end.

To draw the SVG logo the others need another module or library, and each was given the one its users would choose:

Libraryto draw SVG it needs
PDFBoxApache Batik and pdfbox-graphics2d
iTextiText's svg module
OpenPDFApache Batik
PDFjetnothing else

PDFjet in C#, Go and Swift

PDFjet is also written in C#, Go and Swift: the same classes and the same public API in each, and the same documents laid out the same way, which an automated check compares on every change. The last three columns of the tables in the appendix are the same documents made by each of them. For a program that makes PDFs, what counts is what the port of its language makes, and how fast: that is what those columns show.

Each port compresses its pages with the Deflate its language offers, but for Swift: Swift offers none on Linux, so the Swift port has an encoder of its own, which searches less than zlib. Its PDFs, the largest of the four, are larger because of that encoder, not because of Swift.

Reproduce it

Everything is in github.com/edragoev1/pdf-libs-benchmarks: SPEC.md, the text of the notice, the logo and the photos, the program of each library and port, the run and check scripts, and the raw results with their logs. java/run.sh runs the four Java libraries (about 15 minutes) and java/check.sh checks every PDF; run-all.sh runs everything, as for these results; dotnet/, go/ and swift/ run PDFjet's other ports the same way; make-tables.py makes every table of this report from the results.

Judgment calls

Appendix: the tables

Time per document, IBM Plex Sans

Time per document, warm, ms (the letters: the batch of 1,000, s). In every table lower is better, faster, less memory, smaller files, fewer lines, and the best of the four Java libraries is in bold. The last three columns are PDFjet in C#, Go and Swift, shown with them but not ranked against them.

DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice, 1 page3.14.52.61.20.91.1 *1.8 *
statement, 12 pages5.8 *68.6 *17.6 *3.42.92.9 *6.4
statement, PDFjet's Table———4.04.5 *4.0 *9.9
report, 18 pages151.824.35.94.96.7 *5.6 *13.9
multilingual, 1 page2.02.51.40.80.60.8 *1.5
the 1,000 letters, PNG logo, s2.491.991.901.090.911.111.38
the 1,000 letters, SVG logo, s1.281.921.000.630.550.661.47
DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice, 1 page3.14.52.61.51.01.41.7 *
statement, 12 pages5.8 *68.6 *17.6 *3.53.03.0 *6.6
statement, PDFjet's Table———4.24.84.29.8
report, 18 pages151.824.35.95.27.4 *6.013.4
multilingual, 1 page2.02.51.41.20.81.0 *1.5
the 1,000 letters, PNG logo, s2.491.991.901.200.931.291.36
the 1,000 letters, SVG logo, s1.281.921.000.740.570.861.45

* The three rounds of this figure differ by more than 5%; the figure is their median.

Time per document, Noto Sans

With Noto Sans, a large font, ms (the letters: the batch of 1,000, s):

DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice3.1 *5.93.51.61.5 *1.5 *3.0
statement5.575.4 *18.4 *3.73.63.2 *7.8
statement, PDFjet's Table———4.45.44.4 *11.2
report150.028.9 *6.85.7 *7.7 *6.015.2
multilingual1.74.22.01.11.1 *1.2 *2.1
the 1,000 letters, SVG logo, s1.25 *3.081.850.991.02 *1.02 *2.17
DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice3.1 *5.93.51.51.11.6 *1.8 *
statement5.575.4 *18.4 *3.63.4 *3.4 *7.2
statement, PDFjet's Table———4.3 *5.04.6 *11.1
report150.028.9 *6.85.58.0 *6.3 *14.7
multilingual1.74.22.01.20.9 *1.3 *1.7
the 1,000 letters, SVG logo, s1.25 *3.081.850.850.821.16 *1.77

* The three rounds of this figure differ by more than 5%; the figure is their median.

The size of the PDFs

The size of the PDFs, KB:

DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice19242217171818
statement42625940404145
statement, PDFjet's Table———41404145
report1,8161,8241,8171,8161,8151,8161,817
multilingual22302519191920
one letter11171512121212
DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice19242222222223
statement42625944434449
statement, PDFjet's Table———44444450
report1,8161,8241,8171,8201,8191,8201,822
multilingual22302526262728
one letter11171515151515

Memory allocated per document

Memory allocated per document, MB. Each runtime counts it its own way: Java and C# the bytes the timing thread allocates, Go every allocation of the process (Go's TotalAlloc), Swift every malloc of the thread:

DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice1.53.62.21.71.61.13.9
statement5.671.656.02.62.31.85.0
statement, PDFjet's Table———5.16.03.57.7
report29.826.813.412.212.78.618.0
multilingual1.81.80.61.21.30.82.7
one letter1.42.40.51.21.20.92.6
DocumentPDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
invoice1.53.62.21.51.42.64.0
statement5.671.656.02.42.02.25.1
statement, PDFjet's Table———4.95.85.07.8
report29.826.813.412.012.59.018.1
multilingual1.81.80.61.01.01.32.8
one letter1.42.40.51.00.91.52.7

The first PDF of a process

The first PDF of a fresh process, each of the five documents, as a serverless function or a newly started container pays it on a cold start, or a desktop app on its first export, ms; then the peak memory of the whole process, mostly the JVM itself, MB:

PDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
the invoice, ms191.0248.9189.950.758.53.13.4
the statement, ms202.9534.4255.866.754.34.69.7
the report, ms398.6367.9184.383.071.48.518.8
the notice, ms160.8206.6127.938.645.22.35.2
the first letter, ms320.6354.4432.040.960.32.03.1
the invoice, the whole process, ms2403002408090under 1010
the invoice, peak memory, MB8191835445929
the statement, peak memory, MB911701355945933
the report, peak memory, MB11613910172541434
the notice, peak memory, MB8085715444828
the first letter, peak memory, MB1071361405545928
PDFBoxiTextOpenPDFPDFjet JavaPDFjet C#PDFjet GoPDFjet Swift
the invoice, ms191.0248.9189.949.554.73.43.4
the statement, ms202.9534.4255.865.750.54.79.7
the report, ms398.6367.9184.382.667.78.318.9
the notice, ms160.8206.6127.937.941.72.65.3
the first letter, ms320.6354.4432.039.456.02.23.1
the invoice, the whole process, ms2403002408080under 1010
the invoice, peak memory, MB81918354451028
the statement, peak memory, MB9117013560451033
the report, peak memory, MB11613910171541434
the notice, peak memory, MB8085715344928
the first letter, peak memory, MB1071361405444928

Lines of code

Lines of code of each program, without blank lines and comments; "helpers" are the methods a library's tasks share (fonts, cells, footers, word wrapping), counted in the total:

invoicestatementreportlettersmultilingualhelperstotal
PDFBox282653342491256
iText393022171745170
OpenPDF573732322365246
PDFjet Java313232201737169
PDFjet C#323232201735168
PDFjet Go363635262035188
PDFjet Swift292731181545165