question

Rohit Bhardwaj avatar image
Rohit Bhardwaj asked ·

SP700 Impact Printer does not print custom layout with ViewPrintJob

Hi,

I created custom layouts to print Order and Payment Receipts both and it prints perfectly fine on the clover attached printers and also the Thermal Printer from Star Micronics TSP100. One merchant tested this custom layout printing with his Impact Printer from Star Micronics SP700, but unfortunately it didn't print. I get the width of the printer by using printer.type.numDotsWidth. The result is shown "0" for the SP700 and "576" for the clover printers. Since the width is 0 it won't print any data.

The other thing is when I send some custom data to print, it directly prints it. I used TextPrintJob to just test if it prints through my app or not. It does print using the custom text but not using the custom layout.


Below is the code that I use to measure the custom layout and send the command to print. This code works for Clover Printers and Star Micronics TSP100 but not for SP700.


try {

    int measuredWidth = View.MeasureSpec.makeMeasureSpec(kitchenViewWidth, View.MeasureSpec.EXACTLY);
    int measuredHeight = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    kitchenReceiptLayout.measure(measuredWidth, measuredHeight);
    kitchenReceiptLayout.layout(0, 0, kitchenReceiptLayout.getMeasuredWidth(), kitchenReceiptLayout.getMeasuredHeight());
    kitchenReceiptLayout.requestLayout();

    new AsyncTask<Void, Void, Void>() {

        @Override
        protected Void doInBackground(Void... voids) {

            if (printer != null) {
                ViewPrintJob.Builder builder = new ViewPrintJob.Builder().view(kitchenReceiptLayout);
                ViewPrintJob printJob = builder.build();
                printJob.print(context, CloverAccount.getAccount(context), printer);
            }

            return null;
        }
    }.execute();

} catch (Exception e) {
    e.printStackTrace();
}


This is how I get the width of the printer. The printer here is the selected printer to print Order Receipts Only.

 kitchenViewWidth = printer.type.numDotsWidth;


Please let me know if this is the right approach for SP700 or not. Thank you.

Print
10 |2000 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
Jeffrey Blattman avatar image
Jeffrey Blattman answered ·

You can't send View/ImagePrintJobs to the SP700. We don't run it in graphics mode.

You can see that View/ImagePrintJob return RECEIPT from their getCategory() method. If you query the SP700 by calling PrinterConnector#getTypeDetails, and inspect the result from getSupportedCategories(). It will return category ORDER only.

1 comment Share
10 |2000 characters needed characters left characters exceeded

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

So basically I can't use my own layout for SP700 and instead I have to use the order object and pass it in the StaticReceiptPrintJob to print it from clover's SDK. Am I correct?

Also, I personally don't own a SP700 Impact printer for testing purpose so I can't query it but thank you for clearing my doubt.

0 Likes 0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

Welcome to the
Clover Developer Community