Android print image using BIXOLON SPP-R300 - android

I'm developing application which prints image using Bixolon SPP-R300 mobile printer via Bluetooth.My problem is I can't print my image on whole width of paper. Printer decreases dimensions very much, but saved pictures dimensions in Android is well.I want to print image on whole width.I looked in users manual of Bixolon for android but didn't help. Also in internet there is no information about it.So, I don't know what to do. Here is a code snippet from my project which prints image:
mBxlService = new BxlService();
mBxlService.Connect();
if (mBxlService.GetStatus() == BxlService.BXL_SUCCESS) {
returnValue = mBxlService.PrintImage(mypath.getPath(),
384,
BxlService.BXL_ALIGNMENT_CENTER,
40);
if (returnValue == BxlService.BXL_SUCCESS) {
returnValue = mBxlService.LineFeed(2);
}
}
In user manual,where is written that "Set to a value of 384, image is fit to full size of paper" didn't helped.
Here is a printed image.
and here is manual

The printer you are using has 576 dots per line. The SPP200 has 384 dots.

Related

Print a bitmap image without resizing through Wi-Fi on Android App?

I need to make an app for label printing like this
I am checking this tutorial
And PrintHelper has very simple and limited features.
I can only use two scales - SCALE_MODE_FILL, SCALE_MODE_FIT.
My bitmap image has a size of 512px X 512px. And I might need to adjust the size because of the label sticker size.
OR I need to choose the size of paper(ex. 100mm X 100mm) then, both way above will have the same result.
When I try this code, It opens print setting activity.
private void doPhotoPrint(Bitmap bitmap) {
PrintHelper printHelper = new PrintHelper(this);
printHelper.setColorMode(COLOR_MODE_MONOCHROME);
// Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.droids);
printHelper.printBitmap("droids.jpg - test print", bitmap);
}
However, I just want to implement the print function without opening the setting screen, But just when I click 'print' on my application, then right away print one or more bitmap images continuously with the default settings that I set(image size, black&white/color, printer that is connected, paper size).
Is there any way to make a function like the video above?
With the PrintHelper you get the system print dialog there is no way to print silently as the user has to pick the printer and the print attributes from the dialog. To function like the video, you'd need to implement the discovery and printing functionalities with the printer directly

Google Maps custom marker icon size not preserved on Android

I'm using the nativescript-google-maps-sdk plugin to create a Google map.
Everything works fine but I've got a problem with my custom marker icons, if you look at these pictures you can see that the icon size is not preserved on Android, making them very, very small to the point where you can barely even see them. This happens both in the emulators and on a real phone.
On IOS however the size is fine, as you can see in the 2nd image. The icon images have a size of 16x16 pixels and are in .png format.
I haven't been able to find any solution to this so this is my last resort, does anyone know why this might be happening?
This is the code I use to create the markers:
getImage(this.getWarningIcon(warning.status)).then((result) => {
const icon = new Image();
icon.imageSource = result;
const marker = new Marker();
marker.position = warning.centerOfPolygon;
marker.icon = icon;
marker.flat = true;
marker.anchor = [0.5, 0.5];
marker.visible = warning.isVisible;
marker.zIndex = zIndexOffset;
marker.infoWindowTemplate = 'markerTemplate';
marker.userData = {
description: warning.description,
startTime: warning.startTime,
completionTime: warning.completionTime,
freeText: warning.freeText
};
this.layers.push(marker);
this.map.addMarker(marker);
});
In that case 16px sounds too low for a high density device. Increase the size of the image sent from server or locally resize the image before passing it to marker.
You may also consider generating a scaled bitmap natively if you are familiar with Android apis. Image processing is something always complicated in Android. Using drawables are recommend when your images are static at least.

Android camera API blurry image on Samsung devices

After implementing the camera2 API for the inApp camera I noticed that on Samsung devices the images appear blurry. After searching about that I found the Sasmung Camera SDK (http://developer.samsung.com/galaxy#camera). So after implementing the SDK on Samsung Galaxy S7 the images are fine now, but on Galaxy S6 they are still blurry. Someone experienced those kind of issues with Samsung devices?
EDIT:
To complement #rcsumners comment. I am setting autofocus by using
mPreviewBuilder.set(SCaptureRequest.CONTROL_AF_TRIGGER, SCaptureRequest.CONTROL_AF_TRIGGER_START);
mSCameraSession.capture(mPreviewBuilder.build(), new SCameraCaptureSession.CaptureCallback() {
#Override
public void onCaptureCompleted(SCameraCaptureSession session, SCaptureRequest request, STotalCaptureResult result) {
isAFTriggered = true;
}
}, mBackgroundHandler);
It is a long exposure image where the use has to take an image of a static non moving object. For this I am using the CONTROL_AF_MODE_MACRO
mCaptureBuilder.set(SCaptureRequest.CONTROL_AF_MODE, SCaptureRequest.CONTROL_AF_MODE_MACRO);
and also I am enabling auto flash if it is available
requestBuilder.set(SCaptureRequest.CONTROL_AE_MODE,
SCaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
I am not really an expert in this API, I mostly followed the SDK example app.
There could be a number of issues causing this problem. One prominent one is the dimensions of your output image
I ran Camera2 API and the preview is clear, but the output was quite blurry
val characteristics: CameraCharacteristics? = cameraManager.getCameraCharacteristics(cameraId)
val size = characteristics?.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)?.getOutputSizes(ImageFormat.JPEG) // The issue
val width = imageDimension.width
val height = imageDimension.height
if (size != null) {
width = size[0].width; height = size[0].height
}
val imageReader = ImageReader.newInstance(width, height, ImageFormat.JPEG, 5)
The code below was returning a dimension about 245*144 which was way to small to be sent to the image reader. Some how the output was stretching the image making it end up been blurry. Therefore I removed this line below.
val size = characteristics?.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)?.getOutputSizes(ImageFormat.JPEG) // this was returning a small
Setting the width and height manually resolved the issue.
You're setting the AF trigger for one frame, but then are you waiting for AF to complete? For AF_MODE_MACRO (are you verifying the device lists support for this AF mode?) you need to wait for AF_STATE_FOCUSED_LOCKED before the image is guaranteed to be stable and sharp. (You may also receive NOT_FOCUSED_LOCKED if the AF algorithm can't reach sharp focus, which could be because the object is just too close for the lens, or the scene is too confusing)
On most modern devices, it's recommended to use CONTINUOUS_PICTURE and not worry about AF triggering unless you really want to lock focus for some time period. In that mode, the device will continuously try to focus to the best of its ability. I'm not sure all that many devices support MACRO, to begin with.

Custom: My Printer

This is the link of the Bluetooth mobile printer i used for Printing
Does anyone here tried it implementing it in the Android Application? I already using it right now but im having problem with the Printing font Sizes.
Here's my code from the SDK.
//Fill class: LEFT X2
fntPrinterX2NormalLeft.setCharHeight(PrinterFont.FONT_SIZE_X1); //Height x1
fntPrinterX2NormalLeft.setCharWidth(PrinterFont.FONT_SIZE_X1); //Width x1
fntPrinterX2NormalLeft.setEmphasized(false); //No Bold
fntPrinterX2NormalLeft.setItalic(false); //No Italic
fntPrinterX2NormalLeft.setUnderline(false); //No Underline
fntPrinterX2NormalLeft.setJustification(PrinterFont.FONT_JUSTIFICATION_LEFT);
fntPrinterX2NormalLeft.setInternationalCharSet(PrinterFont.FONT_CS_DEFAULT); //Default International Chars
The PrinterFont.FONT_SIZE_X1 is large as the default and the maximum size is up to FONT_SIZE_X8.
Could anyone tell me the limit of the size of printing, or this size was the default?
Is there anyone here from the Custom Printer?
Their SDK has lack of information.. Not like Bixolon Printer It's detailed and Informative..

How to stop a Zebra Printer RW 420 from automatically feeding lots of extra paper when issuing command printImage from printer.getGraphicsUtil?

I am using a zebra RW420 in an android project and I am coding and I find that even when simply testing the printer using the ZSDK Developer Demos the printer is printing lots of extra paper when it is issued a print command. In this case I am testing out the signature capture and print demo. I do find that if I connect it to the computer and print a label created using Zebra Designer it prints the label properly with no extra paper (in fact i wouldn't mind a couple of millimeters extra in that case).
If any one knows how to save some trees here that would be great!
The code in question is:
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
GraphicsUtil g = printer.getGraphicsUtil();
Bitmap image = signatureArea.getBitmap();
g.printImage(image, 0, 0, image.getWidth(), image.getHeight(), false);
connection.close();
this works perfect for me:
Connection connection = getZebraPrinterConn();
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
// this is very important which sets automatic heigth setting for label
connection.write("! U1 JOURNAL\r\n! U1 SETFF 50 2\r\n".getBytes());
printer.printImage(new ZebraImageAndroid(bitmap), 0, 0,800, 1200, false);
connection.close();
This wont waste paper and it will print upto the availability of text/data
Assume that you have to print a receipt of width 800 and height 1200 , but it is printing a receipt of height approx. 1800 . so there is a wastage of a receipt for 600 px of white space to make use of that wastage you can use above code.
Do you have the keyword "FORM" in your CPCL label? It's usually before PRINT
This tells the printer to form feed after printing to the top-of-form setting the printer is configured to. To disable it, you can remove the FORM keyword from your format if you don't need it, or you can set the top-of-form to 0.
! U1 getvar "media.tof"
will show you what your top-of-form is currently set to
! U1 setvar "media.tof" "0"
will set it to 0, so that the FORM will feed 0 dots

Categories

Resources