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