Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistant receipt printing output #1342

Open
Rana-xD opened this issue Jul 14, 2024 · 1 comment
Open

Inconsistant receipt printing output #1342

Rana-xD opened this issue Jul 14, 2024 · 1 comment

Comments

@Rana-xD
Copy link

Rana-xD commented Jul 14, 2024

I have an issue when sometime it print correctly and something it is not (on top part). And I don't know what is the issue. Below is my custom code

public function printXscometicReceipt(){
        if ($this->printer) {
            // Get request amount
            $total = $this->getPrintableSummary('TOTAL', $this->request_amount, true);
            $seller = $this->getPrintableHeader(
                'Seller: ',
                $this->cashier
            );
            $date = $this->getPrintableHeader(
                'Date: ',
                date('d-m-Y / h:i A'),
            );

            $total_discount = $this->getPrintableHeader(
                'Discount All    :',
                $this->discount_all,
            );

            $total = $this->getPrintableHeader(
                'Total      ($)  :',
                $this->total
            );

            $total_riel = $this->getPrintableHeader(
                'Total      (KHR):',
                $this->total_riel,
            );

            $recieve_in_usd = $this->getPrintableHeader(
                'Recieve    ($)  : ',
                '$'.$this->received_in_usd,
            );

            $received_in_riel =  $this->getPrintableHeader(
                'Recieve    (KHR): ',
                $this->received_in_riel,
            );

            $change_in_usd =  $this->getPrintableHeader(
                'Change    ($)  : ',
                '$'.$this->change_in_usd,
            );

            $change_in_riel =  $this->getPrintableHeader(
                'Change    (KHR):',
                str_replace(' ៛','',$this->change_in_riel),
            );

            $product_header = ['Name', 'Price', 'Qty', 'Total'];
            // Init printer settings
            $this->printer->initialize();
            
            $this->printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH);
            $this->printer->setJustification(Printer::JUSTIFY_CENTER);

            
            $this->printer->text("{$this->store->getName()}\n");
            $this->printer->selectPrintMode(Printer::MODE_FONT_A);
            $this->printer->setJustification(Printer::JUSTIFY_CENTER);
            $this->printer->text($seller . "\n");
            $this->printer->text($date . "\n");
            
            $this->printDashedLine();
            $this->printer->setEmphasis(true);
            
            $this->printer->selectPrintMode(Printer::MODE_FONT_A);
            $this->printer->setJustification(Printer::JUSTIFY_LEFT);

            
            $this->printer->text($this->getReceiptHeader());
            
            $this->printer->setEmphasis(false);
            $this->printer->feed();
            foreach ($this->items as $item) {
                
                $this->printer->text($item."\n");
            }
            $this->printer->setJustification(Printer::JUSTIFY_CENTER);
            $this->printDashedLine();
            $this->printer->selectPrintMode(Printer::MODE_FONT_A);
            $this->printer->text($total_discount . "\n");
            $this->printer->text($total . "\n");
            $this->printer->text($total_riel . "\n");
            $this->printer->text($recieve_in_usd . "\n");
            $this->printer->text($received_in_riel . "\n");
            $this->printDashedLine();
            $this->printer->text($change_in_usd . "\n");
            $this->printer->text($change_in_riel . "\n");
            $this->printDashedLine();
            
            $this->printNote();

            $this->printer->cut();
            $this->printer->close();
        } else {
            throw new Exception('Printer has not been initialized.');
        }
    }

You can check the image attachment.

IMG_6826

My OS is Mac and My Thermal Printer Model is Rongta RP80USE.

@Staryuu1
Copy link

did you solve the problem?, I also had the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants