Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial import of PDF-Template-PDFAPI2 0.40_01 from CPAN

git-cpan-module:   PDF-Template-PDFAPI2
git-cpan-version:  0.40_01
git-cpan-authorid: AUTRIJUS
git-cpan-file:     authors/id/A/AU/AUTRIJUS/PDF-Template-PDFAPI2-0.40_01.tar.gz
  • Loading branch information...
commit bead723a2ebb97c4261d032221aae579ef1cd471 0 parents
authored June 02, 2004 schwern committed December 12, 2009

Showing 54 changed files with 5,522 additions and 0 deletions. Show diff stats Hide diff stats

  1. 43  Changes
  2. 383  LICENSE
  3. 54  MANIFEST
  4. 15  META.yml
  5. 95  Makefile.PL
  6. 8  README
  7. 91  TESTPLAN
  8. 7  Todo
  9. 39  examples/report.xml
  10. 401  lib/PDF/Template.pm
  11. 141  lib/PDF/Template/Base.pm
  12. 103  lib/PDF/Template/Constants.pm
  13. 159  lib/PDF/Template/Container.pm
  14. 95  lib/PDF/Template/Container/Always.pm
  15. 190  lib/PDF/Template/Container/Conditional.pm
  16. 168  lib/PDF/Template/Container/Font.pm
  17. 82  lib/PDF/Template/Container/Footer.pm
  18. 82  lib/PDF/Template/Container/Header.pm
  19. 174  lib/PDF/Template/Container/Loop.pm
  20. 100  lib/PDF/Template/Container/Margin.pm
  21. 243  lib/PDF/Template/Container/PageDef.pm
  22. 132  lib/PDF/Template/Container/PdfTemplate.pm
  23. 101  lib/PDF/Template/Container/Row.pm
  24. 74  lib/PDF/Template/Container/Scope.pm
  25. 130  lib/PDF/Template/Container/Section.pm
  26. 285  lib/PDF/Template/Context.pm
  27. 83  lib/PDF/Template/Element.pm
  28. 92  lib/PDF/Template/Element/Bookmark.pm
  29. 140  lib/PDF/Template/Element/Circle.pm
  30. 72  lib/PDF/Template/Element/HorizontalRule.pm
  31. 241  lib/PDF/Template/Element/Image.pm
  32. 167  lib/PDF/Template/Element/Line.pm
  33. 102  lib/PDF/Template/Element/PageBreak.pm
  34. 429  lib/PDF/Template/Element/TextBox.pm
  35. 76  lib/PDF/Template/Element/Var.pm
  36. 99  lib/PDF/Template/Element/Weblink.pm
  37. 149  lib/PDF/Template/Factory.pm
  38. 216  lib/PDF/Template/Iterator.pm
  39. 51  lib/PDF/Template/TextObject.pm
  40. 12  t/001_load.t
  41. 68  t/002_simple.t
  42. 66  t/003_basic.t
  43. 8  t/templates/002_1/buffer.txt
  44. 0  t/templates/002_1/vars.txt
  45. 1  t/templates/002_1/xml.txt
  46. 10  t/templates/002_2/buffer.txt
  47. 0  t/templates/002_2/vars.txt
  48. 3  t/templates/002_2/xml.txt
  49. 17  t/templates/002_3/buffer.txt
  50. 0  t/templates/002_3/vars.txt
  51. 9  t/templates/002_3/xml.txt
  52. 10  t/templates/003_1/buffer.txt
  53. 3  t/templates/003_1/vars.txt
  54. 3  t/templates/003_1/xml.txt
43  Changes
... ...
@@ -0,0 +1,43 @@
  1
+Revision history for Perl module PDF::Template
  2
+
  3
+0.18 Thu Apr 08 07:30:00 2004
  4
+    - Fixed bug regarding empty arrays as loop variables
  5
+
  6
+0.17 Wed Mar 17 12:00:00 2003
  7
+    - Fixed bug introduced in 0.16 (loop parameters weren't case-insensitive)
  8
+
  9
+0.16 Wed Mar 17 12:00:00 2003
  10
+    - Parameter names are now case-insensitive
  11
+
  12
+0.15 Tue Mar 16 12:00:00 2003
  13
+    - Fixed bug w/using the same image in more than one <image> tag
  14
+
  15
+0.13 Tue Jan 20 12:30:00 2003
  16
+    - Fixed bug IMAGE tag (caused by ..::Font::begin_page() not calling SUPER)
  17
+    - Added Base to allow for external entities to be referenced by filename
  18
+      without hard-coding the directory name.
  19
+
  20
+0.12 Tue Dec 19 11:30:00 2003
  21
+    - Fixed bug with HEADERs not appearing when landscape is set
  22
+
  23
+0.12 Tue Dec 16 09:30:00 2003
  24
+    - Fixed bug with HEADERs not appearing where appropriate when
  25
+      PAGE_SIZE option is chosen.
  26
+
  27
+0.11 Fri Dec 07 17:00:00 2003
  28
+    - Makefile.PL has two changes:
  29
+        - <> => <STDIN>
  30
+        - 5.8+ will now not ask you about Unicode support.
  31
+    - PDF::Template::Factory::register() now works correctly
  32
+    - All nodes are now documented (still need to document helper classes)
  33
+    - WEBLINK will now work with parameterized X1/X2/Y1/Y2
  34
+
  35
+    Thanks to Nathan Byrd for pointing out and providing patches for two bugs.
  36
+
  37
+0.10 Fri Nov 30 17:00:00 2003
  38
+    - Wholescale changes to the underlying structure
  39
+    - Addition of a concept of scope, allowing for relative positioning
  40
+    - Support for CJK fonts
  41
+    - Maintenance fixes
  42
+    - Turnover of maintenance from David Ferrance to Rob Kinyon
  43
+
383  LICENSE
... ...
@@ -0,0 +1,383 @@
  1
+Terms of Perl itself
  2
+
  3
+a) the GNU General Public License as published by the Free
  4
+   Software Foundation; either version 1, or (at your option) any
  5
+   later version, or
  6
+b) the "Artistic License"
  7
+
  8
+---------------------------------------------------------------------------
  9
+
  10
+The General Public License (GPL)
  11
+Version 2, June 1991
  12
+
  13
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
  14
+Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
  15
+verbatim copies of this license document, but changing it is not allowed.
  16
+
  17
+Preamble
  18
+
  19
+The licenses for most software are designed to take away your freedom to share
  20
+and change it. By contrast, the GNU General Public License is intended to
  21
+guarantee your freedom to share and change free software--to make sure the
  22
