question

Lee Tickett avatar image
Lee Tickett asked Lee Tickett commented

ImagePrintJob on Clover Mini (devkit)

Does anyone have ImagePrintJob working? It looks like it tries to save the passed bitmap to a file before sending the job and that step is failing;

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lee.printticket/com.example.lee.printticket.Main}: java.lang.NullPointerException

java.io.IOException: open failed: ENOENT (No such file or directory)

When I debug it's falling over in ImagePrintJob.java (part of com.clover.sdk);

File dir = new File("/sdcard", "clover" + File.separator + "image-print");
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered Lee Tickett commented

Do you have permission WRITE_EXTERNAL_STORAGE? Please provide the entire stack trace and surrounding logcat.

Also, the Clover Android SDK has examples that use ImagePrintJob. Under the clover-android-sdk-examples module, see PrintTestActivity.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Lee Tickett avatar image Lee Tickett commented ·

Easy when you know how!

Adding; <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> to the androidmanifest.xml did the trick!

I did take the code from the PrintTestActivity but of course it doesn't come with the relevant Manifest / permission entries.

Many Thanks

0 Likes 0 ·

Welcome to the
Clover Developer Community