diff --git a/src/main/java/tigerworkshop/webapphardwarebridge/websocketservices/PrinterWebSocketService.java b/src/main/java/tigerworkshop/webapphardwarebridge/websocketservices/PrinterWebSocketService.java index 3194d7e..d024087 100644 --- a/src/main/java/tigerworkshop/webapphardwarebridge/websocketservices/PrinterWebSocketService.java +++ b/src/main/java/tigerworkshop/webapphardwarebridge/websocketservices/PrinterWebSocketService.java @@ -174,12 +174,17 @@ private void printImage(PrintDocument printDocument) throws PrinterException, IO job.setPrintService(docPrintJob.getPrintService()); PageFormat pageFormat = job.defaultPage(); - logger.trace("Paper Size: " + pageFormat.getWidth() + " x " + pageFormat.getHeight()); - logger.trace("Imageable Size:" + pageFormat.getImageableWidth() + " x " + pageFormat.getImageableHeight()); + logger.debug("Driver Returned PageFormat Size: " + pageFormat.getWidth() + " x " + pageFormat.getHeight()); + logger.debug("Driver Returned PageFormat Imageable Size:" + pageFormat.getImageableWidth() + " x " + pageFormat.getImageableHeight()); + logger.debug("Driver Returned Paper Size: " + pageFormat.getPaper().getWidth() + " x " + pageFormat.getPaper().getHeight()); + logger.debug("Driver Returned Paper Imageable Size: " + pageFormat.getPaper().getImageableWidth() + " x " + pageFormat.getPaper().getImageableHeight()); - Paper paper = pageFormat.getPaper(); double width = pageFormat.getWidth(); double height = pageFormat.getHeight(); + + Paper paper = pageFormat.getPaper(); + + // Reset Imageable Area paper.setSize(width, height); paper.setImageableArea(0, 0, width, height); pageFormat.setPaper(paper); @@ -220,13 +225,17 @@ private void printPDF(PrintDocument printDocument) throws PrinterException, IOEx job.setPrintService(docPrintJob.getPrintService()); PageFormat pageFormat = job.defaultPage(); - logger.trace("Paper Size: " + pageFormat.getWidth() + " x " + pageFormat.getHeight()); - logger.trace("Imageable Size:" + pageFormat.getImageableWidth() + " x " + pageFormat.getImageableHeight()); + logger.debug("Driver Returned PageFormat Size: " + pageFormat.getWidth() + " x " + pageFormat.getHeight()); + logger.debug("Driver Returned PageFormat Imageable Size:" + pageFormat.getImageableWidth() + " x " + pageFormat.getImageableHeight()); + logger.debug("Driver Returned Paper Size: " + pageFormat.getPaper().getWidth() + " x " + pageFormat.getPaper().getHeight()); + logger.debug("Driver Returned Paper Imageable Size: " + pageFormat.getPaper().getImageableWidth() + " x " + pageFormat.getPaper().getImageableHeight()); - Paper paper = pageFormat.getPaper(); double width = pageFormat.getWidth(); double height = pageFormat.getHeight(); + + Paper paper = pageFormat.getPaper(); + // Reset Imageable Area paper.setSize(width, height); paper.setImageableArea(0, 0, width, height); diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index a04eb3c..8e6a09d 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -18,7 +18,7 @@ - +