+software is free for all its users. This General Public License applies to most of
  23
+the Free Software Foundation's software and to any other program whose
  24
+authors commit to using it. (Some other Free Software Foundation software is
  25
+covered by the GNU Library General Public License instead.) You can apply it to
  26
+your programs, too.
  27
+
  28
+When we speak of free software, we are referring to freedom, not price. Our
  29
+General Public Licenses are designed to make sure that you have the freedom
  30
+to distribute copies of free software (and charge for this service if you wish), that
  31
+you receive source code or can get it if you want it, that you can change the
  32
+software or use pieces of it in new free programs; and that you know you can do
  33
+these things.
  34
+
  35
+To protect your rights, we need to make restrictions that forbid anyone to deny
  36
+you these rights or to ask you to surrender the rights. These restrictions
  37
+translate to certain responsibilities for you if you distribute copies of the
  38
+software, or if you modify it.
  39
+
  40
+For example, if you distribute copies of such a program, whether gratis or for a
  41
+fee, you must give the recipients all the rights that you have. You must make
  42
+sure that they, too, receive or can get the source code. And you must show
  43
+them these terms so they know their rights.
  44
+
  45
+We protect your rights with two steps: (1) copyright the software, and (2) offer
  46
+you this license which gives you legal permission to copy, distribute and/or
  47
+modify the software.
  48
+
  49
+Also, for each author's protection and ours, we want to make certain that
  50
+everyone understands that there is no warranty for this free software. If the
  51
+software is modified by someone else and passed on, we want its recipients to
  52
+know that what they have is not the original, so that any problems introduced by
  53
+others will not reflect on the original authors' reputations.
  54
+
  55
+Finally, any free program is threatened constantly by software patents. We wish
  56
+to avoid the danger that redistributors of a free program will individually obtain
  57
+patent licenses, in effect making the program proprietary. To prevent this, we
  58
+have made it clear that any patent must be licensed for everyone's free use or
  59
+not licensed at all.
  60
+
  61
+The precise terms and conditions for copying, distribution and modification
  62
+follow.
  63
+
  64
+GNU GENERAL PUBLIC LICENSE
  65
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
  66
+MODIFICATION
  67
+
  68
+0. This License applies to any program or other work which contains a notice
  69
+placed by the copyright holder saying it may be distributed under the terms of
  70
+this General Public License. The "Program", below, refers to any such program
  71
+or work, and a "work based on the Program" means either the Program or any
  72
+derivative work under copyright law: that is to say, a work containing the
  73
+Program or a portion of it, either verbatim or with modifications and/or translated
  74
+into another language. (Hereinafter, translation is included without limitation in
  75
+the term "modification".) Each licensee is addressed as "you".
  76
+
  77
+Activities other than copying, distribution and modification are not covered by
  78
+this License; they are outside its scope. The act of running the Program is not
  79
+restricted, and the output from the Program is covered only if its contents
  80
+constitute a work based on the Program (independent of having been made by
  81
+running the Program). Whether that is true depends on what the Program does.
  82
+
  83
+1. You may copy and distribute verbatim copies of the Program's source code as
  84
+you receive it, in any medium, provided that you conspicuously and appropriately
  85
+publish on each copy an appropriate copyright notice and disclaimer of warranty;
  86
+keep intact all the notices that refer to this License and to the absence of any
  87
+warranty; and give any other recipients of the Program a copy of this License
  88
+along with the Program.
  89
+
  90
+You may charge a fee for the physical act of transferring a copy, and you may at
  91
+your option offer warranty protection in exchange for a fee.
  92
+
  93
+2. You may modify your copy or copies of the Program or any portion of it, thus
  94
+forming a work based on the Program, and copy and distribute such
  95
+modifications or work under the terms of Section 1 above, provided that you also
  96
+meet all of these conditions:
  97
+
  98
+a) You must cause the modified files to carry prominent notices stating that you
  99
+changed the files and the date of any change.
  100
+
  101
+b) You must cause any work that you distribute or publish, that in whole or in
  102
+part contains or is derived from the Program or any part thereof, to be licensed
  103
+as a whole at no charge to all third parties under the terms of this License.
  104
+
  105
+c) If the modified program normally reads commands interactively when run, you
  106
+must cause it, when started running for such interactive use in the most ordinary
  107
+way, to print or display an announcement including an appropriate copyright
  108
+notice and a notice that there is no warranty (or else, saying that you provide a
  109
+warranty) and that users may redistribute the program under these conditions,
  110
+and telling the user how to view a copy of this License. (Exception: if the
  111
+Program itself is interactive but does not normally print such an announcement,
  112
+your work based on the Program is not required to print an announcement.)
  113
+
  114
+These requirements apply to the modified work as a whole. If identifiable
  115
+sections of that work are not derived from the Program, and can be reasonably
  116
+considered independent and separate works in themselves, then this License,
  117
+and its terms, do not apply to those sections when you distribute them as
  118
+separate works. But when you distribute the same sections as part of a whole
  119
+which is a work based on the Program, the distribution of the whole must be on
  120
+the terms of this License, whose permissions for other licensees extend to the
  121
+entire whole, and thus to each and every part regardless of who wrote it.
  122
+
  123
+Thus, it is not the intent of this section to claim rights or contest your rights to
  124
+work written entirely by you; rather, the intent is to exercise the right to control
  125
+the distribution of derivative or collective works based on the Program.
  126
+
  127
+In addition, mere aggregation of another work not based on the Program with the
  128
+Program (or with a work based on the Program) on a volume of a storage or
  129
+distribution medium does not bring the other work under the scope of this
  130
+License.
  131
+
  132
+3. You may copy and distribute the Program (or a work based on it, under
  133
+Section 2) in object code or executable form under the terms of Sections 1 and 2
  134
+above provided that you also do one of the following:
  135
+
  136
+a) Accompany it with the complete corresponding machine-readable source
  137
+code, which must be distributed under the terms of Sections 1 and 2 above on a
  138
+medium customarily used for software interchange; or,
  139
+
  140
+b) Accompany it with a written offer, valid for at least three years, to give any
  141
+third party, for a charge no more than your cost of physically performing source
  142
+distribution, a complete machine-readable copy of the corresponding source
  143
+code, to be distributed under the terms of Sections 1 and 2 above on a medium
  144
+customarily used for software interchange; or,
  145
+
  146
+c) Accompany it with the information you received as to the offer to distribute
  147
+corresponding source code. (This alternative is allowed only for noncommercial
  148
+distribution and only if you received the program in object code or executable
  149
+form with such an offer, in accord with Subsection b above.)
  150
