Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

PdfStamper with append = true drastically improves performance, even though JavaDoc says "nothing is gained in speed or memory"?

Open
#1,598 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
java
Domain
backend

Research direction

Start by reading the PdfStamper constructor JavaDoc and the implementation of the constructor that accepts the append flag. Compare how append and normal stamping handle the described PDF changes, then check whether the documentation’s performance claim is accurate and identify any side effects. The issue does not name relevant files or tests, so locating the behavior will require reading around the stamper implementation.

Written by the indexing model from the issue text.

Description

I was facing a bad performance on using PdfStamper on a certain PDF. The PDF contained 45 pages with 23k objects (partially heavy illustrations) and took 80 seconds to complete adding a simple text on all pages.
I was using the general PdfStamper constructor, but then tried using the constructor that sets the append flag:

PdfStamper stamp = new PdfStamper(reader, fos, "\0", true);  // tried append = true

Suddenly, execution time is reduced from 70 seconds to 5 seconds, which is quite amazing.
What is confusing me is the following comment in the JavaDoc of the respective constructor:

* @param append     if <CODE>true</CODE> appends the document changes as a new revision. This is only useful for
     *                   multiple signatures as nothing is gained in speed or memory

It claims that there should be no performance impact.

Can anyone clarify

  • whether the JavaDoc is simply outdated?
  • whether there can be any side effects when using append?
Dominant language
Java
Stars
4.4k
Forks
714
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LibrePDF/OpenPDF

All issues in LibrePDF/OpenPDF

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.