Can't print images to iMZ320 Printer

Hi,

 

Bit of a weird one, I'm in the middle of converting a native android app to use xamarin forms instead (so we can support IOS) and I decided to use a dependency service to do all the zebra printing functionality - mainly because I couldn't work out how to create an insecure connection (no pairing) to the Bluetooth printers in Xamarin Forms and whilst I could create an insecure connection outside of LinkOS to the printer and I could print out basic CPCL commands - I had massive issues when it came to printing images.  Anyway that's by-the-by, I'm using the LinkOS plugin and I re-created the code we had in our android app very quickly as it was pretty much all the same - I started testing on an MZ220 printer - everything worked perfectly, I can print out text, lines and images and its an exact replica.

 

However when I came to test on the iMZ320 printer which we also support - when it tries to print out images, nothing prints out at all - everything else prints out just fine, the images are just blank space though.  We typically have two images in our print-outs, a logo and a signature and this is the example code I am using to print the logo image at the top of the print-out (logoImage is the Bitmap and printer is the IZebraPrinter) :

 

  printer.PrintImage(new ZebraImageAndroid(logoImage), pageWidth / 6, 0, (pageWidth / 3) * 2, 175, true);   

 

So running with the same bitmap on both printers results in the MZ220 printing out the image and the iMZ320 not printing out anything.  Everything else comes out just fine on the iMZ320 - it just doesn't print any of the images though (this is not the case in our old native android app which just references the ZSDK jar file - both printers work fine).  Any suggestions on what's going on and anything else I could try ?

Manuel Caicedo-...
Hi Kieron,Theoretically, both

Hi Kieron,

Theoretically, both printers should print fine, but if that is not happening, it is possible that the IMZ320 has a configuration issue.

Please, could you share the code that you are sending to the printers, and the "allcv" report of each printer to compare configurations.

If you are not familiar with "allcv" report please, follow the link below to learn how to get this report from the printer.

Zebra Technologies - Using the SGD Allcv Command to return the Super Host Status

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manuel,Thanks for your

Hi Manuel,

Thanks for your reply, I've been away for a while so only just catching up with things and I still cant seem to get the iMZ320 to work.  I've cut our code down to as much as possible to print a simple image - I've tested this code and it prints out the logo on the MZ220 but not the iMZ320.  Could it be a problem with the LinkOS package?    I've attached the "allcv" report of the iMZ320 at the bottom.

  public class ZebraPrinterService : IZebraPrinterService
  {
    private BluetoothConnection printerConnection;
    private IZebraPrinter printer;
    private int sectionCurrentHeight;
    private string sectionText;
    private int pageWidth;
    private IZebraPrinterLinkOs linkOsPrinter;

    public void Print(string macAddress, string logoPath, bool useTwoInch, out string errorMessage)
    {
      Bitmap logoImage = null;
      int printHeight = 500;
      errorMessage = "";
      pageWidth = useTwoInch ? 400 : 600;

      try
      {
        if (!SxUtils.IsNullOrEmpty(logoPath) && new File(logoPath).Exists())
          logoImage = BitmapFactory.DecodeFile(logoPath);

        string printerConnectionError = openPrinterConnection(macAddress);

        if (!SxUtils.IsNullOrEmpty(printerConnectionError))
        {
          errorMessage = printerConnectionError;
          return;
        }

        // Initialise the print - this needs to be done at the start of all prints
        printer.SendCommand("! UTILITIES\r\n" + "JOURNAL\r\n" + "SETFF 0 0\r\n" + "PRINT\r\n");
        printer.SendCommand("! 0 200 200 500 1\r\n" + "PW " + pageWidth.ToString() + " 1\r\n");

        //Logo section
        if (logoImage != null)
        {
          logoImage = getResizedBitmap(logoImage, 175, (pageWidth / 3) * 2);
          printer.PrintImage(new ZebraImageAndroid(logoImage), pageWidth / 6, 0, (pageWidth / 3) * 2, 175, true);
        }

        printer.SendCommand("FORM\r\n" + "PRINT\r\n");
        Thread.Sleep(500);
      }
      catch (Exception e)
      {
        errorMessage = e.Message;
      }
      finally
      {
        if (printerConnection != null)
        {
          try
          {
            printerConnection.Close();
          }
          catch { }
        }
      }
    }

    #region Printer Setup / Utils

    private string openPrinterConnection(string macAddress)
    {
      // Check we have macAddress
      if (SxUtils.IsNullOrEmpty(macAddress))
        return "Please use the Settings page to set up the bluetooth device to print to first.";

      // Instantiate insecure connection for given Bluetooth MAC SxAddress.
      printerConnection = new BluetoothConnectionInsecure(macAddress);
      try
      {
        string connectionErrorMessage = isPrinterReady();

        // if printer is ready to print
        if (SxUtils.IsNullOrEmpty(connectionErrorMessage))
        {
          printerConnection.Open();
          printer = ZebraPrinterFactory.GetInstance(printerConnection);
          return null;
        }
        else
          return connectionErrorMessage;
      }
      catch (ConnectionException e)
      {
        return e.Message;
      }
      catch (ZebraPrinterLanguageUnknownException e)
      {
        return e.Message;
      }
    }

    private string isPrinterReady()
    {
      string ErrMessage = "";
      try
      {
        printerConnection.Open();
        printer = ZebraPrinterFactory.GetInstance(printerConnection);
        Thread.Sleep(500);

        linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(printer);
        PrinterStatus printerStatus = (linkOsPrinter != null) ? linkOsPrinter.CurrentStatus : printer.CurrentStatus;

        if (printerStatus.IsReadyToPrint)
          ErrMessage = "";
        else if (printerStatus.IsPaused)
          return "Cannot print because the printer is paused.";
        else if (printerStatus.IsHeadOpen)
          return "Cannot print because the printer media door is open.";
        else if (printerStatus.IsPaperOut)
          return "Cannot print because the printer has run out of paper.";
        else
          return "Cannot print because of an unknown error.";
      }
      catch (ConnectionException e)
      {
        return "Could not establish connection to printer \n Please check your settings and ensure" +
                " that the printer is switched on.";
      }
      catch (ZebraPrinterLanguageUnknownException e)
      {
        return "Cannot print because of an unknown error.";
      }
      return ErrMessage;
    }

    private Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth)
    {
      int width = bm.Width;
      int height = bm.Height;
      float scaleWidth = ((float)newWidth) / width;
      float scaleHeight = ((float)newHeight) / height;
      // CREATE A MATRIX FOR THE MANIPULATION
      Matrix matrix = new Matrix();
      // RESIZE THE BITMAP
      matrix.PostScale(scaleWidth, scaleHeight);

      // "RECREATE" THE NEW BITMAP
      Bitmap resizedBitmap = Bitmap.CreateBitmap(bm, 0, 0, width, height, matrix, false);
      return resizedBitmap;
    }
  }

allcv report :

print.

print.contrast : 0 , Choices: 0-3

print.tone : 0 , Choices: -100..200

print.tone_format : cpcl , Choices: cpcl,zpl

print.tone_zpl : 10.0 , Choices: 0.0-30.0

print.print_adj : 0 , Choices: -127-128

print.troubleshooting_label_choices :

print.troubleshooting_label_print

mcr.

rtc.

rtc.time : 00:08:19

rtc.date : 10-07-2016

rtc.timezone : UTC00

rtc.exists : no

usb.

usb.device.

usb.device.vendor_id : 0x0A5F

usb.device.product_id : 0x00F3

usb.device.device_version : 1.1

usb.device.product_string : ZTC iMZ320-203dpi CPCL

usb.device.manufacturer_string : Zebra Technologies

usb.device.serial_string : iMZ320

usb.device.device_id_string : MANUFACTURER:Zebra Technologies ;COMMAND SET:CPCL;MODEL:ZTC iMZ320;CLASS:PRINTER;OPTIONS:XML;

usb.device.device_unique_id : off , Choices: on,off

usb.connected : yes

usb.halt : no , Choices: yes,no

log.

