• Hoping for some assistance on editing order-handler.php.

    My client wants the font size to be just a smidge larger, say 1.25X or 1.5X.

    Also, can we add a line break in between each ordered item on the receipt?

    They’re having a difficult time reading large orders (they’re older).

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @thaim

    I have good news and bad news for these requests.

    Firstly, the plugin is limited to using printers built-in font, and this can only be scaled by whole numbers, e.g. 2x. for your reference, the printed title is 2x width and height. Would that be ok or is it too much?

    Yes, adding a line break between each order item should be easy, in the “order-handler.php” file, find the function “star_cloudprnt_print_items()” which is near the top of the file.

    Then locate the section (near the end of the function) that reads:

    $printer->add_text_line(star_cloudprnt_get_column_separated_data(array(" Qty: ".
    	$item_qty." x Cost: ".$formatted_item_price,
    	$formatted_total_price), $max_chars));

    and just after it, add a line:
    $printer->add_new_line(1);

    This should add a line space between each order item.

    Thread Starter ThaiM

    (@thaim)

    I can try 2X and see if they’re okay with that, but I think that will be fine.

    Thanks for the line-break!

    Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @thaim

    If you want to try the x2 font size, then to can test with this code:
    Firstly, in the same function that you modified for the line spacing “star_cloudprnt_print_items()” in “order-handler.php”, locate this part:

    $printer->set_text_emphasized();
    $printer->add_text_line(wordwrap($product_line, $selectedPrinter['columns'], "\n", true));
    $printer->cancel_text_emphasized();

    And change it to:

    $width_mag = 2;
    $height_mag = 2;
    $printer->set_font_magnification($width_mag, $height_mag);
    $printer->set_text_emphasized();
    $printer->add_text_line(wordwrap($product_line, $selectedPrinter['columns']/$width_mag, "\n", true));
    $printer->cancel_text_emphasized();
    $printer->set_font_magnification(1, 1);

    You can adjust the values of $widthmag and $heightmag to control the size of the font (so 2 and 2 means double width, and double height), but they must be a whole number.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Font Size and Item Line Breaks’ is closed to new replies.