-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
How to customize the layout for a receipt printer? #7
Comments
Hey @HatemMahmoud! Probably the best way of doing that would be to create like a ThermalReceipt class or something that redefines the methods for generating the receipt. You'll basically have to tweak the bounding boxes and things to get a smaller size and then the same for fonts and stuff. It might be a good time to refactor all the code for the receipt so that all the margin values and things could be configurable in a hash early on instead of being hardcoded. |
The message on the header of the receipt can be overridden by simply including a message attribute when creating the new receipt in the Charge model: def receipt
Receipts::Receipt.new(
id: id,
message: "My custom message text",
... |
Does this also work when attempting to change the size of the print paper, e.g printing to A5? |
Yep, changing the size of the paper larger or smaller would need the same tweaks. If someone wants to make a PR for customizable sizes, that'd be awesome! |
Hi,
Thanks for the great gem!
How can you customize the layout of the pdf to use smaller margins and smaller fonts for printing on small thermal paper? Also, how could you add a logo and update the message on the header of the receipt?
Thank you!
The text was updated successfully, but these errors were encountered: