function generateLabelHSE($product_id, $article_id, $ean = '')
 {
     $result = array();
     if ($ean != '') {
         $obj_product = Product::loadObjectFromEAN($ean);
         $article_id = $obj_product->getArticleIDFromEAN($ean);
     } else {
         $obj_product = new Product($product_id);
         $ean = $obj_product->getEAN($article_id);
     }
     $sales_partner_id = '12';
     //Use product code from SP (HSE)
     //SP is not yet created, maybe will have a different ID
     $code = $obj_product->getSalesPartnerProductCode($sales_partner_id);
     if ($code == '') {
         $code = 'N/A';
     }
     $name = $obj_product->getSalesPartnerProductName($sales_partner_id);
     if ($name == '') {
         $name = 'No SP Name';
     }
     $length = $obj_product->getLengthOrSizeAsText($article_id);
     //Set label size (in dots)
     $label_width = '340';
     $text_block_width = '300';
     //Set default x and y position
     $posx_start = 20;
     $posy_start = 35;
     //Start setting x and y position to be used and changed dynamically
     //can be set to default size again when needed
     $posx = $posx_start;
     $posy = $posy_start;
     //CONSTRUCT label
     //==> START COMMAND ^XA
     $label = "^XA";
     //==> Change International Font/Encoding ^CI
     //6 = German Character Set
     $label .= "^CI6";
     //==> Media Type
     //^MT
     //D for Direct Thermal (need special media)
     //T for Thermal Transfer (need ribbon)
     $label .= "^MTD";
     //==> Media Darkness
     //^MD
     //0 : 0 (-30 to 30)
     $label .= "^MD0";
     //==> Print Mode
     //^MM
     //T = Tear-off
     $label .= "^MMT";
     //==> Measurement Unit
     //^MU
     //d = dots
     //300 = dpi format
     //300 = dpi conversion
     $label .= "^MUd,300,300";
     //==> Label Home
     //^LH
     //0,0 = x,y axis position (0 - 32000)
     $label .= "^LH0,0";
     //==> Media Tracking
     //^MN
     //Y = non-continues web sensing
     //N = continues
     $label .= "^MNY";
     //$label .= "^MNN";
     //==> Label Length
     //^LL
     //only needed for continues media
     //$label .= "^LL384.5";
     //==> Print Width
     //^PW
     //Specify label width in dots
     $label .= "^PW" . $label_width;
     //==> Set Dots per Milimiter
     //^JM
     //will affect sizes of result that will be printed on label
     //A = 24 dots/mm, 12 dots/mm, 8 dots/mm or 6 dots/mm
     //B = 12 dots/mm,  6 dots/mm, 4 dots/mm or 3 dots/mm
     $label .= "^JMA";
     //==> Field Origin
     //^FO
     //x axis in dots
     //y axis in dots
     //z = justification (0 = left, 1 = right, 2 = auto)
     $label .= "^FO{$posx},{$posy}";
     //==> Set Scalable/Bitmapped Font
     //^A
     //font name : A-Z, 0-9 (saved in printer memory)
     //orientation : N = normal, R = 90CW, I = 180, B = 270
     //character height in dots
     //width in dots
     $label .= "^A0N,35,35";
     //==> Field Block
     //^FB
     //set field data to be printed as a block which can be aligned
     //width in dots
     //maximum lines : 1 to 9999
     //line spaces : -9999 to 9999
     //alignment : L = Left, C = Center, R = Right, J = Justified
     //hanging indent : 0 to 9999
     $label .= '^FB' . $text_block_width . ',1,0,C,0';
     //==> Field Data (set barcode value)
     //^FD ... ^FS
     //Data to print (in this case Product Code)
     $label .= '^FD' . 'HSE 24' . '^FS';
     $posy += 38;
     //==> Field Origin
     //^FO
     //x axis in dots
     //y axis in dots
     //z = justification (0 = left, 1 = right, 2 = auto)
     $label .= "^FO{$posx},{$posy}";
     //==> Set Scalable/Bitmapped Font
     //^A
     //font name : A-Z, 0-9 (saved in printer memory)
     //orientation : N = normal, R = 90CW, I = 180, B = 270
     //character height in dots
     //width in dots
     $label .= "^A0N,60,60";
     //==> Field Block
     //^FB
     //set field data to be printed as a block which can be aligned
     //width in dots
     //maximum lines : 1 to 9999
     //line spaces : -9999 to 9999
     //alignment : L = Left, C = Center, R = Right, J = Justified
     //hanging indent : 0 to 9999
     $label .= '^FB' . $text_block_width . ',1,0,C,0';
     //==> Field Data (set barcode value)
     //^FD ... ^FS
     //Data to print (in this case Product Code)
     $label .= '^FD' . $code . '^FS';
     $posy += 50;
     $posx_barcode = 35;
     //==> Bar Code Field Default
     //^BY
     //could make barcode on smallest size
     //width : 1 - 10
     //ratio : 2.0 - 3.0
     //height : in dots
     $label .= "^BY2";
     //==> Field Origin
     //^FO
     //x axis in dots
     //y axis in dots
     //z = justification (0 = left, 1 = right, 2 = auto)
     $label .= "^FO\${$posx_barcode},{$posy}";
     //==> Set Barcode Type and Format
     //^B
     //C = Code 128
     //orientation : N = normal, R = 90CW, I = 180, B = 270
     //height in dots
     //print interpretation : Y = Yes, N = No
     //print interpretation above : Y = Yes, N = No (print below)
     $label .= "^BCN,80,N,N";
     //==> Field Data (set barcode value)
     //^FD ... ^FS
     //Data to print (in this case EAN Code)
     $label .= '^FD' . $code . '^FS';
     $posy += 85;
     //==> Field Origin
     //^FO
     //x axis in dots
     //y axis in dots
     //z = justification (0 = left, 1 = right, 2 = auto)
     $label .= "^FO{$posx},{$posy}";
     //==> Set Scalable/Bitmapped Font
     //^A
     //font name : A-Z, 0-9 (saved in printer memory)
     //orientation : N = normal, R = 90CW, I = 180, B = 270
     //character height in dots
     //width in dots
     $label .= "^A0N,30,30";
     //==> Field Block
     //^FB
     //set field data to be printed as a block which can be aligned
     //width in dots
     //maximum lines : 1 to 9999
     //line spaces : -9999 to 9999
     //alignment : L = Left, C = Center, R = Right, J = Justified
     //hanging indent : 0 to 9999
     $label .= '^FB' . $text_block_width . ',2,0,C,0';
     //==> Field Data (set barcode value)
     //^FD ... ^FS
     //Data to print (in this case the Article Length)
     $label .= '^FH^FD' . $this->convertToGermanHex($name) . '^FS';
     //$label .= '^FD' . $name . ' ' . $length . '^FS';
     //END COMMAND ^XZ
     $label .= "^XZ";
     $result['barcode_type'] = 'label_product_hse';
     $result['label'] = $label;
     $result['label_name'] = "{$ean}.data";
     return $result;
 }