perf: avoid re-rendering the first pdf page

This commit is contained in:
sbplat 2023-12-27 22:46:55 -05:00 committed by GitHub
parent 1d243a0ca5
commit d405b7a810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,7 +236,9 @@ public class PdfUtils {
Graphics g = combined.getGraphics(); Graphics g = combined.getGraphics();
for (int i = 0; i < pageCount; ++i) { for (int i = 0; i < pageCount; ++i) {
BufferedImage image = pdfRenderer.renderImageWithDPI(i, DPI, colorType); if (i != 0) {
image = pdfRenderer.renderImageWithDPI(i, DPI, colorType);
}
g.drawImage(image, 0, i * image.getHeight(), null); g.drawImage(image, 0, i * image.getHeight(), null);
} }