metaskills-pdf-writer 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/ChangeLog +113 -0
  2. data/LICENCE +131 -0
  3. data/README +33 -0
  4. data/bin/techbook +24 -0
  5. data/demo/chunkybacon.rb +36 -0
  6. data/demo/code.rb +71 -0
  7. data/demo/colornames.rb +47 -0
  8. data/demo/demo.rb +73 -0
  9. data/demo/gettysburg.rb +66 -0
  10. data/demo/hello.rb +26 -0
  11. data/demo/individual-i.rb +89 -0
  12. data/demo/pac.rb +70 -0
  13. data/demo/qr-language.rb +580 -0
  14. data/demo/qr-library.rb +380 -0
  15. data/images/bluesmoke.jpg +0 -0
  16. data/images/chunkybacon.jpg +0 -0
  17. data/images/chunkybacon.png +0 -0
  18. data/lib/pdf/charts.rb +13 -0
  19. data/lib/pdf/charts/stddev.rb +431 -0
  20. data/lib/pdf/core_ext/mutex.rb +11 -0
  21. data/lib/pdf/math.rb +108 -0
  22. data/lib/pdf/quickref.rb +333 -0
  23. data/lib/pdf/simpletable.rb +948 -0
  24. data/lib/pdf/techbook.rb +901 -0
  25. data/lib/pdf/writer.rb +2730 -0
  26. data/lib/pdf/writer/arc4.rb +63 -0
  27. data/lib/pdf/writer/fontmetrics.rb +203 -0
  28. data/lib/pdf/writer/fonts/Courier-Bold.afm +342 -0
  29. data/lib/pdf/writer/fonts/Courier-BoldOblique.afm +342 -0
  30. data/lib/pdf/writer/fonts/Courier-Oblique.afm +342 -0
  31. data/lib/pdf/writer/fonts/Courier.afm +342 -0
  32. data/lib/pdf/writer/fonts/Helvetica-Bold.afm +2827 -0
  33. data/lib/pdf/writer/fonts/Helvetica-BoldOblique.afm +2827 -0
  34. data/lib/pdf/writer/fonts/Helvetica-Oblique.afm +3051 -0
  35. data/lib/pdf/writer/fonts/Helvetica.afm +3051 -0
  36. data/lib/pdf/writer/fonts/MustRead.html +19 -0
  37. data/lib/pdf/writer/fonts/Symbol.afm +213 -0
  38. data/lib/pdf/writer/fonts/Times-Bold.afm +2588 -0
  39. data/lib/pdf/writer/fonts/Times-BoldItalic.afm +2384 -0
  40. data/lib/pdf/writer/fonts/Times-Italic.afm +2667 -0
  41. data/lib/pdf/writer/fonts/Times-Roman.afm +2419 -0
  42. data/lib/pdf/writer/fonts/ZapfDingbats.afm +225 -0
  43. data/lib/pdf/writer/graphics.rb +813 -0
  44. data/lib/pdf/writer/graphics/imageinfo.rb +365 -0
  45. data/lib/pdf/writer/lang.rb +43 -0
  46. data/lib/pdf/writer/lang/en.rb +99 -0
  47. data/lib/pdf/writer/object.rb +23 -0
  48. data/lib/pdf/writer/object/action.rb +35 -0
  49. data/lib/pdf/writer/object/annotation.rb +42 -0
  50. data/lib/pdf/writer/object/catalog.rb +39 -0
  51. data/lib/pdf/writer/object/contents.rb +70 -0
  52. data/lib/pdf/writer/object/destination.rb +40 -0
  53. data/lib/pdf/writer/object/encryption.rb +53 -0
  54. data/lib/pdf/writer/object/font.rb +72 -0
  55. data/lib/pdf/writer/object/fontdescriptor.rb +34 -0
  56. data/lib/pdf/writer/object/fontencoding.rb +40 -0
  57. data/lib/pdf/writer/object/image.rb +304 -0
  58. data/lib/pdf/writer/object/info.rb +51 -0
  59. data/lib/pdf/writer/object/outline.rb +30 -0
  60. data/lib/pdf/writer/object/outlines.rb +30 -0
  61. data/lib/pdf/writer/object/page.rb +195 -0
  62. data/lib/pdf/writer/object/pages.rb +115 -0
  63. data/lib/pdf/writer/object/procset.rb +46 -0
  64. data/lib/pdf/writer/object/viewerpreferences.rb +74 -0
  65. data/lib/pdf/writer/ohash.rb +58 -0
  66. data/lib/pdf/writer/oreader.rb +25 -0
  67. data/lib/pdf/writer/state.rb +48 -0
  68. data/lib/pdf/writer/strokestyle.rb +138 -0
  69. data/manual.pwd +5965 -0
  70. metadata +156 -0
data/ChangeLog ADDED
@@ -0,0 +1,113 @@
1
+ = PDF::Writer Change Log
2
+
3
+ == PDF::Writer 1.2.1: May 13, 2009
4
+ * Ruby 1.9 compatibility.
5
+
6
+ == PDF::Writer 1.1.3: September 9, 2005
7
+ * Fixed #2356 submitted by Matthew Thill. Margins set by the various margins
8
+ methods would behave incorrectly.
9
+
10
+ == PDF::Writer 1.1.2: August 25, 2005
11
+ * Thomas Gantner <thomas.gantner@gmx.net> found a problem with the
12
+ interpretation of the placement of page numbers and provided a patch.
13
+ Thanks!
14
+ * Thomas also reported a problem with an inability to place page numbering on
15
+ the first page of a document, as well as strange results from not providing
16
+ a starting page number. This has been fixed. Also reported as #2204.
17
+ * Modified PDF::Writer requirements to require color-tools version 1.3.0 or
18
+ later. This necessitates that Color constants be changed to Color::RGB
19
+ constants.
20
+ * Updated supporting library documentation to include information on
21
+ color-tools version 1.3.
22
+ * Fixed a bug with Graphics#transform_matrix truncating one of the transform
23
+ parameters.
24
+ * Applied a fix to PDF::SimpleTable submitted by Mike Leddy in #2129 on the
25
+ RubyForge tracker.
26
+ * Applied a partial fix for PNG with index-transparency provided by Marc
27
+ Vleugels in #2245 on the RubyForge tracker. NOTE: This does not solve the
28
+ transparency problem; at this point, PDF::Writer cannot be said to support
29
+ PNGs with transparency. This will be fixed in a later version of
30
+ PDF::Writer.
31
+
32
+ == PDF::Writer 1.1.1: July 1, 2005
33
+ * Fixed the packaging process; the .tar.gz files will no longer corrupt the
34
+ images.
35
+ * Added the images and the manual (both raw and generated) to the demo
36
+ package.
37
+
38
+ == PDF::Writer 1.1.0: June 29, 2005
39
+ NOTE: The first two changes are INCOMPATIBLE with previous versions of
40
+ PDF::Writer. If you find that your text is showing up at odd angles, negate
41
+ the value. That is, if you have 90 as your angle, use -90 (or 270) as your
42
+ angle and it will work like it used to.
43
+
44
+ * Axis transformations in PDF::Writer::Graphics have been fixed.
45
+ * Text axis transformation in PDF::Writer#add_text has been fixed.
46
+ * Changed #text_width and #text_line_width so that the text value is the
47
+ first parameter and the size parameter is second, and is optional. The code
48
+ warns about it now, but it will break in PDF::Writer 2.0.
49
+ * Changed #add_text and #add_text_wrap so that the text parameter is before
50
+ the now-optional size parameter. The code warns about it now, but it will
51
+ break in PDF::Writer 2.0.
52
+ * Added #transform_matrix.
53
+ * Fixed compression. NOTE: Compression must be set early in the documentation
54
+ process, or only some items will be compressed in the document. The various
55
+ #save_as methods have been changed to reflect this fact.
56
+ * Enabled the placement of encoding differences dictionaries in the resulting
57
+ PDF document. This change should be considered experimental.
58
+ * Added TTF licence checking. The embedding of a file not licenced for
59
+ inclusion in a document will continue, but a warning will be output to
60
+ standard error. This code has been gakked from FPDF (http://www.fpdf.org).
61
+ * Properly supporting symbolic font flags now.
62
+ * Added support and documentation for a separately downloadable demo package.
63
+ * Expanded the installation documentation.
64
+ * Added the ability to make images clickable links with any of the three
65
+ image insertion methods.
66
+
67
+ == PDF::Writer 1.0.1: June 13, 2005
68
+ * Fixed a few minor gem issues.
69
+ * Renamed bin/manual to bin/techbook.
70
+ * Fixed the manual.pwd locator for the default install.
71
+
72
+ == PDF::Writer 1.0.0: June 12, 2005
73
+ * Integrated ezwriter.rb functionality with writer.rb.
74
+ * Factored out some functionality into modules and classes.
75
+ * Added CMYK colour support to JPEG images.
76
+ * Uses Color::CMYK (from color-utils) to provide CMYK support to drawing
77
+ capabilities.
78
+ * Simplified the image API significantly.
79
+ * Modified image support to properly handle full image flipping.
80
+ * Fixed several multi-column issues.
81
+ * Fixed a bug where new pages automatically started by overflowing text may
82
+ have resulted in writing the first line of text above the top margin. This
83
+ may need further testing and probably causes problems with column handling.
84
+ * Fixed some page numbering issues.
85
+ * Added several demos, including Ruby Quick Reference Sheets.
86
+ * Scrubbed the API.
87
+ * Updated the documentation.
88
+ * Changed installer to setup.rb 3.3.1-modified.
89
+ * Applied an image resize patch; the image will be resized manually before
90
+ checking to see if a new page is required. Thanks to Leslie Hensley.
91
+ * Fixed a bug where entities would generate the width specified for the
92
+ component characters, not the represented characters.
93
+ * Fixed a performance bug. Thanks again to Leslie Hensley.
94
+
95
+ == PDF::Writer 0.1.2: CVS only
96
+ * Fixed a problem with the improper reading of character numbers from .afm
97
+ files that are not default files. Other font issues remain but will be fixed
98
+ at a later date.
99
+
100
+ == PDF::Writer 0.1.0: September, 2003
101
+ * Initial technology preview.
102
+
103
+ #--
104
+ # PDF::Writer for Ruby.
105
+ # http://rubyforge.org/projects/ruby-pdf/
106
+ # Copyright 2003 - 2005 Austin Ziegler.
107
+ #
108
+ # Licensed under a MIT-style licence. See LICENCE in the main distribution
109
+ # for full licensing information.
110
+ #
111
+ # $Id$
112
+ #++
113
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/LICENCE ADDED
@@ -0,0 +1,131 @@
1
+ = PDF::Writer for Ruby
2
+ Homepage:: http://rubyforge.org/projects/ruby-pdf/
3
+ Copyright:: Copyright � 2003�2005 Austin Ziegler.
4
+ Summary:: MIT-style
5
+
6
+ This project had a change of maintainers in November, 2007.
7
+ New developments are now copyrighted by Gregory Brown and Michael Milner,
8
+ unless otherwise noted.
9
+
10
+ ---
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ * The names of its contributors may not be used to endorse or promote
20
+ products derived from this software without specific prior written
21
+ permission.
22
+
23
+ The above copyright notice and this permission notice shall be included in
24
+ all copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ SOFTWARE.
33
+
34
+ == Works Included Under Other Licences
35
+ === pdf/writer/graphics/imageinfo.rb
36
+ PDF::Writer includes a derivative of Keisuke Minami's ImageSize library,
37
+ which can be found at rubycgi[http://www.rubycgi.org/tools/index.en.htm].
38
+ This work�and only this or other named works�may be treated as under the Ruby
39
+ licensing scheme (GPL 2 or later, Ruby's licence) as well as the overall
40
+ PDF::Writer licence.
41
+
42
+ === Ruby Quick Reference Sheets
43
+ PDF::Writer has demo programs that will create Quick Reference cards for
44
+ Ruby. The content and output of these programs is copyright 2003�2005 Ryan
45
+ Davis and is licensed under the Creative Commons
46
+ Attribution-NonCommercial-ShareAlike[http://creativecommons.org/licenses/by-nc-sa/2.0/]
47
+ licence.
48
+
49
+ === Images from "Why's (Poignant) Guide to Ruby"
50
+ One of the demo programs uses images originally from "Why's (Poignant) Guide
51
+ to Ruby"[http://poignantguide.net/ruby], with permission. These immages are
52
+ released under the Creative Commons
53
+ Attributions ShareAlike[http://creativecommons.org/licenses/by-sa/2.0/]
54
+ licence.
55
+
56
+ === Adobe PostScript AFM Files
57
+ pdf/writer/fonts/MustRead.html and the 14 PostScript(R) AFM files it
58
+ accompanies may be used, copied, and distributed for any purpose and without
59
+ charge, with or without modification, provided that all copyright notices are
60
+ retained; that the AFM files are not distributed without this file; that all
61
+ modifications to this file or any of the AFM files are prominently noted in
62
+ the modified file(s); and that this paragraph is not modified. Adobe Systems
63
+ has no responsibility or obligation to support the use of the AFM files.
64
+
65
+ == Other Credits
66
+ === PDF::Writer
67
+ PDF::Writer is based originally on the R & OS PDF class for
68
+ PHP[http://www.ros.co.nz/pdf/], which is released as public domain.
69
+
70
+ === Standard Deviation Chart
71
+ The standard deviation chart (pdf/charts/stddev.rb) class is based on
72
+ work by Cris Ewing[mailto:cewing@u.washington.edu] of the University of
73
+ Washington School of Medicine, originally created for the R & OS PDF class
74
+ for PHP. He has graciously donated the code for PDF::Writer for Ruby.
75
+
76
+ === bluesmoke.jpg
77
+ The logo image for PDF::Writer, bluesmoke.jpg, is modified from a picture
78
+ taken by Matthew "TheSaint" Bowden[mailto:matthewbowden@gmail.com] and is
79
+ available on the stock.xchng(R) at
80
+ <http://www.sxc.hu/browse.phtml?f=view&id=275430>. Many thanks to Matthew for
81
+ the use of this image.
82
+
83
+ == Patents Covering the Adobe PDF Format
84
+ === ADOBE PATENTS
85
+ This software is based on Adobe's PDF Reference, Third Edition, version 1.6.
86
+ There may be limitations on the use of this library based on patent
87
+ restrictions from Adobe. See bewlow for more information.
88
+
89
+ === UNISYS LZW PATENT
90
+ This software does not fully conform to the Adobe PDF specification because
91
+ no support for LZW is included in this software. At the time of original
92
+ development of this software (2003), the Unisys LZW patent was still in
93
+ effect outside of the United States. This will be modified in a future
94
+ version of this software.
95
+
96
+ == Patent Clarification Notice: Reading and Writing PDF Files
97
+ Adobe has a number of patents covering technology that is disclosed in the
98
+ Portable Document Format (PDF) Specification, version 1.6 and later, as
99
+ documented in PDF Reference and associated Technical Notes (the
100
+ "Specification". Adobe desires to promote the use of PDF for information
101
+ interchange among diverse products and applications.
102
+
103
+ Accordingly, the following patents are licensed on a royalty-free, non-
104
+ exclusive basis for the term of each patent and for the sole purpose of
105
+ developing software that produces, consumes, and interprets PDF files that
106
+ are compliant with the Specification:
107
+
108
+ U.S. Patent Numbers: 5,634,064; 5,737,599; 5,781,785; 5,819,301; 6,028,583;
109
+ 6,289,364; 6,421,460
110
+
111
+ In addition, the following patent is licensed on a royalty-free, non-
112
+ exclusive basis for its term and for the sole purpose of developing software
113
+ that produces PDF files that are compliant with the Specification
114
+ (specifically excluding, however, software that consumes and/or interprets
115
+ PDF files):
116
+
117
+ U.S. Patent Numbers: 5,860,074
118
+
119
+ The above licenses are limited to only those rights required to implement the
120
+ Specification and no others. That is to say, Adobe grants only those rights
121
+ in the above patent(s) necessarily practiced to implement the Specification,
122
+ and does not grant any rights not required to implement the Specification.
123
+ The licenses do not grant the right to practice any patent covering other
124
+ technologies, such as implementation techniques that are not explicitly
125
+ disclosed in the Specification, nor does it allow the use of any patented
126
+ feature for any purpose other than as set forth in the applicable license
127
+ grant. Adobe has other patents in various fields, none of which are hereby
128
+ licensed.
129
+
130
+ $Id$
131
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/README ADDED
@@ -0,0 +1,33 @@
1
+ = PDF::Writer for Ruby
2
+ This library provides the ability to create PDF documents using only native
3
+ Ruby libraries. There are several demo programs available in the demo/
4
+ directory. The canonical documentation for PDF::Writer is "manual.pdf", which
5
+ can be generated using bin/techbook (just "techbook" for RubyGem users) and
6
+ the manual file "manual.pwd".
7
+
8
+ Homepage:: http://rubyforge.org/projects/ruby-pdf/
9
+ Copyright:: 2003�2005, Austin Ziegler
10
+
11
+ This software is based on Adobe's PDF Reference, Fifth Edition, version 1.6.
12
+ This and earlier editions are available from Adobe's PDF developer
13
+ website[http://partners.adobe.com/public/developer/pdf/index_reference.html].
14
+
15
+ == LICENCE NOTES
16
+ Please read the file LICENCE for licensing restrictions on this library, as
17
+ well as important patent considerations.
18
+
19
+ == Requirements
20
+ PDF::Writer requires Ruby 1.8.2 or better, Color 1.4.0 or better, and
21
+ Transaction::Simple 1.3.0 or better.
22
+
23
+ #--
24
+ # PDF::Writer for Ruby.
25
+ # http://rubyforge.org/projects/ruby-pdf/
26
+ # Copyright 2003 - 2005 Austin Ziegler.
27
+ #
28
+ # Licensed under a MIT-style licence. See LICENCE in the main distribution
29
+ # for full licensing information.
30
+ #
31
+ # $Id$
32
+ #++
33
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/bin/techbook ADDED
@@ -0,0 +1,24 @@
1
+ #! /usr/bin/env ruby
2
+ #--
3
+ # PDF::Writer for Ruby.
4
+ # http://rubyforge.org/projects/ruby-pdf/
5
+ # Copyright 2003 - 2005 Austin Ziegler.
6
+ #
7
+ # Licensed under a MIT-style licence. See LICENCE in the main distribution
8
+ # for full licensing information.
9
+ #
10
+ # $Id$
11
+ #++
12
+ begin
13
+ require 'pdf/techbook'
14
+ rescue LoadError => le
15
+ if le.message =~ %r{pdf/techbook$}
16
+ root = File.dirname(File.dirname(File.expand_path(__FILE__)))
17
+ $LOAD_PATH.unshift(File.join(root, "lib"))
18
+ require 'pdf/techbook'
19
+ else
20
+ raise
21
+ end
22
+ end
23
+
24
+ PDF::TechBook.run(ARGV)
@@ -0,0 +1,36 @@
1
+ #--
2
+ # PDF::Writer for Ruby.
3
+ # http://rubyforge.org/projects/ruby-pdf/
4
+ # Copyright 2003 - 2005 Austin Ziegler.
5
+ #
6
+ # Licensed under a MIT-style licence. See LICENCE in the main distribution
7
+ # for full licensing information.
8
+ #
9
+ # Images used in this demo are copyright 2004 - 2005 Why the Lucky Stiff
10
+ # and are from "Why's (Poignant) Guide to Ruby" at
11
+ # <http://poignantguide.net/ruby> with permission.
12
+ #
13
+ # $Id$
14
+ #++
15
+ begin
16
+ require 'pdf/writer'
17
+ rescue LoadError => le
18
+ if le.message =~ %r{pdf/writer$}
19
+ $LOAD_PATH.unshift("../lib")
20
+ require 'pdf/writer'
21
+ else
22
+ raise
23
+ end
24
+ end
25
+
26
+ pdf = PDF::Writer.new
27
+ pdf.select_font "Times-Roman"
28
+ pdf.text "Chunky Bacon!!", :font_size => 72, :justification => :center
29
+
30
+ i0 = pdf.image "../images/chunkybacon.jpg", :resize => 0.75
31
+ i1 = pdf.image "../images/chunkybacon.png", :justification => :center, :resize => 0.75
32
+ pdf.image i0, :justification => :right, :resize => 0.75
33
+
34
+ pdf.text "Chunky Bacon!!", :font_size => 72, :justification => :center
35
+
36
+ pdf.save_as("chunkybacon.pdf")
data/demo/code.rb ADDED
@@ -0,0 +1,71 @@
1
+ #--
2
+ # PDF::Writer for Ruby.
3
+ # http://rubyforge.org/projects/ruby-pdf/
4
+ # Copyright 2003 - 2005 Austin Ziegler.
5
+ #
6
+ # Licensed under a MIT-style licence. See LICENCE in the main distribution
7
+ # for full licensing information.
8
+ #
9
+ # The code in this file is highly experimental and is not generally ready
10
+ # for use. I can't figure out why the stuff *after* is so far to the right.
11
+ # I'll need to play with the X position some to get it right. This will NOT
12
+ # make it into the 1.0 release. Maybe 1.1 or 1.2.
13
+ #
14
+ # $Id$
15
+ #++
16
+ begin
17
+ require 'pdf/writer'
18
+ rescue LoadError => le
19
+ if le.message =~ %r{pdf/writer$}
20
+ $LOAD_PATH.unshift("../lib")
21
+ require 'pdf/writer'
22
+ else
23
+ raise
24
+ end
25
+ end
26
+
27
+ pdf = PDF::Writer.new
28
+ pdf.select_font "Times-Roman"
29
+
30
+ class TagCodeFont
31
+ FONT_NAME = "Courier"
32
+ FONT_ENCODING = nil
33
+ FONT_SIZE_DIFF = 0.9
34
+
35
+ class << self
36
+ attr_accessor :font_name
37
+
38
+ def [](pdf, info)
39
+ @font_name ||= FONT_NAME
40
+ @font_encoding ||= FONT_ENCODING
41
+
42
+ case info[:status]
43
+ when :start, :start_line
44
+ @__fontinfo ||= {}
45
+ @__fontinfo[info[:cbid]] = {
46
+ :font => pdf.current_font,
47
+ :base_font => pdf.current_base_font,
48
+ :info => info
49
+ }
50
+
51
+ pdf.select_font(@font_name, @font_encoding)
52
+
53
+ { :font_change => true }
54
+ when :end, :end_line
55
+ fi = @__fontinfo[info[:cbid]]
56
+
57
+ pdf.font_size = fi[:font_size]
58
+ pdf.select_font(fi[:base_font])
59
+ pdf.select_font(fi[:font])
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ PDF::Writer::TAGS[:pair]["code"] = TagCodeFont
66
+
67
+ pdf.text "Hello, <c:code>Ruby</c:code>.", :font_size => 72, :justification => :center
68
+ pdf.move_pointer(80)
69
+ pdf.text "This is a longer <c:code>sample of code font text</c:code>. What do you think?", :font_size => 12, :justification => :full
70
+
71
+ pdf.save_as("code.pdf")
@@ -0,0 +1,47 @@
1
+ #--
2
+ # PDF::Writer for Ruby.
3
+ # http://rubyforge.org/projects/ruby-pdf/
4
+ # Copyright 2003 - 2005 Austin Ziegler.
5
+ #
6
+ # Licensed under a MIT-style licence. See LICENCE in the main distribution
7
+ # for full licensing information.
8
+ #
9
+ # $Id$
10
+ #++
11
+ begin
12
+ require 'pdf/writer'
13
+ rescue LoadError => le
14
+ if le.message =~ %r{pdf/writer$}
15
+ $LOAD_PATH.unshift("../lib")
16
+ require 'pdf/writer'
17
+ else
18
+ raise
19
+ end
20
+ end
21
+
22
+ require 'color/rgb/metallic'
23
+
24
+ pdf = PDF::Writer.new
25
+
26
+ pdf.start_columns 4
27
+
28
+ colours = Color::RGB.constants.sort
29
+
30
+ colours.each do |colour|
31
+ next if colour == "PDF_FORMAT_STR"
32
+ next if colour == "Metallic"
33
+ pdf.fill_color Color::RGB.const_get(colour)
34
+ pdf.text colour, :font_size => 24
35
+ pdf.fill_color Color::RGB::Black
36
+ pdf.text colour, :font_size => 12, :justification => :center
37
+ end
38
+
39
+ colours = Color::RGB::Metallic.constants.sort
40
+ colours.each do |colour|
41
+ pdf.fill_color Color::RGB::Metallic.const_get(colour)
42
+ pdf.text colour, :font_size => 24
43
+ pdf.fill_color Color::RGB::Black
44
+ pdf.text colour, :font_size => 12, :justification => :center
45
+ end
46
+
47
+ pdf.save_as "colornames.pdf"