+
  151
+The source code for a work means the preferred form of the work for making
  152
+modifications to it. For an executable work, complete source code means all the
  153
+source code for all modules it contains, plus any associated interface definition
  154
+files, plus the scripts used to control compilation and installation of the
  155
+executable. However, as a special exception, the source code distributed need
  156
+not include anything that is normally distributed (in either source or binary form)
  157
+with the major components (compiler, kernel, and so on) of the operating system
  158
+on which the executable runs, unless that component itself accompanies the
  159
+executable.
  160
+
  161
+If distribution of executable or object code is made by offering access to copy
  162
+from a designated place, then offering equivalent access to copy the source
  163
+code from the same place counts as distribution of the source code, even though
  164
+third parties are not compelled to copy the source along with the object code.
  165
+
  166
+4. You may not copy, modify, sublicense, or distribute the Program except as
  167
+expressly provided under this License. Any attempt otherwise to copy, modify,
  168
+sublicense or distribute the Program is void, and will automatically terminate
  169
+your rights under this License. However, parties who have received copies, or
  170
+rights, from you under this License will not have their licenses terminated so long
  171
+as such parties remain in full compliance.
  172
+
  173
+5. You are not required to accept this License, since you have not signed it.
  174
+However, nothing else grants you permission to modify or distribute the Program
  175
+or its derivative works. These actions are prohibited by law if you do not accept
  176
+this License. Therefore, by modifying or distributing the Program (or any work
  177
+based on the Program), you indicate your acceptance of this License to do so,
  178
+and all its terms and conditions for copying, distributing or modifying the
  179
+Program or works based on it.
  180
+
  181
+6. Each time you redistribute the Program (or any work based on the Program),
  182
+the recipient automatically receives a license from the original licensor to copy,
  183
+distribute or modify the Program subject to these terms and conditions. You
  184
+may not impose any further restrictions on the recipients' exercise of the rights
  185
+granted herein. You are not responsible for enforcing compliance by third parties
  186
+to this License.
  187
+
  188
+7. If, as a consequence of a court judgment or allegation of patent infringement
  189
+or for any other reason (not limited to patent issues), conditions are imposed on
  190
+you (whether by court order, agreement or otherwise) that contradict the
  191
+conditions of this License, they do not excuse you from the conditions of this
  192
+License. If you cannot distribute so as to satisfy simultaneously your obligations
  193
+under this License and any other pertinent obligations, then as a consequence
  194
+you may not distribute the Program at all. For example, if a patent license would
  195
+not permit royalty-free redistribution of the Program by all those who receive
  196
+copies directly or indirectly through you, then the only way you could satisfy
  197
+both it and this License would be to refrain entirely from distribution of the
  198
+Program.
  199
+
  200
+If any portion of this section is held invalid or unenforceable under any particular
  201
+circumstance, the balance of the section is intended to apply and the section as
  202
+a whole is intended to apply in other circumstances.
  203
+
  204
+It is not the purpose of this section to induce you to infringe any patents or other
  205
+property right claims or to contest validity of any such claims; this section has
  206
+the sole purpose of protecting the integrity of the free software distribution
  207
+system, which is implemented by public license practices. Many people have
  208
+made generous contributions to the wide range of software distributed through
  209
+that system in reliance on consistent application of that system; it is up to the
  210
+author/donor to decide if he or she is willing to distribute software through any
  211
+other system and a licensee cannot impose that choice.
  212
+
  213
+This section is intended to make thoroughly clear what is believed to be a
  214
+consequence of the rest of this License.
  215
+
  216
+8. If the distribution and/or use of the Program is restricted in certain countries
  217
+either by patents or by copyrighted interfaces, the original copyright holder who
  218
+places the Program under this License may add an explicit geographical
  219
+distribution limitation excluding those countries, so that distribution is permitted
  220
+only in or among countries not thus excluded. In such case, this License
  221
+incorporates the limitation as if written in the body of this License.
  222
+
  223
+9. The Free Software Foundation may publish revised and/or new versions of the
  224
+General Public License from time to time. Such new versions will be similar in
  225
+spirit to the present version, but may differ in detail to address new problems or
  226
+concerns.
  227
+
  228
+Each version is given a distinguishing version number. If the Program specifies a
  229
+version number of this License which applies to it and "any later version", you
  230
+have the option of following the terms and conditions either of that version or of
  231
+any later version published by the Free Software Foundation. If the Program does
  232
+not specify a version number of this License, you may choose any version ever
  233
+published by the Free Software Foundation.
  234
+
  235
+10. If you wish to incorporate parts of the Program into other free programs
  236
+whose distribution conditions are different, write to the author to ask for
  237
+permission. For software which is copyrighted by the Free Software Foundation,
  238
+write to the Free Software Foundation; we sometimes make exceptions for this.
  239
+Our decision will be guided by the two goals of preserving the free status of all
  240
+derivatives of our free software and of promoting the sharing and reuse of
  241
+software generally.
  242
+
  243
+NO WARRANTY
  244
+
  245
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
  246
+NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  247
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
  248
+COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
  249
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
  250
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  251
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
  252
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  253
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
  254
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  255
+CORRECTION.
  256
+
  257
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
  258
+TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
  259
+WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
  260
+PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
  261
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
  262
+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
  263
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  264
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  265
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
  266
+OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
  267
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  268
+
  269
+END OF TERMS AND CONDITIONS
  270
+
  271
+
  272
+---------------------------------------------------------------------------
  273
+
  274
+The Artistic License
  275
+
  276
+Preamble
  277
+
  278
+The intent of this document is to state the conditions under which a Package
  279
+may be copied, such that the Copyright Holder maintains some semblance of
  280
+artistic control over the development of the package, while giving the users of the
  281
+package the right to use and distribute the Package in a more-or-less customary
  282
+fashion, plus the right to make reasonable modifications.
  283
+
  284
+Definitions:
  285
+
  286
+-    "Package" refers to the collection of files distributed by the Copyright
  287
+     Holder, and derivatives of that collection of files created through textual
  288
+     modification. 
  289
+-    "Standard Version" refers to such a Package if it has not been modified,
  290
+     or has been modified in accordance with the wishes of the Copyright
  291
+     Holder. 
  292
+-    "Copyright Holder" is whoever is named in the copyright or copyrights for
  293
+     the package. 
  294
+-    "You" is you, if you're thinking about copying or distributing this Package.
  295
+-    "Reasonable copying fee" is whatever you can justify on the basis of
  296
