PDFBox : PDPageContentStream’s append mode misbehaving

Use the constructor that has a fifth parameter, so to reset the graphic context.

public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, 
                            boolean compress, boolean resetContext) throws IOException

alternatively, save and restore the graphics state in the first content stream by calling

saveGraphicsState();
// ...
restoreGraphicsState();

Leave a Comment