I print a PDF file using PdfViewer.
I need to print a 5MB file (not so large) 14 pages.
Because of an open issue the printing quality is very poor.
I changed the resolution using viewer.setResolution(600);
In order to execute such operation it takes 4GB of memory and goes into a huge garbage collection.
The printig operation take more than 3 minutes before the printer is activated.
Could You provide a solution ?
Any suggestion ?
Tks
Tullio
public void print(byte[] xpDocument, String xpPrinterName, int xpCopies) throws IOException {
LOGGER.info("Print step 1");
Document doc = new Document(new ByteArrayInputStream(xpDocument));
LOGGER.info("Print step 2");
PdfViewer viewer = new PdfViewer();
LOGGER.info("Print step 3");
viewer.setResolution(600);
viewer.bindPdf(doc);
viewer.setPrintPageDialog(false);
if(xpPrinterName == null) {
viewer.printDocument();
} else {
LOGGER.info("Print step 4");
PdfPrinterSettings settings = viewer.getDefaultPrinterSettings();
LOGGER.info("Print step 5");
settings.setCopies((short)xpCopies);
settings.setPrinterName(xpPrinterName);
viewer.printDocumentWithSettings(settings);
LOGGER.info("Print step 6");
}
}