+     media cost, duplication charges, time of people involved, and so on. (You
  297
+     will not be required to justify it to the Copyright Holder, but only to the
  298
+     computing community at large as a market that must bear the fee.) 
  299
+-    "Freely Available" means that no fee is charged for the item itself, though
  300
+     there may be fees involved in handling the item. It also means that
  301
+     recipients of the item may redistribute it under the same conditions they
  302
+     received it. 
  303
+
  304
+1. You may make and give away verbatim copies of the source form of the
  305
+Standard Version of this Package without restriction, provided that you duplicate
  306
+all of the original copyright notices and associated disclaimers.
  307
+
  308
+2. You may apply bug fixes, portability fixes and other modifications derived from
  309
+the Public Domain or from the Copyright Holder. A Package modified in such a
  310
+way shall still be considered the Standard Version.
  311
+
  312
+3. You may otherwise modify your copy of this Package in any way, provided
  313
+that you insert a prominent notice in each changed file stating how and when
  314
+you changed that file, and provided that you do at least ONE of the following:
  315
+
  316
+     a) place your modifications in the Public Domain or otherwise
  317
+     make them Freely Available, such as by posting said modifications
  318
+     to Usenet or an equivalent medium, or placing the modifications on
  319
+     a major archive site such as ftp.uu.net, or by allowing the
  320
+     Copyright Holder to include your modifications in the Standard
  321
+     Version of the Package.
  322
+
  323
+     b) use the modified Package only within your corporation or
  324
+     organization.
  325
+
  326
+     c) rename any non-standard executables so the names do not
  327
+     conflict with standard executables, which must also be provided,
  328
+     and provide a separate manual page for each non-standard
  329
+     executable that clearly documents how it differs from the Standard
  330
+     Version.
  331
+
  332
+     d) make other distribution arrangements with the Copyright Holder.
  333
+
  334
+4. You may distribute the programs of this Package in object code or executable
  335
+form, provided that you do at least ONE of the following:
  336
+
  337
+     a) distribute a Standard Version of the executables and library
  338
+     files, together with instructions (in the manual page or equivalent)
  339
+     on where to get the Standard Version.
  340
+
  341
+     b) accompany the distribution with the machine-readable source of
  342
+     the Package with your modifications.
  343
+
  344
+     c) accompany any non-standard executables with their
  345
+     corresponding Standard Version executables, giving the
  346
+     non-standard executables non-standard names, and clearly
  347
+     documenting the differences in manual pages (or equivalent),
  348
+     together with instructions on where to get the Standard Version.
  349
+
  350
+     d) make other distribution arrangements with the Copyright Holder.
  351
+
  352
+5. You may charge a reasonable copying fee for any distribution of this Package.
  353
+You may charge any fee you choose for support of this Package. You may not
  354
+charge a fee for this Package itself. However, you may distribute this Package in
  355
+aggregate with other (possibly commercial) programs as part of a larger
  356
+(possibly commercial) software distribution provided that you do not advertise
  357
+this Package as a product of your own.
  358
+
  359
+6. The scripts and library files supplied as input to or produced as output from
  360
+the programs of this Package do not automatically fall under the copyright of this
  361
+Package, but belong to whomever generated them, and may be sold
  362
+commercially, and may be aggregated with this Package.
  363
+
  364
+7. C or perl subroutines supplied by you and linked into this Package shall not
  365
+be considered part of this Package.
  366
+
  367
+8. Aggregation of this Package with a commercial distribution is always permitted
  368
+provided that the use of this Package is embedded; that is, when no overt attempt
  369
+is made to make this Package's interfaces visible to the end user of the
  370
+commercial distribution. Such use shall not be construed as a distribution of
  371
+this Package.
  372
+
  373
+9. The name of the Copyright Holder may not be used to endorse or promote
  374
+products derived from this software without specific prior written permission.
  375
+
  376
+10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  377
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  378
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  379
+PURPOSE.
  380
+
  381
+The End
  382
+
  383
+
54  MANIFEST
... ...
@@ -0,0 +1,54 @@
  1
+MANIFEST
  2
+LICENSE
  3
+README
  4
+TESTPLAN
  5
+Todo
  6
+Changes
  7
+Makefile.PL
  8
+lib/PDF/Template.pm
  9
+lib/PDF/Template/Base.pm
  10
+lib/PDF/Template/Constants.pm
  11
+lib/PDF/Template/Container.pm
  12
+lib/PDF/Template/Context.pm
  13
+lib/PDF/Template/Element.pm
  14
+lib/PDF/Template/Factory.pm
  15
+lib/PDF/Template/Iterator.pm
  16
+lib/PDF/Template/TextObject.pm
  17
+lib/PDF/Template/Container/Always.pm
  18
+lib/PDF/Template/Container/Conditional.pm
  19
+lib/PDF/Template/Container/Font.pm
  20
+lib/PDF/Template/Container/Footer.pm
  21
+lib/PDF/Template/Container/Header.pm
  22
+lib/PDF/Template/Container/Loop.pm
  23
+lib/PDF/Template/Container/Margin.pm
  24
+lib/PDF/Template/Container/PageDef.pm
  25
+lib/PDF/Template/Container/PdfTemplate.pm
  26
+lib/PDF/Template/Container/Row.pm
  27
+lib/PDF/Template/Container/Scope.pm
  28
+lib/PDF/Template/Container/Section.pm
  29
+lib/PDF/Template/Element/Bookmark.pm
  30
+lib/PDF/Template/Element/Circle.pm
  31
+lib/PDF/Template/Element/HorizontalRule.pm
  32
+lib/PDF/Template/Element/Image.pm
  33
+lib/PDF/Template/Element/Line.pm
  34
+lib/PDF/Template/Element/PageBreak.pm
  35
+lib/PDF/Template/Element/TextBox.pm
  36
+lib/PDF/Template/Element/Var.pm
  37
+lib/PDF/Template/Element/Weblink.pm
  38
+examples/report.xml
  39
+t/001_load.t
  40
+t/002_simple.t
  41
+t/003_basic.t
  42
+t/templates/002_1/buffer.txt
  43
+t/templates/002_1/vars.txt
  44
+t/templates/002_1/xml.txt
  45
+t/templates/002_2/buffer.txt
  46
+t/templates/002_2/vars.txt
  47
+t/templates/002_2/xml.txt
  48
+t/templates/002_3/buffer.txt
  49
+t/templates/002_3/vars.txt
  50
+t/templates/002_3/xml.txt
  51
+t/templates/003_1/buffer.txt
  52
+t/templates/003_1/vars.txt
  53
+t/templates/003_1/xml.txt
  54
+META.yml                                 Module meta-data (added by MakeMaker)
15  META.yml
... ...
@@ -0,0 +1,15 @@
  1
+# http://module-build.sourceforge.net/META-spec.html
  2
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
  3
+name:         PDF-Template-PDFAPI2
  4
+version:      0.40_01
  5
+version_from: 
  6
+installdirs:  site
  7
+requires:
  8
+    File::Basename:                0.01
  9
+    IO::File:                      0.01
  10
+    PDF::API2:                     0.4
  11
+    Test::Simple:                  0.44
  12
+    XML::Parser:                   0.01
  13
+
  14
+distribution_type: module
  15
+generated_by: ExtUtils::MakeMaker version 6.21
95  Makefile.PL
... ...
@@ -0,0 +1,95 @@
  1
+use ExtUtils::MakeMaker;
  2
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
  3
+# the contents of the Makefile that is written.
  4
+
  5
+use File::Spec;
  6
+
  7
+warn << '.';
  8
+### PLEASE NOTE ##############################################
  9
+
  10
+This distribution is a development-in-progress fork by
  11
+Autrijus Tang, with full intentions to remerge to the main
  12
+PDF::Template tree at some point.
  13
+
  14
+The official maintainer of PDF::Template is Rob Kinyon.
  15
+
  16
+##############################################################
  17
+.
  18
+
  19
+my $prereqs = {
  20
+    'Test::Simple'   => 0.44,
  21
+    'XML::Parser'    => 0.01,
  22
+    'IO::File'       => 0.01,
  23
+    'File::Basename' => 0.01,
  24
+    'PDF::API2'      => 0.40,
  25
+};
  26
+
  27
+# The assumption is the 5.8.0 and greater doesn't need Unicode::String.
  28
+if ($] < 5.008)
  29
+{
  30
+    print "Do you want Unicode support? ";
  31
+    my $answer = <STDIN>;
  32
+    my $need_unicode = $answer =~ /^[Yy]/;
  33
+
  34
+    my $use_unicode = 0;
  35
+    if ($need_unicode)
  36
+    {
  37
+            $prereqs{'Unicode::String'} = '0.01';
  38
+            $use_unicode = 1;
  39
+    }
  40
+}
  41
+
  42
+use_unicode($use_unicode);
  43
+
  44
+WriteMakefile(
  45
+    DISTNAME     => 'PDF-Template-PDFAPI2',
  46
+    NAME         => 'PDF::Template',
  47
+    VERSION      => '0.40_01',
  48
+    AUTHOR       => 'Autrijus Tang <autrijus@autrijus.org>',
  49
+    ABSTRACT     => 'PDF::Template',
  50
+    PREREQ_PM    => $prereqs,
  51
+);
  52
+
  53
+sub use_unicode
  54
+{
  55
+    my $using_unicode = shift;
  56
+
  57
+    my @filenames = map {
  58
+        File::Spec->catfile(
  59
+            qw( lib PDF Template ),
  60
+            @{$_},
  61
+        )
  62
+    } ( [ qw( Element TextBox.pm ) ], [ qw( TextObject.pm ) ] );
  63
+
  64
+    foreach my $filename (@filenames)
  65
+    {
  66
+        open(IN_FILE, $filename)
  67
+            or die "Cannot open '$filename' for reading: $!\n";
  68
+        my @lines = <IN_FILE>;
  69
+        close(IN_FILE);
  70
+
  71
+        if ($using_unicode)
  72
+        {
  73
+            for (@lines)
  74
+            {
  75
+                s/^UNI_YES / /;
  76
+                s/^UNI_NO  /#/;
  77
+            }
  78
+        }
  79
+        else
  80
+        {
  81
+            for (@lines)
  82
+            {
  83
+                s/^UNI_YES /#/;
  84
+                s/^UNI_NO  / /;
  85
+            }
  86
+        }
  87
+
  88
+        open(OUT_FILE, ">$filename")
  89
+            or die "Cannot open '$filename' for writing: $!\n";
  90
+        print OUT_FILE @lines;
  91
+        close(OUT_FILE);
  92
+    }
  93
+
  94
+    return 1;
  95
+}
8  README
... ...
@@ -0,0 +1,8 @@
  1
+PDF::Template is a layout system that creates Adobe PDF files from the same
  2
+data structure used by HTML::Template.
  3
+
  4
+This distribution is a development-in-progress fork by Autrijus Tang,
  5
+with full intentions to remerge to the main PDF::Template tree
  6
+at some point.
  7
+
  8
+The official maintainer of the PDF::Template module is Rob Kinyon.
91  TESTPLAN
... ...
@@ -0,0 +1,91 @@
  1
+1) Test basic template handling for the following:
  2
+  <pdftemplate/>
  3
+
  4
+  ------
  5
+
  6
+  <pdftemplate pagesize="Letter">
  7
+    <pagedef/>
  8
+  </pdftemplate>
  9
+
  10
+  ------
  11
+
  12
+  <pdftemplate pagesize="Letter">
  13
+    <pagedef>
  14
+      <font face="Times-Roman" h="8">
  15
+        <row>
  16
+          <textbox w="100%" text="Hello, World!">
  17
+        </row>
  18
+      </font>
  19
+    </pagedef>
  20
+  </pdftemplate>
  21
+
  22
+2) Build templates to test the following nodes by themselves:
  23
+    * Always
  24
+      - In the middle of the page
  25
+    * Bookmark
  26
+    * Circle
  27
+    * Conditional
  28
+      - if-true
  29
+      - if-false
  30
+      - if-else-true
  31
+      - if-else-false
  32
+    * Footer
  33
+    * Header
  34
+    * HorizontalRule
  35
+    * Image
  36
+    * Line
  37
+    * Loop
  38
+      - Both Y and X directions
  39
+    * PageBreak
  40
+    * Scope
  41
+    * Section
  42
+    * Var
  43
+    * Weblink
  44
+
  45
+3) The following nodes need to be tested together:
  46
+    * Loop and any combination of the following inside:
  47
+        Always (Does this always appear at the same spot in the page?)
  48
+        Footer (where is the loop pagebreaking?)
  49
+        Header (where is the loop starting?)
  50
+        PageBreak
  51
+        PageDef
  52
+        Section
  53
+        Textbox (enough to make the loop run over the page)
  54
+    * Nested loops and the nodes above
  55
+        Outer in Y and Inner in X (and vice-versa)
  56
+    * Pagebreak within a:
  57
+        Always/Footer/Header
  58
+        Section
  59
+        Conditional
  60
+    * Always within a Always/Footer/Header
  61
+    * Footer within a Header (and vice-versa)
  62
+
  63
+4) Handling of context and scoping
  64
+    * Does scoping work?
  65
+    * Will the construct <row h="+2"> work? What about -2, *2, and /2?
  66
+    * Does overriding the value in an inner node work?
  67
+    * Do units work?
  68
+      - inches
  69
+      - centimeters
  70
+      - points
  71
+      - decimal values
  72
+      - negative values
  73
+    * Do percentages work correctly?
  74
+      - negative percentages
  75
+      - percentages > 100%
  76
+
  77
+5) Variables
  78
+    * Do variables work using the <var> tag?
  79
+    * Do variables work using the "$foo" syntax?
  80
+    * Do <textbox> and <image> correctly use attributes over contained TextObjects?
  81
+    * Do system-defined variables work correctly?
  82
+      - __PAGE__
  83
+      - __LAST_PAGE__
  84
+      - __PAGEDEF_PAGE__
  85
+      - Loop: __FIRST__
  86
+      - Loop: __LAST__
  87
+      - Loop: __INNER__
  88
+      - Loop: __ODD__
  89
+    * Do inner loops correctly override the outer-loop's variables?
  90
+      - Is the outer's value used when the inner doesn't specify?
  91
+    * Does DIE_ON_NO_PARAM work correctly?
7  Todo
... ...
@@ -0,0 +1,7 @@
  1
+TODO list for Perl module PDF::Template
  2
+
  3
+- Abstract out the rendering engine from the templating engine. This will allow
  4
+  for other renderers than just PDFLib
  5
+- Improve and finish tests
  6
+- Provide Excel::Template-like formatting, such as a <bold> tag and the like.
  7
+
39  examples/report.xml
... ...
@@ -0,0 +1,39 @@
  1
+<pdftemplate h="8">
  2
+  <pagedef>
  3
+    <font face="Times-Roman">
  4
+      <header header_height="1.5i">
  5
+        <image y="-1i">SomeSpecialImage.jpeg</image>
  6
+      </header>
  7
+  
  8
+      <font face="Times-Roman-Bold">
  9
+        <row>
  10
+          <textbox w="25%" text="Name"/>
  11
+          <textbox w="25%" text="Address"/>
  12
+          <textbox w="25%" text="Some Value 1"/>
  13
+          <textbox w="25%" text="Some Value 2"/>
  14
+        </row>
  15
+      </font>
  16
+  
  17
+      <loop name="LOOPY">
  18
+        <row>
  19
+          <textbox w="25%" text="$Name"/>
  20
+          <textbox w="25%" text="$Address"/>
  21
+          <textbox w="25%" text="$Value1"/>
  22
+          <textbox w="25%" text="$Value2"/>
  23
+        </row>
  24
+      </loop>
  25
+  
  26
+      <row>
  27
+        <textbox w="50%"/>
  28
+        <textbox w="25%" text="$Total1"/>
  29
+        <textbox w="25%" text="$Total2"/>
  30
+      </row>
  31
+  
  32
+      <footer footer_height="1i">
  33
+        <row>
  34
+          <textbox w="100%" justify="right">Page <var value="__PAGE__"/></textbox>
  35
+        </row>
  36
+      </footer>
  37
+    </font>
  38
+  </pagedef>
  39
+</pdftemplate>
401  lib/PDF/Template.pm
... ...
@@ -0,0 +1,401 @@
  1
+package PDF::Template;
  2
+
  3
+use strict;
  4
+
  5
+BEGIN {
  6
+    use PDF::Template::Base;
  7
+    use vars qw ($VERSION @ISA);
  8
+
  9
+    $VERSION = '0.18';
  10
+    @ISA     = qw (PDF::Template::Base);
  11
+}
  12
+
  13
+use PDF::API2 0.40;
  14
+
  15
+use File::Basename;
  16
+use IO::File;
  17
+use XML::Parser;
  18
+
  19
+#-----------------------------------------------
  20
+# TODO
  21
+#-----------------------------------------------
  22
+# PDF_set_info - find out more about this
  23
+# Providers - I need to create some provider classes that abstract
  24
+#    the process of PDF creation.    This will enable P::T to work with
  25
+#    different PDF providers.    A provider could be passed in to the
  26
+#    constructor.    If non is passed, P::T should try to instantiate a
  27
+#    sensible provider depending on what is installed.
  28
+#-----------------------------------------------
  29
+
  30
+sub new
  31
+{
  32
+    my $class = shift;
  33
+    my $self = $class->SUPER::new(@_);
  34
+
  35
+    $self->{TEMPLATES} = [] unless UNIVERSAL::isa($self->{TEMPLATES}, 'ARRAY');
  36
+    $self->{PARAM_MAP} = {} unless UNIVERSAL::isa($self->{PARAM_MAP}, 'HASH');
  37
+
  38
+    $self->{PDF_VERSION} = 0;
  39
+    for my $version (reverse 1 .. 5)
  40
+    {
  41
+        eval "UNIVERSAL::VERSION('pdflib_pl', $version.0)";
  42
+        unless ($@)
  43
+        {
  44
+            $self->{PDF_VERSION} = $version;
  45
+            last;
  46
+        }
  47
+    }
  48
+    #die "Cannot find pdflib_pl version",$/ unless $self->{PDF_VERSION};
  49
+
  50
+    $self->_validate_option($_)
  51
+        for qw(OPENACTION OPENMODE);
  52
+
  53
+    $self->parse_xml($self->{FILENAME}) if defined $self->{FILENAME};
  54
+
  55
+    return $self;
  56
+}
  57
+
  58
+sub param
  59
+{
  60
+    my $self = shift;
  61
+
  62
+    # Allow an arbitrary number of hashrefs, so long as they're the first things
  63
+    # into param(). Put each one onto the end, de-referenced.
  64
+    push @_, %{shift @_} while UNIVERSAL::isa($_[0], 'HASH');
  65
+
  66
+    (@_ % 2)
  67
+        && die __PACKAGE__, "->param() : Odd number of parameters to param()\n";
  68
+
  69
+    my %params = @_;
  70
+    $params{uc $_} = delete $params{$_} for keys %params;
  71
+    @{$self->{PARAM_MAP}}{keys %params} = @params{keys %params};
  72
+
  73
+    return 1;
  74
+}
  75
+
  76
+sub write_file
  77
