prawn-labels 0.11.4.0 → 0.11.5.0

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.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Prawn/Labels: A simple label generator for Prawn PDFs
1
+ # Prawn/Labels: Label generator for Prawn PDFs
2
2
 
3
3
  Prawn/Labels takes the guess work out of generating labels using Prawn >= 0.12.0
4
4
 
@@ -84,6 +84,22 @@ Prawn::Labels.generate("names.pdf", names, :type => "QuarterSheet") do |pdf, nam
84
84
  end
85
85
  ```
86
86
 
87
+ ### Prawn document options
88
+
89
+ Prawn::Labels allows passing a hash of document options all the way through to Prawn.
90
+
91
+ ```ruby
92
+ require 'prawn/labels'
93
+
94
+ names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
95
+
96
+ Prawn::Labels.generate("names.pdf", names, type: "Avery5160", document: { page_layout: :landscape }) do |pdf, name|
97
+ pdf.text name
98
+ end
99
+ ```
100
+
101
+ Other document properties that can be set via this hash can be found in the [Prawn Documentation](http://prawn.majesticseacreature.com/docs/0.11.1/Prawn/Document.html#method-c-new)
102
+
87
103
  ## Contributors
88
104
 
89
105
  - [Jordan Byron](http://jordanbyron.com)
@@ -91,4 +107,5 @@ end
91
107
  - [Carlo Biedenharn](mailto:cbieden@mit.edu)
92
108
  - [Forrest Zeisler](https://github.com/forrest)
93
109
  - [Jack Twilley](https://github.com/mathuin)
94
- - [Ori Pekelman](https://github.com/OriPekelman)
110
+ - [Ori Pekelman](https://github.com/OriPekelman)
111
+ - [Branden Gunn](https://github.com/engunneer)
@@ -0,0 +1,10 @@
1
+ require File.join(File.dirname(__FILE__), "example_helper")
2
+
3
+ fancy_names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
4
+ "Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
5
+ "Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
6
+ "Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
7
+ "Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
8
+ Prawn::Labels.generate("hello_labels_landscape.pdf", fancy_names, { :type => "Avery5160", document: { page_layout: :landscape } }) do |pdf, name|
9
+ pdf.text name
10
+ end
data/lib/prawn/labels.rb CHANGED
@@ -48,15 +48,18 @@ module Prawn
48
48
  type["paper_size"] ||= "A4"
49
49
  type["top_margin"] ||= 36
50
50
  type["left_margin"] ||= 36
51
-
51
+
52
+ options[:document] ||= {}
53
+
52
54
  options.merge!(:vertical_text => true) if type["vertical_text"]
53
55
 
54
- @document = Document.new :page_size => type["paper_size"],
56
+ @document = Document.new options[:document].merge(
57
+ :page_size => type["paper_size"],
55
58
  :top_margin => type["top_margin"],
56
59
  :bottom_margin => type["bottom_margin"],
57
60
  :left_margin => type["left_margin"],
58
- :right_margin => type["right_margin"]
59
-
61
+ :right_margin => type["right_margin"])
62
+
60
63
  generate_grid @type
61
64
 
62
65
  data.each_with_index do |record, index|
data/lib/prawn/types.yaml CHANGED
@@ -46,3 +46,14 @@ Avery6572:
46
46
  rows: 5
47
47
  column_gutter: 9
48
48
  row_gutter: 0
49
+ # Avery 6871
50
+ Avery6871:
51
+ paper_size: LETTER
52
+ top_margin: 80
53
+ bottom_margin: 80
54
+ left_margin: 26.9
55
+ right_margin: 26.9
56
+ columns: 3
57
+ rows: 6
58
+ column_gutter: 22.6
59
+ row_gutter: 18.4
data/prawn-labels.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- PRAWN_LABELS_VERSION = "0.11.4.0"
1
+ PRAWN_LABELS_VERSION = "0.11.5.0"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "prawn-labels"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-labels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4.0
4
+ version: 0.11.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-05 00:00:00.000000000 Z
12
+ date: 2013-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: prawn
@@ -45,6 +45,7 @@ files:
45
45
  - examples/envelope_labels.rb
46
46
  - examples/example_helper.rb
47
47
  - examples/hello_labels.rb
48
+ - examples/hello_labels_landscape.rb
48
49
  - examples/horiz_and_vert_labels.rb
49
50
  - examples/image_labels.rb
50
51
  - examples/shrink_to_fit.rb
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  version: 1.3.6
81
82
  requirements: []
82
83
  rubyforge_project: prawn-labels
83
- rubygems_version: 1.8.24
84
+ rubygems_version: 1.8.23
84
85
  signing_key:
85
86
  specification_version: 3
86
87
  summary: Make labels using Prawn