I am trying to send pdf file to printer as a array of bytes but it is printing in machinary language. Please can anyOne help on this. We are using hp officejet 100 mobile printer, Trying to print via bluetooth tech
//send data
void sendData() throws IOException {
try {
InputStream is = new FileInputStream(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/invoices.pdf"));// Where this is Activity
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int FILE_CHUNK_SIZE = 1024 * 4;
byte[] b = new byte[FILE_CHUNK_SIZE];
int read = -1;
while ((read = is.read(b)) != -1) {
bos.write(b, 0, read);
}
byte[] bytes = bos.toByteArray();
mmOutputStream.write(bytes);
is.close();
bos.close();
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
myLabel.setText("Data Sent");
closeBT();
}
}