1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-16 12:20:12 +01:00

fix: clean up redundant variable

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

View File

@ -203,7 +203,6 @@ public class PdfUtils {
try (PDDocument document = PDDocument.load(new ByteArrayInputStream(inputStream))) { try (PDDocument document = PDDocument.load(new ByteArrayInputStream(inputStream))) {
PDFRenderer pdfRenderer = new PDFRenderer(document); PDFRenderer pdfRenderer = new PDFRenderer(document);
int pageCount = document.getNumberOfPages(); int pageCount = document.getNumberOfPages();
List<BufferedImage> images = new ArrayList<>();
// Create a ByteArrayOutputStream to save the image(s) to // Create a ByteArrayOutputStream to save the image(s) to
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
@ -232,7 +231,8 @@ public class PdfUtils {
writer.dispose(); writer.dispose();
} else { } else {
// Combine all images into a single big image // 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(); Graphics g = combined.getGraphics();
for (int i = 0; i < pageCount; ++i) { for (int i = 0; i < pageCount; ++i) {