zebra-zpl 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +6 -1
- data/README.md +12 -0
- data/lib/zebra/print_job.rb +12 -5
- data/lib/zebra/zpl/font.rb +1 -1
- data/lib/zebra/zpl/version.rb +1 -1
- data/spec/zebra/zpl/text_spec.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd34dee028d5f1722409a1976624d6b34412730dbeaae95cca39994416a562d5
|
4
|
+
data.tar.gz: 7d1f93a2ca77cd89d365b3b830eb27ed7efefa9bb12a06a42ab195c6d5088917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3987b04350d612a3168247e181072d4f906ba0ed30e87f6b5acfd1be01907142bddac4aec4237cf1301b16c7d90f2ae4d2ba0ee29057f8dd6d4657ac2cb4d0d0
|
7
|
+
data.tar.gz: 47baa040cbad0068c9d7cf4ddad08fc25e48dcfb84ddf8b9f01eb01251a894e159c1214afc3d18bc7102df0c3170043b90ab3571262d0cc044dea71cc9ade798
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
### 1.1.
|
1
|
+
### 1.1.3 (next)
|
2
2
|
|
3
3
|
* Your contribution here.
|
4
4
|
|
5
|
+
### 1.1.2 (02/25/2019)
|
6
|
+
|
7
|
+
* [#63](https://github.com/bbulpett/zebra-zpl/pull/63): Un-restrict font size - [@mtking2](https://github.com/mtking2)
|
8
|
+
* [#62](https://github.com/bbulpett/zebra-zpl/pull/62): Add print service option for print jobs (`lp`/`rlpr`) - [@LagTag](https://github.com/LagTag)
|
9
|
+
|
5
10
|
### 1.1.1 (12/19/2019)
|
6
11
|
|
7
12
|
* [#58](https://github.com/bbulpett/zebra-zpl/pull/58): Add access to source `Img2Zpl::Image` object - [@mtking2](https://github.com/mtking2)
|
data/README.md
CHANGED
@@ -97,6 +97,18 @@ print_job.print label, ip
|
|
97
97
|
|
98
98
|
This will persist the label contents to a tempfile (using Ruby's tempfile core library) and copy the file to the printer using either `rlpr -H <hostname/ip> -P <your-printer-name-on-windows> -o <path-to-the-temp-file>` (for Windows systems, see [section](#printing-directly-to-windows-lpd) below) or `lp -h <hostname/ip> -d <your-printer-name-on-cups> -o raw <path-to-the-tempfile>` (for Unix systems). All the tempfile creation/path resolution, as well as which command has to be used, are handled by the `PrintJob` class.
|
99
99
|
|
100
|
+
##### Print Service
|
101
|
+
|
102
|
+
You can specify what print service command you want to be used when calling the `print` method by setting the `:print_service` option parameter. If left unspecified, it will attempt to send the print job first via `rlpr` - if the `rlpr` command fails in anyway then it will fall back to the `lp` command.
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
print_job.print label, ip, print_service: 'lp' # attempt only via the lp command
|
106
|
+
|
107
|
+
print_job.print label, ip, print_service: 'rlpr' # attempt only via the rlpr command
|
108
|
+
|
109
|
+
print_job.print label, ip # attempt via rlpr first, fallback to lp
|
110
|
+
```
|
111
|
+
|
100
112
|
#### Printing directly to Windows LPD
|
101
113
|
This gem also supports printing directly to shared printer on Windows using LPD.
|
102
114
|
In order to print directly to a LPD on a Windows machine you need two things:
|
data/lib/zebra/print_job.rb
CHANGED
@@ -7,7 +7,7 @@ module Zebra
|
|
7
7
|
@printer = printer
|
8
8
|
end
|
9
9
|
|
10
|
-
def print(label, ip)
|
10
|
+
def print(label, ip, print_service: "")
|
11
11
|
@remote_ip = ip
|
12
12
|
if label.is_a? String
|
13
13
|
tempfile = Tempfile.new "zebra_label"
|
@@ -16,15 +16,22 @@ module Zebra
|
|
16
16
|
else
|
17
17
|
tempfile = label.persist
|
18
18
|
end
|
19
|
-
send_to_printer
|
19
|
+
send_to_printer(tempfile.path, print_service)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def send_to_printer(path)
|
24
|
+
def send_to_printer(path, print_service)
|
25
25
|
puts "* * * * * * * * * * * * Sending file to printer #{@printer} at #{@remote_ip} * * * * * * * * * * "
|
26
|
-
|
27
|
-
|
26
|
+
case print_service
|
27
|
+
when "rlpr"
|
28
|
+
system("rlpr -H #{@remote_ip} -P #{@printer} -o #{path} 2>&1") # try printing to LPD on windows machine
|
29
|
+
when "lp"
|
30
|
+
system("lp -h #{@remote_ip} -d #{@printer} -o raw #{path}") # print to unix (CUPS) using lp
|
31
|
+
else
|
32
|
+
result = system("rlpr -H #{@remote_ip} -P #{@printer} -o #{path} 2>&1") # try printing to LPD on windows machine first
|
33
|
+
system("lp -h #{@remote_ip} -d #{@printer} -o raw #{path}") if !result # print to unix (CUPS) if rlpr failed
|
34
|
+
end
|
28
35
|
end
|
29
36
|
end
|
30
37
|
end
|
data/lib/zebra/zpl/font.rb
CHANGED
data/lib/zebra/zpl/version.rb
CHANGED
data/spec/zebra/zpl/text_spec.rb
CHANGED
@@ -56,7 +56,10 @@ describe Zebra::Zpl::Text do
|
|
56
56
|
describe "#font_size=" do
|
57
57
|
it "raises an error if the received font_size is invalid" do
|
58
58
|
expect {
|
59
|
-
described_class.new.font_size =
|
59
|
+
described_class.new.font_size = -1
|
60
|
+
}.to raise_error(Zebra::Zpl::FontSize::InvalidFontSizeError)
|
61
|
+
expect {
|
62
|
+
described_class.new.font_size = 32001
|
60
63
|
}.to raise_error(Zebra::Zpl::FontSize::InvalidFontSizeError)
|
61
64
|
end
|
62
65
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zebra-zpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barnabas Bulpett
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: img2zpl
|