escpos / escpos Goto Github PK
View Code? Open in Web Editor NEWA ruby implementation of ESC/POS (thermal) printer command specification.
Home Page: https://github.com/escpos/escpos
A ruby implementation of ESC/POS (thermal) printer command specification.
Home Page: https://github.com/escpos/escpos
Is it any way to get characters like HW_INIT
, CTL_CR
, etc, as Hexadecimal (something like ' "\x1B", instead of
"\e") when I run
#to_escpos`?
hi,
thank you for your effort in putting this great implementation together.
do you have any advice for concatenating helper methods?
for example, applying 'big' and 'center' to a string simultaneously.
thank you,
spencer
[29] pry(main)> @printer = Escpos::Printer.new
=> #<Escpos::Printer:0x00007efc2e1bbd78 @data="\e@">
[30] pry(main)> @printer << "Some text"
=> "\e@Some text"
[31] pry(main)> @printer << Escpos::Helpers.big("Big text")
NoMethodError: undefined method `big' for Escpos::Helpers:Module
even had to wrap big
call in brackets, otherwise syntax error.
Ruby 3.2
Hi,
First of all thank you for your work.
I have a problem with helpers, if I try to use them I always get for instance "NoMethodError (undefined method `center'").
class MerchantInfo < Escpos::Report
def cfe_data
options[:cfe_data]
end
def merchant_title text
center "#{text}"
end
def self.create_merchant_info
layout_dir = Rails.root.join('app/views/api/v1/thermal_cfe/merchant_info.erb').to_s
cfe_layout = MerchantInfo.new(layout_dir,
{
cfe_data:Hash(merchant:COMMERCES[0])
}
)
puts "cfe_layout #{cfe_layout.to_json}"
cfe_layout
end
end
this is my view file:
#merchant_info.erb
<%=merchant_title cfe_data[:merchant]%>
ruby version 2.5.3
rails version 5.2.1
Thank you in advance for your help.
Hi , I use @printer.to_escpos the Chinese but show my scrambled code. how can i solve it。thanks for your help
How I set th encoding to work on LATIN1 on CP_CP858
I trying to
text = Escpos::Printer.new
text << Escpos::Helpers.set_printer_encoding(Escpos::CP_CP858)
text << Escpos::Helpers.encode(ptr_text, encoding: "CP-858")
but I having the error code converter not found (UTF-8 to CP-858)
how I use this code table?
Hello,
I have everything setup as said in the documentation but have nothing when I try. Is there anything else to install or configure?
Hi, I wrote node-escpos for node.js, could i join escpos organization ?
Docs not giving actual example but using hard coded data like for some static report
<%= item "First item" %>
<%= item "Second item" %>
<%= item "Third item" %>
There should have been some actual object like an order with items etc.
Now how to pass an object report.erb from
report = MyReport.new 'path/to/my_report.erb'
than using multiple styles, its just showing quad_text
& exactly at which point it sends data to printer
Hi, I'm trying to build a feature using the Escpos::Report
.
But when I try to use ActionView::Helpers
(already included in the Report Class), it throws a weird error:
#<NoMethodError: undefined method `in_rendering_context' for <EscPosServices::Reports::Invoice:0x00007f849e226af8>>
I leave an example:
# invoice.rb
class EscPosServices::Reports::Invoice < Escpos::Report
include ActionView::Helpers
def sale
options[:sale]
end
def current_tenant
options[:current_tenant]
end
end
<%= right(bold("Subtotal: ") + number_to_currency(sale.subtotal)) %>
<%= right(bold("Descuento: ") + number_to_currency(sale.discount_amount)) %>
Versions:
Rails 6.0.3.7
Escpos gem 0.0.10
Ruby 2.7.3
This looks like a brilliant gem. Could you confirm which printers you know work with this?
I've tried your sample code with my Brother TD-4000 but so far it's stubbornly silent.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.