I'm trying to print receipts from website to bluetooth POS printer - specifically Bixolon SPP-R200III from browser. I've managed to connect to printer via Bluetooth and print a test page with their Android app, but the system itself does not recognise device as a printer, so printing without any additional app doesn't seem like an option. Is this even possible and if not what would be the best and easiest way to approach this issue?
Asked
Active
Viewed 1,069 times
1 Answers
0
Try creating a print service and extract the data from the PrintJob. In my case I created a PDF file from the data and worked from there.
InputStream in = null;
//Create the pdf file
final File file = new File(getFilesDir(), "test.pdf");
try{
in = new FileInputStream(printJob
.getDocument().
getData()
.getFileDescriptor());
out = new FileOutputStream(file);
byte[] bufferZ = new byte[1024];
int read;
//write on the pdf file
while ((read = in.read(bufferZ)) != -1) {
out.write(bufferZ, 0, read);
}
//close the input and output stream
in.close();
out.flush();
out.close();
}

Almeida Juan
- 69
- 5