log.reboot.

log.reboot.code : 11

log.reboot.reason : Off key

log.reboot.codes : bbbbbb8bbbbb000bbbbbb4b444bbbbbb

log.reboot.report : Off key

Off key

Off key

Off key

Off key

Off key

New OS reprogramming

Off key

Off key

Off key

Off key

Off key

Other

Other

Other

Off key

Off key

Off key

Off key

Off key

Off key

Low battery timeout

Off key

Low battery timeout

Low battery timeout

Low battery timeout

Off key

Off key

Off key

Off key

Off key

Off key

netmanage.

netmanage.type : none , Choices: none,avalanche

netmanage.status_code : 0

netmanage.state_code : 0

netmanage.error_code : 0

netmanage.avalanche.

netmanage.avalanche.model_name :

netmanage.avalanche.interval : 60000 , Choices: 0-4294967295

netmanage.avalanche.startup_update : off , Choices: on,off

netmanage.avalanche.interval_update : off , Choices: on,off

netmanage.avalanche.agent_addr : 0.0.0.0

netmanage.avalanche.available_agent : 0.0.0.0

netmanage.avalanche.available_port : 1 , Choices: 1-65535

netmanage.avalanche.encryption_type : 0 , Choices: 0-255

netmanage.avalanche.udp_timeout : 3000 , Choices: 0-4294967295

netmanage.avalanche.tcp_connection_timeout : 3000 , Choices: 0-4294967295

netmanage.avalanche.terminal_id : 0 , Choices: 0-65535

netmanage.avalanche.realtime_update_int : 300 , Choices: 0-4294967295

netmanage.avalanche.text_msg.

netmanage.avalanche.text_msg.print : off , Choices: on,off

netmanage.avalanche.text_msg.display : off , Choices: on,off

netmanage.avalanche.text_msg.beep : off , Choices: on,off

netmanage.avalanche.set_property

zbi.

zbi.revision : ZBI Version 2.1

zbi.state : off

zbi.last_error :

zbi.program_list, Choices: fill,execute

zbi.start_info.

zbi.start_info.file_name : *:\.BAZ

zbi.start_info.memory_alloc : 0

zbi.start_info.execute

zbi.control.

zbi.control.terminate

zbi.control.run

zbi.control.break

zbi.control.restart

zbi.control.step

zbi.control.variable_name :

zbi.control.variable_value :

zbi.control.add_breakpoint

zbi.control.delete_breakpoint

zbi.control.clear_breakpoints

zbi.control.line_number : 0

zbi.reseller_key

zbi.key : DISABLED

zbi.running_program_name :

zbi.key_version : 1.1

zpl.

zpl.calibrate

zpl.relative_darkness : 0 , Choices: -300-300

zpl.save

zpl.label_length : 2030 , Choices: 1-32000

zpl.left_position : 0 , Choices: -9999-9999

zpl.format_prefix : ^ (5E) , Choices: 00-FF,00-ff

zpl.command_prefix : ~ (7E) , Choices: 00-FF,00-ff

zpl.delimiter : , (2C) , Choices: 00-FF,00-ff

zpl.zpl_mode : zpl II , Choices: zpl II,zpl

zpl.system_status : 0,0,00000000,00000000,0,00000000,00000000

zpl.system_error : 0,0,00000000,00000000

zpl.no_errors_boot_done : yes

zpl.print_orientation : nor , Choices: nor,inv

zpl.label_top : 0 , Choices: -60-60

internal_wired.

rfid.

interface.

interface.network.

interface.network.settings_require_reset : no

interface.network.active.

interface.network.active.printserver : unknown

interface.network.active.ip_addr : 0.0.0.0

interface.network.active.netmask : 0.0.0.0

interface.network.active.gateway : 0.0.0.0

interface.network.active.protocol : all

interface.network.active.default_addr_enable : on

interface.network.active.wins_addr : 0.0.0.0

interface.network.active.arp_interval : 0

interface.network.active.mac_addr : 00:00:00:00:00:00

interface.network.active.mac_raw : 000000000000

interface.network.active.server_protocol :

