From 66b2c073801d08d2fe97e2443d67f2d8d5f0680e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Fri, 19 Mar 2021 09:03:55 +0100 Subject: [PATCH] load into temp file --- .../main/java/org/xbib/graphics/pdfbox/print/PrintUtility.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graphics-pdfbox-print/src/main/java/org/xbib/graphics/pdfbox/print/PrintUtility.java b/graphics-pdfbox-print/src/main/java/org/xbib/graphics/pdfbox/print/PrintUtility.java index c6fd23c..e02ca43 100644 --- a/graphics-pdfbox-print/src/main/java/org/xbib/graphics/pdfbox/print/PrintUtility.java +++ b/graphics-pdfbox-print/src/main/java/org/xbib/graphics/pdfbox/print/PrintUtility.java @@ -1,5 +1,6 @@ package org.xbib.graphics.pdfbox.print; +import org.apache.pdfbox.io.MemoryUsageSetting; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.printing.PDFPageable; @@ -88,7 +89,7 @@ public class PrintUtility { } public static void print(InputStream inputStream, Printer printer) throws Exception { - PDDocument document = PDDocument.load(inputStream); + PDDocument document = PDDocument.load(inputStream, MemoryUsageSetting.setupTempFileOnly()); PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); job.setPrintService(printer.getService());