+{
  78
+    my $self = shift;
  79
+    my ($fname) = @_;
  80
+
  81
+    my $p = PDF::API2->new;
  82
+
  83
+    #pdflib_pl::PDF_open_file($p, $fname) == -1
  84
+    #    && die "pdflib_pl::PDF_open_file could not open file '$fname'.", $/;
  85
+
  86
+    $self->_prepare_output($p);
  87
+
  88
+    $p->saveas($fname);
  89
+
  90
+    return 1;
  91
+}
  92
+
  93
+sub output
  94
+{
  95
+    my $self = shift;
  96
+
  97
+    $self->get_buffer(@_);
  98
+}
  99
+
  100
+sub get_buffer
  101
+{
  102
+    my $self = shift;
  103
+
  104
+    my $p = PDF::API2->new;
  105
+
  106
+    $self->_prepare_output($p);
  107
+
  108
+    return $p->stringify;
  109
+}
  110
+
  111
+sub parse
  112
+{
  113
+    my $self = shift;
  114
+
  115
+    $self->parse_xml(@_);
  116
+}
  117
+
  118
+sub parse_xml
  119
+{
  120
+    my $self = shift;
  121
+    my ($fname) = @_;
  122
+
  123
+    my %Has_TextObject = map { $_ => undef } qw(
  124
+        BOOKMARK
  125
+        IMAGE
  126
+        TEXTBOX
  127
+    );
  128
+
  129
+    my ($filename, $dirname) = fileparse($fname);
  130
+ 
  131
+    my @stack;
  132
+    my $parser = XML::Parser->new(
  133
+        Base => $dirname,
  134
+        Handlers => {
  135
+            Start => sub {
  136
+                shift;
  137
+#                { local $"="', '"; print "Start: '@_'\n"; }
  138
+                my $name = uc shift;
  139
+
  140
+                # Pass the PDF encoding in.
  141
+                if ($name eq 'PDFTEMPLATE')
  142
+                {
  143
+                    if (exists $self->{PDF_ENCODING})
  144
+                    {
  145
+                        push @_, (
  146
+                            PDF_ENCODING => $self->{PDF_ENCODING},
  147
+                        );
  148
+                    }
  149
+                }
  150
+
  151
+                my $node = PDF::Template::Factory->create_node($name, @_);
  152
+                die "'$name' (@_) didn't make a node!\n" unless defined $node;
  153
+
  154
+                if ($name eq 'VAR')
  155
+                {
  156
+                    return unless @stack;
  157
+
  158
+                    if (exists $stack[-1]{TXTOBJ} && $stack[-1]{TXTOBJ}->isa('TEXTOBJECT'))
  159
+                    {
  160
+                        push @{$stack[-1]{TXTOBJ}{STACK}}, $node;
  161
+                    }
  162
+                }
  163
+                elsif ($name eq 'PDFTEMPLATE')
  164
+                {
  165
+                    push @{$self->{TEMPLATES}}, $node;
  166
+                }
  167
+                else
  168
+                {
  169
+                    push @{$stack[-1]{ELEMENTS}}, $node
  170
+                        if @stack;
  171
+                }
  172
+
  173
+                push @stack, $node;
  174
+#                print "Pushed $node onto stack\n";
  175
+            },
  176
+            Char => sub {
  177
+                shift;
  178
+#                { local $"="', '"; print "Char:  '@_'\n"; }
  179
+                return unless @stack;
  180
+
  181
+                my $parent = $stack[-1];
  182
+                if (exists $parent->{TXTOBJ} && $parent->{TXTOBJ}->isa('TEXTOBJECT'))
  183
+                {
  184
+#                    print "Added '@_' to TextObject stack for '$parent'\n";
  185
+                    push @{$parent->{TXTOBJ}{STACK}}, @_;
  186
+                }
  187
+            },
  188
+            End => sub {
  189
+                shift;
  190
+#                { local $"="', '"; print "End:   '@_'\n"; }
  191
+                return unless @stack;
  192
+
  193
+                pop @stack if $stack[-1]->isa(uc $_[0]);
  194
+            },
  195
+        },
  196
+    );
  197
+
  198
+    {
  199
+        my $fh = IO::File->new($fname)
  200
+            || die "Cannot open '$fname' for reading: $!\n";
  201
+ 
  202
+        $parser->parse(do { local $/ = undef; <$fh> });
  203
+ 
  204
+        $fh->close;
  205
+    }
  206
+
  207
+    return 1;
  208
+}
  209
+
  210
+my %NoSetProperty = (
  211
+    'CreationDate' => 1,
  212
+    'Producer' => 1,
  213
+    'ModDate' => 1,
  214
+    'Trapped' => 1,
  215
+);
  216
+
  217
+sub _prepare_output
  218
+{
  219
+    my $self = shift;
  220
+    my ($p) = @_;
  221
+
  222
+    if (UNIVERSAL::isa($self->{INFO}, 'HASH'))
  223
+    {
  224
+        foreach my $key ( keys %{$self->{INFO}} )
  225
+        {
  226
+            if ($NoSetProperty{$key})
  227
+            {
  228
+                warn "Document property '$key' cannot be set.", $/;
  229
+                next;
  230
+            }
  231
+
  232
+            $p->info($key, $self->{INFO}{$key});
  233
+        }
  234
+    }
  235
+    else
  236
+    {
  237
+        $p->info($_, __PACKAGE__) for qw/Creator Author/;
  238
+    }
  239
+
  240
+    # __PAGE__ is incremented after the page is done.
  241
+    $self->{PARAM_MAP}{__PAGE__} = 1;
  242
+
  243
+    # __PAGEDEF__ is incremented when the pagedef begins.
  244
+    $self->{PARAM_MAP}{__PAGEDEF__} = 0;
  245
+
  246
+    my $context = PDF::Template::Factory->create(
  247
+        'CONTEXT',
  248
+        # Un-scoped variables
  249
+        X => 0,
  250
+        Y => 0,
  251
+
  252
+        # Other variables
  253
+        PDF       => $p,
  254
+        PARAM_MAP => [ $self->{PARAM_MAP} ],
  255
+
  256
+        PDF_VERSION     => $self->{PDF_VERSION},
  257
+        DIE_ON_NO_PARAM => $self->{DIE_ON_NO_PARAM},
  258
+    );
  259
+
  260
+    # Do a first pass through, noting important values
  261
+    $_->preprocess($context) for @{$self->{TEMPLATES}};
  262
+
  263
+    # Do a second pass through, for actual rendering
  264
+    $_->render($context) for @{$self->{TEMPLATES}};
  265
+
  266
+    $context->close_images;
  267
+
  268
+    return 1;
  269
+}
  270
