scale factor changed
This commit is contained in:
@@ -66,8 +66,8 @@ public class PrintingController implements PrintingServerListener {
|
|||||||
public boolean onImageRequest(String printerName, byte[] imageData) {
|
public boolean onImageRequest(String printerName, byte[] imageData) {
|
||||||
if (!this.isPrinterReady(printerName)) return false;
|
if (!this.isPrinterReady(printerName)) return false;
|
||||||
PrinterConnector printer = this.printerConnectorMap.get(printerName);
|
PrinterConnector printer = this.printerConnectorMap.get(printerName);
|
||||||
printer.reconnect();
|
|
||||||
printer.printImage(imageData);
|
printer.printImage(imageData);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,6 @@ public class PrintingController implements PrintingServerListener {
|
|||||||
public boolean onPdfRequest(String printerName, byte[] pdfData) {
|
public boolean onPdfRequest(String printerName, byte[] pdfData) {
|
||||||
if (!this.isPrinterReady(printerName)) return false;
|
if (!this.isPrinterReady(printerName)) return false;
|
||||||
PrinterConnector printer = this.printerConnectorMap.get(printerName);
|
PrinterConnector printer = this.printerConnectorMap.get(printerName);
|
||||||
printer.reconnect();
|
|
||||||
printer.printPdf(pdfData);
|
printer.printPdf(pdfData);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class PrinterConnector implements IPOSListener {
|
|||||||
this.printBitmap(bitmap);
|
this.printBitmap(bitmap);
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
Log.i("ASSEMBLR", ignored.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class PdfToBitmapIterable implements Iterable<Bitmap> {
|
|||||||
@Override
|
@Override
|
||||||
public Bitmap next() {
|
public Bitmap next() {
|
||||||
currentPage = pdfRenderer.openPage(currentIndex);
|
currentPage = pdfRenderer.openPage(currentIndex);
|
||||||
int scaleFactor = 2;
|
int scaleFactor = 5;
|
||||||
if (currentPage.getWidth() < 100) scaleFactor = 100;
|
if (currentPage.getWidth() < 100) scaleFactor = 100;
|
||||||
Bitmap bitmap = Bitmap.createBitmap(currentPage.getWidth() * scaleFactor, currentPage.getHeight() * scaleFactor, Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = Bitmap.createBitmap(currentPage.getWidth() * scaleFactor, currentPage.getHeight() * scaleFactor, Bitmap.Config.ARGB_8888);
|
||||||
currentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
|
currentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class PrintingServer extends AbstractVerticle {
|
|||||||
byte[] pdfBytes = requestBody.getBytes();
|
byte[] pdfBytes = requestBody.getBytes();
|
||||||
booleanResponse = printingServerListener.onPdfRequest(printerName, pdfBytes);
|
booleanResponse = printingServerListener.onPdfRequest(printerName, pdfBytes);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
Log.i("ASSEMBLR", ignored.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObject response = new JsonObject().put("ok", booleanResponse);
|
JsonObject response = new JsonObject().put("ok", booleanResponse);
|
||||||
|
|||||||
Reference in New Issue
Block a user