interface.network.active.server_address : 0.0.0.0

interface.network.active.dhcp_received_host_name :

interface.network.active.cable_type : unknown

interface.network.active.speed : 0

interface.network.active.rx_packets :

interface.network.active.rx_errors :

interface.network.active.tx_packets :

interface.network.active.tx_errors :

interface.network.active.protocol_error : None

cutter.

cutter.clean_cutter

line_print.

line_print.buffer_height : 2400 , Choices: 412-2400

apl.

apl.enable : none , Choices: none

apl.framework_version : 1.2

apl.version : none

apl.o.

apl.o.graphics_byte_width : 72 , Choices: 0-255

formats.

formats.cancel_all :

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Kieron,The allcv report is

Hi Kieron,

The allcv report is incomplete.  The reports starts with BT settings and it finishes with two quotes (""). Please, could you run a new report, and attach it as a file to your next post.

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Unsure what went wrong with

Unsure what went wrong with the last allcv report - please find attached a new one.

Thanks.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Kieron,Please, could you send

Kieron,

Please, could you send, now, the allcv of the MZ220 printer, so I can compare both printers.

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manuel,Please find

Hi Manuel,

Please find attached.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Kieron,Please, try to send

Kieron,

Please, try to send the below command to the imz320 printer, and send the CPCL code again with the graphic, and let me know what results you got.

! U1 setvar "device.languages" "hybrid_xml_zpl"

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manuel,Sorry for the delay

Hi Manuel,

Sorry for the delay in getting back to you, I tried out your solution but it didn't make a difference.

I have in the meantime setup a brand new xamarin project and I have stripped out all of our other code and simply allows the user to specify a mac address and an image path and attempts to send it to the printer.  The test I did was to send the command to the MZ220 first and then change the mac address to the iMZ320 and send the same command - I've attached a picture of the results - the image prints out on the MZ220 and doesn't print out on the iMZ320 - I would of liked to of sent it to you so you can run some tests yourself but the zipped file is too big to attach here, is there an email address I can send this too?  I do not believe it is a printer configuration issue because as I said in my original post, our old android apps (created in Android Studio) can print images to our iMZ printer just fine.  It's either a deployment issue with Visual Studio or an issue with the Zebra SDK.

We have also completed our iOS integration and discovered that it does the same thing with the iMZ printer.  Also because we can't use a Bluetooth connection with the MZ series printers in iOS, we currently have no working printer integration with our iOS app.

Regards,

Kieron

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Kieron,MZ Series is a

Hi Kieron,

MZ Series is a discontinued printer, so it does not have support for MFI.

iMZ is the replacement printer for MZ series, so the issues that you are experiencing are very weird, please, could you send me an email with the source code to analyze the information in detail to this email: ISV_NALA_Support@zebra.com.

We provide more dedicated support to our ISV partners to complete the development, I would invite you to complete your ISV registration on the link below. The registration is a free fee process.

Become a Partner

Thanks,

MC,

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manuel,I've actually

Hi Manuel,

I've actually managed to shrink the files down to zip on here.  You'll have to restore the nuget packages before use.  If you change the mac address and the image File Path to point to a valid image on the device you are running - hopefully you will see the same results as me.  The project only has android code in there at the moment.

Regards,

Kieron

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manuel,Just wondered if

Hi Manuel,

Just wondered if you've had any joy/response back yet concerning this issue?

Thanks

Kieron

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Kieron,Yes, please, send

Hi Kieron,

Yes, please, send me the information to this email : ISV_NALA_Support@zebra.com.

I will follow up with you internally.

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


danilo bono
Hi Friends,I've have the same

Hi Friends,

I've have the same issue with the iMZ320.

