From 1d243a0ca5c62a7812531d981d92feaf819551f4 Mon Sep 17 00:00:00 2001 From: sbplat <71648843+sbplat@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:43:30 -0500 Subject: [PATCH] fix: clean up redundant variable --- src/main/java/stirling/software/SPDF/utils/PdfUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 000a8294..7ae91cf9 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -203,7 +203,6 @@ public class PdfUtils { try (PDDocument document = PDDocument.load(new ByteArrayInputStream(inputStream))) { PDFRenderer pdfRenderer = new PDFRenderer(document); int pageCount = document.getNumberOfPages(); - List images = new ArrayList<>(); // Create a ByteArrayOutputStream to save the image(s) to ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -232,7 +231,8 @@ public class PdfUtils { writer.dispose(); } else { // Combine all images into a single big image - BufferedImage combined = new BufferedImage(images.get(0).getWidth(), images.get(0).getHeight() * pageCount, BufferedImage.TYPE_INT_RGB); + BufferedImage image = pdfRenderer.renderImageWithDPI(0, DPI, colorType); + BufferedImage combined = new BufferedImage(image.getWidth(), image.getHeight() * pageCount, BufferedImage.TYPE_INT_RGB); Graphics g = combined.getGraphics(); for (int i = 0; i < pageCount; ++i) {