+
  271
+sub register { shift; PDF::Template::Factory::register(@_) }
  272
+
  273
+1;
  274
+__END__
  275
+
  276
+=head1 NAME
  277
+
  278
+PDF::Template - PDF::Template
  279
+
  280
+=head1 SYNOPSIS
  281
+
  282
+  use PDF::Template
  283
+
  284
+  my $pdf = PDF::Template->new(
  285
+     filename => 'some_template.xml',
  286
+  );
  287
+
  288
+  $pdf->param(%my_params);
  289
+
  290
+  print "Content/type: application/pdf\n\n", $pdf->get_buffer;
  291
+
  292
+  $pdf->write_file('some_file.pdf');
  293
+
  294
+=head1 DESCRIPTION
  295
+
  296
+PDF::Template is a PDF layout system that uses the same data structures as
  297
+HTML::Template.
  298
+
  299
+=head1 OVERVIEW
  300
+
  301
+PDF::Template is a PDF layout system that uses the same data structures as
  302
+HTML::Template. Unlike HTML::TEmplate, this is a full layout system. This means
  303
+you will have to describe where each item will be on the page. (This is in
  304
+contrast to HTML::Template, which adds on to HTML. The layout is determined by
  305
+the HTML, not HTML::Template.)
  306
+
  307
+PDF::Template uses an XML document as the template. However, the XML is not
  308
+completely compliant. The only difference (that I'm aware of) is that any node
  309
+can have any parameter. (This prevents the creation of a DTD.) The reason for
  310
+this is to allow scoping by parents for parameters used by children. (More on
  311
+this later.)
  312
+
  313
+Each node in the document corresponds to an objects, with each parameter
  314
+mapping (mostly) 1 to 1 to an object attribute. Parent-child relationships are
  315
+strictly preserved. Each parent provides a scope (similar to variable scope) to
  316
+its children. (This is why any node can have any parameter.) If a child needs
  317
+the value of a parameter and it doesn't have that value as an attribute, it will
  318
+ask its parent for the value. If the parent doesn't have it, it will ask its
  319
+parent, and so on.
  320
+
  321
+=head1 USAGE
  322
+
  323
+There are a few consistency rules that that every PDF::Template has to follow:
  324
+
  325
+=over 4
  326
+
  327
+=item 1 The root node is called PDFTEMPLATE
  328
+
  329
+=item 2 There must be at least one PAGEDEF (which does not have to be a direct
  330
+child of the PDFTEMPLATE node)
  331
+
  332
+=item 3 All rendering elements (include FONT tags) must be within a PAGEDEF node
  333
+
  334
+=item 4 There must be a FONT tag as an ancestor of every TEXTBOX node
  335
+
  336
+=item 5 Within a PAGEDEF, there can only be on HEADER node and one FOOTER node
  337
+
  338
+=back 4
  339
+
  340
+For more information about each node, please see the POD for that class.
  341
+
  342
+=head1 WWW CAVEATS
  343
+
  344
+When taking an HTML page and adding a PDF option, there are a few differences totake into account. The primary one is the idea of pagebreaks. HTML is displayed
  345
+as a single page, with scrolling. Paper doesn't scroll, so when there should be
  346
+a new page is something PDF::Template works very hard at determining. It will
  347
+take into account any header and footer information you've provided, as well as
  348
+page sizes.
  349
+
  350
+The second is that you have to determine how wide you want your text to be. One
  351
+of the most common activities is to take a tabular report and covert it to a
  352
+PDF. In HTML, the browser handles text width for you. Right now, there isn't a
  353
+TABLE tag (though work is being done on it). So, you have to layout out your
  354
+TEXTBOX nodes by hand. (See the EXAMPLES for some ideas on this.) That said, it
  355
+really isn't that hard. TR/TH tags convert to ROW tags easily, and TD tags are
  356
+basically TEXTBOX tags. Add a few width="20%" (or whatever) and you're fine.
  357
+
  358
+=head1 BUGS
  359
+
  360
+None, that I'm aware of.
  361
+
  362
+=head1 LIMITATIONS
  363
+
  364
+Currently, the only PDF rendered PDF::Template supports is PDFLib (available at
  365
+www.pdflib.com). The next release of PDF::Template will also support PDF::API2.
  366
+Unless you need Unicode support, PDFLib Lite is sufficient (and free). Please
  367
+see www.pdflib.com for more details.
  368
+
  369
+I do know that PDFLib will not compile under AIX. This is a problem that PDFLib
  370
+has acknowledged to me.
  371
+
  372
+=head1 AUTHOR
  373
+
  374
+Originally written by Dave Ferrance (dave@ferrance.org)
  375
+Taken over after v0.05 by Rob Kinyon (rkinyon@columbus.rr.com)
  376
+
  377
+=head1 CONTRIBUTORS
  378
+
  379
+Patches and ideas provided by:
  380
+
  381
+=over 4
  382
+
  383
+=item * Michael Kiwala
  384
+
  385
+=item * Nathan Byrd
  386
+
  387
+=back 4
  388
+
  389
+=head1 COPYRIGHT
  390
+
  391
+This program is free software; you can redistribute
  392
+it and/or modify it under the same terms as Perl itself.
  393
+
  394
+The full text of the license can be found in the
  395
+LICENSE file included with this module.
  396
+
  397
+=head1 SEE ALSO
  398
+
  399
+perl(1).
  400
+
  401
+=cut
141  lib/PDF/Template/Base.pm
... ...
@@ -0,0 +1,141 @@
  1
+package PDF::Template::Base;
  2
+
  3
+use strict;
  4
+
  5
+BEGIN {
  6
+}
  7
+
  8
+use PDF::Template::Constants qw(
  9
+    %Verify
  10
+);
  11
+
  12
+use PDF::Template::Factory;
  13
+
  14
+sub new
  15
+{
  16
+    my $class = shift;
  17
+
  18
+    push @_, %{shift @_} while UNIVERSAL::isa($_[0], 'HASH');
  19
+    (@_ % 2) && die "$class->new() called with odd number of option parameters", $/;
  20
+
  21
+    my %x = @_;
  22
+
  23
+    # Do not use a hashref-slice here because of the uppercase'ing
  24
+    my $self = {};
  25
+    $self->{uc $_} = $x{$_} for keys %x;
  26
+
  27
+    $self->{__THIS_HAS_RENDERED__} = 0;
  28
+
  29
+    bless $self, $class;
  30
+}