prawn 0.13.0 → 0.14.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.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/Gemfile +7 -14
- data/Rakefile +5 -10
- data/data/images/16bit.alpha +0 -0
- data/data/images/16bit.color +0 -0
- data/data/images/dice.alpha +0 -0
- data/data/images/dice.color +0 -0
- data/data/images/page_white_text.alpha +0 -0
- data/data/images/page_white_text.color +0 -0
- data/lib/pdf/core/document_state.rb +3 -2
- data/lib/pdf/core/graphics_state.rb +29 -8
- data/lib/pdf/core/object_store.rb +6 -15
- data/lib/pdf/core/pdf_object.rb +8 -33
- data/lib/prawn/document/bounding_box.rb +11 -0
- data/lib/prawn/document/column_box.rb +12 -4
- data/lib/prawn/document.rb +30 -42
- data/lib/prawn/encoding.rb +1 -2
- data/lib/prawn/font/afm.rb +71 -30
- data/lib/prawn/font/dfont.rb +1 -1
- data/lib/prawn/font/ttf.rb +10 -2
- data/lib/prawn/font.rb +7 -8
- data/lib/prawn/graphics.rb +8 -7
- data/lib/prawn/image_handler.rb +4 -0
- data/lib/prawn/images/jpg.rb +9 -10
- data/lib/prawn/images/png.rb +46 -118
- data/lib/prawn/images.rb +2 -7
- data/lib/prawn/layout.rb +2 -2
- data/lib/prawn/measurement_extensions.rb +1 -1
- data/lib/prawn/table/cells.rb +6 -2
- data/lib/prawn/table/column_width_calculator.rb +55 -0
- data/lib/prawn/table.rb +9 -22
- data/lib/prawn/templates.rb +75 -0
- data/lib/prawn/text/formatted/arranger.rb +1 -5
- data/lib/prawn/text/formatted/box.rb +1 -1
- data/lib/prawn/text/formatted/fragment.rb +5 -11
- data/lib/prawn/text/formatted/line_wrap.rb +4 -25
- data/lib/prawn/text/formatted/wrap.rb +1 -4
- data/lib/prawn.rb +1 -2
- data/manual/document_and_page_options/document_and_page_options.rb +2 -1
- data/manual/document_and_page_options/metadata.rb +3 -3
- data/manual/document_and_page_options/print_scaling.rb +20 -0
- data/manual/example_file.rb +2 -7
- data/manual/manual/cover.rb +3 -2
- data/manual/manual/manual.rb +1 -2
- data/prawn.gemspec +10 -6
- data/spec/bounding_box_spec.rb +12 -0
- data/spec/column_box_spec.rb +32 -0
- data/spec/document_spec.rb +5 -7
- data/spec/extensions/encoding_helpers.rb +2 -3
- data/spec/filters_spec.rb +1 -1
- data/spec/font_spec.rb +3 -2
- data/spec/formatted_text_box_spec.rb +14 -25
- data/spec/graphics_spec.rb +18 -0
- data/spec/image_handler_spec.rb +12 -0
- data/spec/images_spec.rb +2 -6
- data/spec/line_wrap_spec.rb +2 -2
- data/spec/object_store_spec.rb +6 -0
- data/spec/outline_spec.rb +10 -10
- data/spec/png_spec.rb +9 -12
- data/spec/table_spec.rb +55 -2
- data/spec/{template_spec.rb → template_spec_obsolete.rb} +2 -1
- data/spec/text_at_spec.rb +11 -26
- data/spec/text_box_spec.rb +6 -2
- data/spec/text_spec.rb +39 -27
- metadata +58 -38
- data/README.md +0 -109
- data/data/images/16bit.dat +0 -0
- data/data/images/dice.dat +0 -0
- data/data/images/page_white_text.dat +0 -0
- data/lib/prawn/compatibility.rb +0 -91
- data/manual/templates/full_template.rb +0 -25
- data/manual/templates/page_template.rb +0 -48
- data/manual/templates/templates.rb +0 -27
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
#<b>NOTE: Templates are currently unmaintained and may be removed by Prawn 1.0!</b>
|
4
|
-
#
|
5
|
-
# You may load another PDF while creating a new one. Just pass the loaded PDF
|
6
|
-
# filename to the <code>:template</code> option when creating/generating the new
|
7
|
-
# PDF.
|
8
|
-
#
|
9
|
-
# The provided PDF will be loaded and its first page will be set as the
|
10
|
-
# current page. If you'd like to resume the document you may take advantage of
|
11
|
-
# two helpers: <code>page_count</code> and <code>go_to_page</code>.
|
12
|
-
#
|
13
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
14
|
-
%w[.. example_helper]))
|
15
|
-
|
16
|
-
filename = "#{Prawn::DATADIR}/pdfs/multipage_template.pdf"
|
17
|
-
|
18
|
-
Prawn::Example.generate("full_template.pdf", :template => filename) do
|
19
|
-
go_to_page(page_count)
|
20
|
-
|
21
|
-
start_new_page
|
22
|
-
|
23
|
-
text "Previous pages and content imported.", :align => :center
|
24
|
-
text "This page and content is brand new.", :align => :center
|
25
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# <b>NOTE: Templates are currently unmaintained and may be removed by Prawn 1.0!</b>
|
3
|
-
#
|
4
|
-
# If you only need to load some pages from another PDF, you can accomplish it
|
5
|
-
# with the <code>start_new_page</code> method. You may pass it a
|
6
|
-
# <code>:template</code> option with the path for an existing pdf and a
|
7
|
-
# <code>:template_page</code> option to specify which page to load.
|
8
|
-
# You can also load a <code>:template</code> using a URI:
|
9
|
-
#
|
10
|
-
# <code>require 'open-uri'</code>
|
11
|
-
#
|
12
|
-
# <code>start_new_page(:template => open('url_for_your.pdf'))</code>
|
13
|
-
#
|
14
|
-
# The following example loads some pages from an existing PDF. If we don't
|
15
|
-
# specify the <code>:template_page</code> option, the first page of the template
|
16
|
-
# PDF will be loaded. That's what happens on the first load below. Then we load
|
17
|
-
# a page by specifying the <code>:template_page</code> option and then we do it
|
18
|
-
# again this time adding some content to the loaded page.
|
19
|
-
#
|
20
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
21
|
-
%w[.. example_helper]))
|
22
|
-
|
23
|
-
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
24
|
-
Prawn::Example.generate(filename) do
|
25
|
-
text "Please scan the next 3 pages to see the page templates in action."
|
26
|
-
move_down 10
|
27
|
-
text "You also might want to look at the pdf used as a template: "
|
28
|
-
url = "https://github.com/prawnpdf/prawn/raw/master/data/pdfs/form.pdf"
|
29
|
-
move_down 10
|
30
|
-
|
31
|
-
formatted_text [{:text => url, :link => url}]
|
32
|
-
|
33
|
-
filename = "#{Prawn::DATADIR}/pdfs/form.pdf"
|
34
|
-
start_new_page(:template => filename)
|
35
|
-
|
36
|
-
start_new_page(:template => filename, :template_page => 2)
|
37
|
-
|
38
|
-
start_new_page(:template => filename, :template_page => 2)
|
39
|
-
|
40
|
-
fill_color "FF8888"
|
41
|
-
|
42
|
-
text_box "John Doe", :at => [75, cursor-75]
|
43
|
-
text_box "john@doe.com", :at => [75, cursor-105]
|
44
|
-
text_box "John Doe inc", :at => [75, cursor-135]
|
45
|
-
text_box "You didn't think I'd tell, did you?", :at => [75, cursor-165]
|
46
|
-
|
47
|
-
fill_color "000000"
|
48
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Examples for loading existing pdfs.
|
4
|
-
#
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
-
%w[.. example_helper]))
|
7
|
-
|
8
|
-
Prawn::Example.generate("templates.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
|
-
package "templates" do |p|
|
11
|
-
|
12
|
-
p.example "full_template", :eval_source => false, :full_source => true
|
13
|
-
p.example "page_template"
|
14
|
-
|
15
|
-
p.intro do
|
16
|
-
prose("<b>NOTE: Templates are currently unmaintained and may be removed by Prawn 1.0!</b>")
|
17
|
-
prose("Templates let you embed other PDF documents inside the current one.
|
18
|
-
|
19
|
-
The examples show:")
|
20
|
-
|
21
|
-
list( "How to load the whole content from another PDF",
|
22
|
-
"How to load single pages from another PDF"
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|