I use wcpp driver (https://www.neodynamic.com/downloads/wcpp/ ), but when I try to print a png file the printer just flow a white paper.

Instead, the same command on a usb printer (excelvan), work properly.

I've also tried to print with esc/pos or ZPL but the printer just print the character (like a string) instead of compile and apply the hex command.

any ideas?

thank a lot for your support.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Danilo,I reviewed the link

Hi Danilo,

I reviewed the link you told me, but I could not find that this web-driver supports Zebra Printers.

However, the solution that you are needing, I think it can be solved by using Browser Print. Please, check the links below for more info.

Browser Print SDK | Link-OS | Zebra

Additional white-paper that explains the web printing solutions that Zebra is supporting.

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manual,Just to let you

Hi Manual,

Just to let you know (in case you were unaware) I sent all the information in an email earlier this week.  I look forward to your response.

Thanks

Kieron

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kieron Brady
Hi Manuel,Just wondered if

Hi Manuel,

Just wondered if you'd had any luck with that project I sent over?

Also a small update as I've been playing around with this as its becoming more urgent and I'm being pressed into looking at supporting other mobile printers now - I managed to get the iMZ320 to print an image after I stripped out all the code (apart from the connection) - all I had in there was this line :

printer.PrintImage(imagePath, 100, 0, 400, 175, false);

Because I had to remove the (CPCL) lines that format the print - the print-out was completely wrong - it printed upside down, it fed way too much paper and the image wasn't centered like it should be. (see screenshot).

These are the lines I removed:

printer.SendCommand("! UTILITIES\r\n" + "JOURNAL\r\n" + "SETFF 0 0\r\n" + "PRINT\r\n");

printer.SendCommand("! 0 200 200 500 1\r\n" + "PW " + pageWidth.ToString() + " 1\r\n");

printer.SendCommand("FORM\r\n" + "PRINT\r\n");

Without these, the printImage command works but I can no longer format the print-out - with these, the images don't print.

DSC_0010.JPG

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Abhishek kumar
I'm having an issue printing


I'm having an issue printing png image to a zebra ZQ310 printer, its going to be used to print receipts from an android device and a logo is required to be printed at the top of the printout. when printing the image and receipt lots of white images are getting print.

This is my code:

BLuetoothPrintActivity.CONNECTION.open();

Bitmap bitmapToPrint = BitmapFactory.decodeResource(context.getResources(), R.drawable.dummylogo);
   ZebraPrinter printer = ZebraPrinterFactory.getInstance(BLuetoothPrintActivity.CONNECTION);
ZebraImageAndroid zebraImageToPrint = new ZebraImageAndroid(bitmapToPrint);


byte[] configLabel = createZplReceipt().getBytes();
BLuetoothPrintActivity.CONNECTION.write(configLabel);

BLuetoothPrintActivity.CONNECTION.write("! U1 JOURNAL\r\n! U1 SETFF 100 2\r\n".getBytes());
printer.printImage(zebraImageToPrint, 0, 0, 100, 100, false);


BLuetoothPrintActivity.CONNECTION.close();

private static String createZplReceipt() {

   /*
  This routine is provided to you as an example of how to create a variable length label with user specified data.
  The basic flow of the example is as follows

  Header of the label with some variable data
  Body of the label
  Loops thru user content and creates small line items of printed material
  Footer of the label

  As you can see, there are some variables that the user provides in the header, body and footer, and this routine uses that to build up a proper ZPL string for printing.
  Using this same concept, you can create one label for your receipt header, one for the body and one for the footer. The body receipt will be duplicated as many items as there are in your variable data

  */

   String tmpHeader =

   /*
  Some basics of ZPL. Find more information here : http://www.zebra.com/content/dam/zebra/manuals/en-us/printer/zplii-pm-vol2-en.pdf

  ^XA indicates the beginning of a label
  ^PW sets the width of the label (in dots)
  ^MNN sets the printer in continuous mode (variable length receipts only make sense with variably sized labels)
  ^LL sets the length of the label (we calculate this value at the end of the routine)
  ^LH sets the reference axis for printing.
  You will notice we change this positioning of the 'Y' axis (length) as we build up the label. Once the positioning is changed, all new fields drawn on the label are rendered as if '0' is the new home position
  ^FO sets the origin of the field relative to Label Home ^LH
  ^A sets font information
  ^FD is a field description
  ^GB is graphic boxes (or lines)
  ^B sets barcode information
  ^XZ indicates the end of a label
  */

   "^XA" +

   "^PON^PW400^MNN^LL%d^LH0,0" + "\r\n" +

   "^FO20,50" + "\r\n" + "^A0,N,50,50" + "\r\n" + "^FDBagScanner^FS" + "\r\n" +

   "^FO20,130" + "\r\n" + "^A0,N,35,35" + "\r\n" + "^FDOFFICIAL RECEIPT^FS" + "\r\n" +

   "^FO20,180" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDDriver ID :^FS" + "\r\n" +

   "^FO225,180" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDAcme Industries^FS" + "\r\n" +

   "^FO20,220" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDDelivery Date:^FS" + "\r\n" +

   "^FO225,220" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FD%s^FS" + "\r\n" +

   "^FO20,273" + "\r\n" + "^A0,N,30,30" + "\r\n" + "^FDItem^FS" + "\r\n" +

   "^FO280,273" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDPrice^FS" + "\r\n" +

   "^FO20,300" + "\r\n" + "^GB350,5,5,B,0^FS";

  int headerHeight = 325;
   String body = String.format("^LH0,%d", headerHeight);

  int heightOfOneLine = 40;

  float totalPrice = 0;

   Map<String, String> itemsToPrint = createListOfItems();

  int i = 0;
  for (String productName : itemsToPrint.keySet()) {

  String price = itemsToPrint.get(productName);

   String lineItem = "^FO20,%d" + "\r\n" + "^A0,N,28,28" + "\r\n" + "^FD%s^FS" + "\r\n" + "^FO280,%d" + "\r\n" + "^A0,N,28,28" + "\r\n" + "^FD$%s^FS";
   totalPrice += Float.parseFloat(price);
  int totalHeight = i++ * heightOfOneLine;
   body += String.format(lineItem, totalHeight, productName, totalHeight, price);

   }

   long totalBodyHeight = (itemsToPrint.size() + 1) * heightOfOneLine;

  long footerStartPosition = headerHeight + totalBodyHeight;

   String footer = String.format("^LH0,%d" + "\r\n" +

   "^FO20,1" + "\r\n" + "^GB350,5,5,B,0^FS" + "\r\n" +

   "^FO20,15" + "\r\n" + "^A0,N,40,40" + "\r\n" + "^FDTotal^FS" + "\r\n" +

   "^FO175,15" + "\r\n" + "^A0,N,40,40" + "\r\n" + "^FD$%.2f^FS" + "\r\n" +

   "^FO20,130" + "\r\n" + "^A0,N,45,45" + "\r\n" + "^FDPlease Sign Below^FS" + "\r\n" +

   "^FO20,190" + "\r\n" + "^GB350,200,2,B^FS" + "\r\n" +

   "^FO20,400" + "\r\n" + "^GB350,5,5,B,0^FS" + "\r\n" +

   "^FO20,420" + "\r\n" + "^A0,N,30,30" + "\r\n" + "^FDThanks for choosing us!^FS" + "\r\n" +

   "^FO20,470" + "\r\n" + "^B3N,N,45,Y,N" + "\r\n" + "^FD0123456^FS" + "\r\n" + "^XZ", footerStartPosition, totalPrice);

  long footerHeight = 600;
  long labelLength = headerHeight + totalBodyHeight + footerHeight;

   Date date = new Date();
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
   String dateString = sdf.format(date);

   String header = String.format(tmpHeader, labelLength, dateString);

   String wholeZplLabel = String.format("%s%s%s", header, body, footer);

  return wholeZplLabel;
}

private static Map<String, String> createListOfItems() {

  String[] names = { "Microwave Oven", "Sneakers (Size 7)", "XL T-Shirt", "Socks (3-pack)", "Blender", "DVD Movie" };
   String[] prices = { "79.99", "69.99", "39.99", "12.99", "34.99", "16.99" };
   Map<String, String> retVal = new HashMap<String, String>();

  for (int ix = 0; ix < names.length; ix++) {

  retVal.put(names[ix], prices[ix]);
   }

   return retVal;
}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments