diff --git a/htdocs/includes/fpdf/tcpdf/CHANGELOG.TXT b/htdocs/includes/fpdf/tcpdf/CHANGELOG.TXT
new file mode 100644
index 00000000000..4a07e0ed36c
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/CHANGELOG.TXT
@@ -0,0 +1,67 @@
+1.53.0.TC021 (2006-07-01)
+ - HTML attributes with whitespaces are now supported (thanks to Nelson Benitez for his support)
+
+1.53.0.TC020_PHP4 (2006-06-23)
+ - this version fixes the MBCS error on html_entity_decode
+
+1.53.0.TC019_PHP4 (2006-06-08)
+ - this version were backported to PHP4
+
+1.53.0.TC019 (2006-05-21)
+ - fixed and closing tags.
+
+1.53.0.TC018 (2006-05-18)
+ - fixed font names bug
+
+1.53.0.TC017 (2006-05-18)
+ - the TTF2UFM utility to convert True Type fonts for TCPDF were included on fonts folder.
+ - new free unicode fonts were included on /fonts/freefont.
+ - test_unicode.php example were exended.
+ - parameter $fill were added on Write, writeHTML and writeHTMLCell functions.
+ - documentation were updated.
+
+1.53.0.TC016 (2006-03-09)
+ - fixed closing tag on html parser.
+
+1.53.0.TC016 (2005-08-28)
+ - fpdf.php and tcpdf.php files were joined in one single class (you can still extend TCPDF with your own class).
+ - fixed problem when mb_internal_encoding is set.
+
+1.53.0.TC014 (2005-05-29)
+ - fixed WriteHTMLCell new page issue.
+
+1.53.0.TC013 (2005-05-29)
+ - fixed WriteHTMLCell across pages.
+
+1.53.0.TC012 (2005-05-29)
+ - font color attribute bug were fixed.
+
+1.53.0.TC011 (2005-03-31)
+ - SetFont function were fixed (thank Sjaak Lauwers for bug notice).
+
+1.53.0.TC010 (2005-03-22)
+ - the html functions were improved (thanks to Manfred Vervuert for bug reporting).
+
+1.53.0.TC009 (2005-03-19)
+ - a wrong reference to convertColorHexToDec were fixed.
+
+1.53.0.TC008 (2005-02-07)
+ - removed some extra bytes from PHP files.
+
+1.53.0.TC007 (2005-01-08)
+ - fill attribute were removed from writeHTMLCell method.
+
+1.53.0.TC006 (2005-01-08)
+ - the documentation were updated.
+
+1.53.0.TC005 (2005-01-05)
+ - Steven Wittens's unicode methods were removed.
+ - All unicode methods were rewritten from scratch.
+ - TCPDF is now licensed as LGPL.
+
+1.53.0.TC004 (2005-01-04)
+ - this changelog were added.
+ - removed comercial fonts for licensing issue.
+ - Bitstream Vera Fonts were added (http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html).
+ - Now the AddFont and SetFont functions returns the basic font if the styled version do not exist.
+
diff --git a/htdocs/includes/fpdf/tcpdf/LICENSE.TXT b/htdocs/includes/fpdf/tcpdf/LICENSE.TXT
new file mode 100644
index 00000000000..b1e3f5a2638
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/LICENSE.TXT
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/htdocs/includes/fpdf/tcpdf/README.TXT b/htdocs/includes/fpdf/tcpdf/README.TXT
new file mode 100644
index 00000000000..b8a4378d6fd
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/README.TXT
@@ -0,0 +1,61 @@
+TCPDF - README
+============================================================
+
+Name:
+ TCPDF
+
+Version:
+ 1.53.0.TC021_PHP4
+
+Release date:
+ 2006-07-01
+
+Author:
+ Nicola Asuni
+
+Copyright (c) 2001-2006:
+ Tecnick.com S.r.l.
+ Via Ugo Foscolo n.19
+ 09045 Quartu Sant'Elena (CA)
+ ITALY
+ www.tecnick.com
+
+URLs:
+ http://tcpdf.sourceforge.net/
+ http://tcpdf.sf.net/
+
+Description:
+ TCPDF is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.
+ TCPDF is an extension and improvement of the FPDF class by Olivier Plathey (http://www.fpdf.org).
+
+ Main Features:
+
+ - supports all ISO page formats;
+ - supports UTF-8 Unicode;
+ - includes methods to publish some xhtml code, supporting the following elements: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small;
+ - includes a method to print various barcode formats using an improved version of "Generic Barcode Render Class" by Karim Mribti (http://www.mribti.com/barcode/) (require GD library: http://www.boutell.com/gd/)
+ - supports TrueTypeUnicode, TrueType, Type1 and encoding;
+ - supports custom page formats, margins and units of measure;
+ - includes methods for page header and footer management;
+ - supports automatic page break;
+ - supports automatic page numbering;
+ - supports automatic line break and text justification;
+ - supports JPEG and PNG images;
+ - supports colors;
+ - supports links;
+ - support page compression (require zlib extension: http://www.gzip.org/zlib/);
+ - the source code is full documented in PhpDocumentor Style (http://www.phpdoc.org).
+
+Installation:
+ 1. copy the folder on your Web server
+ 2. set your installation path on the config/tcpdf_config.php
+ 3. call the test_unicode.php page with your browser to see an example
+ NOTE: the test_old.php require proper font setup on tcpdf_config.
+
+Source Code Documentation:
+ doc/index.html
+
+License
+ GNU LESSER GENERAL PUBLIC LICENSE v.2.1
+ http://www.gnu.org/copyleft/lesser.html
+============================================================
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/barcode.php b/htdocs/includes/fpdf/tcpdf/barcode/barcode.php
new file mode 100644
index 00000000000..a4f6d733452
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/barcode.php
@@ -0,0 +1,441 @@
+mWidth = $Width;
+ $this->mHeight = $Height;
+ $this->mStyle = $Style;
+ $this->mFont = BCD_DEFAULT_FONT;
+ $this->mImg = ImageCreate($this->mWidth, $this->mHeight);
+ $dbColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR;
+ $dfColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR;
+ $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16,
+ ($dbColor & 0x00FF00) >> 8, $dbColor & 0x0000FF);
+ $this->mBrush = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16,
+ ($dfColor & 0x00FF00) >> 8, $dfColor & 0x0000FF);
+ if (!($this->mStyle & BCS_TRANSPARENT)) {
+ ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor);
+ }
+ }
+
+ /**
+ * Returns the image object.
+ * @return object image.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function getImage() {
+ return $this->mImg;
+ }
+
+ /**
+ * Abstract method used to draw the barcode image.
+ * @param int $xres Horizontal resolution.
+ */
+ function DrawObject($xres) {
+ /* there is not implementation neded, is simply the asbsract function. */
+ return false;
+ }
+
+ /**
+ * Draws the barcode border.
+ * @access protected
+ */
+ function DrawBorder() {
+ ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush);
+ }
+
+ /**
+ * Draws the alphanumeric code.
+ * @param int $Font Font type.
+ * @param int $xPos Horiziontal position.
+ * @param int $yPos Vertical position.
+ * @param int $Char Alphanumeric code to write.
+ * @access protected
+ */
+ function DrawChar($Font, $xPos, $yPos, $Char) {
+ ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush);
+ }
+
+ /**
+ * Draws a character string.
+ * @param int $Font Font type.
+ * @param int $xPos Horiziontal position.
+ * @param int $yPos Vertical position.
+ * @param int $Char string to write.
+ * @access protected
+ */
+ function DrawText($Font, $xPos, $yPos, $Char) {
+ ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush);
+ }
+
+ /**
+ * Draws a single barcode bar.
+ * @param int $xPos Horiziontal position.
+ * @param int $yPos Vertical position.
+ * @param int $xSize Horizontal size.
+ * @param int $xSize Vertical size.
+ * @return bool trur in case of success, false otherwise.
+ * @access protected
+ */
+ function DrawSingleBar($xPos, $yPos, $xSize, $ySize) {
+ if ($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth &&
+ $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) {
+ for ($i=0;$i<$xSize;$i++) {
+ ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the current error message.
+ * @return string error message.
+ */
+ function GetError() {
+ return $this->mError;
+ }
+
+ /**
+ * Returns the font height.
+ * @param int $font font type.
+ * @return int font height.
+ */
+ function GetFontHeight($font) {
+ return ImageFontHeight($font);
+ }
+
+ /**
+ * Returns the font width.
+ * @param int $font font type.
+ * @return int font width.
+ */
+ function GetFontWidth($font) {
+ return ImageFontWidth($font);
+ }
+
+ /**
+ * Set font type.
+ * @param int $font font type.
+ */
+ function SetFont($font) {
+ $this->mFont = $font;
+ }
+
+ /**
+ * Returns barcode style.
+ * @return int barcode style.
+ */
+ function GetStyle() {
+ return $this->mStyle;
+ }
+
+ /**
+ * Set barcode style.
+ * @param int $Style barcode style.
+ */
+ function SetStyle ($Style) {
+ $this->mStyle = $Style;
+ }
+
+ /**
+ * Flush the barcode image.
+ */
+ function FlushObject() {
+ if (($this->mStyle & BCS_BORDER)) {
+ $this->DrawBorder();
+ }
+ if ($this->mStyle & BCS_IMAGE_PNG) {
+ Header("Content-Type: image/png");
+ ImagePng($this->mImg);
+ } else if ($this->mStyle & BCS_IMAGE_JPEG) {
+ Header("Content-Type: image/jpeg");
+ ImageJpeg($this->mImg);
+ }
+ }
+
+ /**
+ * Destroy the barcode image.
+ */
+ function DestroyObject() {
+ ImageDestroy($this->mImg);
+ }
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/c128aobject.php b/htdocs/includes/fpdf/tcpdf/barcode/c128aobject.php
new file mode 100644
index 00000000000..8b503e88c2a
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/c128aobject.php
@@ -0,0 +1,399 @@
+
+ * Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
+ * @author Karim Mribti, Nicola Asuni
+ * @name BarcodeObject
+ * @package com.tecnick.tcpdf
+ * @version 0.0.8a 2001-04-01 (original code)
+ * @since 2001-03-25
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+
+/**
+ * Code 128-A Barcode Render Class for PHP using the GD graphics library.
+ * Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
+ * @author Karim Mribti, Nicola Asuni
+ * @name BarcodeObject
+ * @package com.tecnick.tcpdf
+ * @version 0.0.8a 2001-04-01 (original code)
+ * @since 2001-03-25
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+class C128AObject extends BarcodeObject {
+
+ /**
+ * Class Constructor.
+ * @param int $Width Image width in pixels.
+ * @param int $Height Image height in pixels.
+ * @param int $Style Barcode style.
+ * @param int $Value value to print on barcode.
+ */
+ function C128AObject($Width, $Height, $Style, $Value) {
+ $this->BarcodeObject($Width, $Height, $Style);
+ $this->mValue = $Value;
+ $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
+ $this->mCharSet = array (
+ "212222", /* 00 */
+ "222122", /* 01 */
+ "222221", /* 02 */
+ "121223", /* 03 */
+ "121322", /* 04 */
+ "131222", /* 05 */
+ "122213", /* 06 */
+ "122312", /* 07 */
+ "132212", /* 08 */
+ "221213", /* 09 */
+ "221312", /* 10 */
+ "231212", /* 11 */
+ "112232", /* 12 */
+ "122132", /* 13 */
+ "122231", /* 14 */
+ "113222", /* 15 */
+ "123122", /* 16 */
+ "123221", /* 17 */
+ "223211", /* 18 */
+ "221132", /* 19 */
+ "221231", /* 20 */
+ "213212", /* 21 */
+ "223112", /* 22 */
+ "312131", /* 23 */
+ "311222", /* 24 */
+ "321122", /* 25 */
+ "321221", /* 26 */
+ "312212", /* 27 */
+ "322112", /* 28 */
+ "322211", /* 29 */
+ "212123", /* 30 */
+ "212321", /* 31 */
+ "232121", /* 32 */
+ "111323", /* 33 */
+ "131123", /* 34 */
+ "131321", /* 35 */
+ "112313", /* 36 */
+ "132113", /* 37 */
+ "132311", /* 38 */
+ "211313", /* 39 */
+ "231113", /* 40 */
+ "231311", /* 41 */
+ "112133", /* 42 */
+ "112331", /* 43 */
+ "132131", /* 44 */
+ "113123", /* 45 */
+ "113321", /* 46 */
+ "133121", /* 47 */
+ "313121", /* 48 */
+ "211331", /* 49 */
+ "231131", /* 50 */
+ "213113", /* 51 */
+ "213311", /* 52 */
+ "213131", /* 53 */
+ "311123", /* 54 */
+ "311321", /* 55 */
+ "331121", /* 56 */
+ "312113", /* 57 */
+ "312311", /* 58 */
+ "332111", /* 59 */
+ "314111", /* 60 */
+ "221411", /* 61 */
+ "431111", /* 62 */
+ "111224", /* 63 */
+ "111422", /* 64 */
+ "121124", /* 65 */
+ "121421", /* 66 */
+ "141122", /* 67 */
+ "141221", /* 68 */
+ "112214", /* 69 */
+ "112412", /* 70 */
+ "122114", /* 71 */
+ "122411", /* 72 */
+ "142112", /* 73 */
+ "142211", /* 74 */
+ "241211", /* 75 */
+ "221114", /* 76 */
+ "413111", /* 77 */
+ "241112", /* 78 */
+ "134111", /* 79 */
+ "111242", /* 80 */
+ "121142", /* 81 */
+ "121241", /* 82 */
+ "114212", /* 83 */
+ "124112", /* 84 */
+ "124211", /* 85 */
+ "411212", /* 86 */
+ "421112", /* 87 */
+ "421211", /* 88 */
+ "212141", /* 89 */
+ "214121", /* 90 */
+ "412121", /* 91 */
+ "111143", /* 92 */
+ "111341", /* 93 */
+ "131141", /* 94 */
+ "114113", /* 95 */
+ "114311", /* 96 */
+ "411113", /* 97 */
+ "411311", /* 98 */
+ "113141", /* 99 */
+ "114131", /* 100 */
+ "311141", /* 101 */
+ "411131" /* 102 */
+ );
+ }
+
+ /**
+ * Returns the character index.
+ * @param char $char character.
+ * @return int character index or -1 in case of error.
+ * @access private
+ */
+ function GetCharIndex($char) {
+ for ($i=0;$i<64;$i++) {
+ if ($this->mChars[$i] == $char) {
+ return $i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the bar size.
+ * @param int $xres Horizontal resolution.
+ * @param char $char Character.
+ * @return int barcode size.
+ * @access private
+ */
+ function GetBarSize($xres, $char) {
+ switch ($char) {
+ case '1': {
+ $cVal = BCD_C128_BAR_1;
+ break;
+ }
+ case '2': {
+ $cVal = BCD_C128_BAR_2;
+ break;
+ }
+ case '3': {
+ $cVal = BCD_C128_BAR_3;
+ break;
+ }
+ case '4': {
+ $cVal = BCD_C128_BAR_4;
+ break;
+ }
+ default: {
+ $cVal = 0;
+ }
+ }
+ return $cVal * $xres;
+ }
+
+ /**
+ * Returns barcode size.
+ * @param int $xres Horizontal resolution.
+ * @return barcode size.
+ * @access private
+ */
+ function GetSize($xres) {
+ $len = strlen($this->mValue);
+
+ if ($len == 0) {
+ $this->mError = "Null value";
+ return false;
+ }
+ $ret = 0;
+ for ($i=0;$i<$len;$i++) {
+ if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) {
+ $this->mError = "C128A not include the char '".$this->mValue[$i]."'";
+ return false;
+ } else {
+ $cset = $this->mCharSet[$id];
+ $ret += $this->GetBarSize($xres, $cset[0]);
+ $ret += $this->GetBarSize($xres, $cset[1]);
+ $ret += $this->GetBarSize($xres, $cset[2]);
+ $ret += $this->GetBarSize($xres, $cset[3]);
+ $ret += $this->GetBarSize($xres, $cset[4]);
+ $ret += $this->GetBarSize($xres, $cset[5]);
+ }
+ }
+
+ /* length of Check character */
+ $cset = $this->GetCheckCharValue();
+ $CheckSize = 0;
+ for ($i=0;$i<6;$i++) {
+ $CheckSize += $this->GetBarSize($cset[$i], $xres);
+ }
+ $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres;
+ $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres;
+ return $StartSize + $ret + $CheckSize + $StopSize;
+ }
+
+ /**
+ * Returns the check-char value.
+ * @return string.
+ * @access private
+ */
+ function GetCheckCharValue() {
+ $len = strlen($this->mValue);
+ $sum = 103; // 'A' type;
+ for ($i=0;$i<$len;$i++) {
+ $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1);
+ }
+ $check = $sum % 103;
+ return $this->mCharSet[$check];
+ }
+
+ /**
+ * Draws the start code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStart($DrawPos, $yPos, $ySize, $xres) {
+ /* Start code is '211412' */
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('4', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the stop code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStop($DrawPos, $yPos, $ySize, $xres) {
+ /* Stop code is '2331112' */
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the check-char code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) {
+ $cset = $this->GetCheckCharValue();
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[0], $xres);
+ $DrawPos += $this->GetBarSize($cset[1], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[2], $xres);
+ $DrawPos += $this->GetBarSize($cset[3], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[4], $xres);
+ $DrawPos += $this->GetBarSize($cset[5], $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the barcode object.
+ * @param int $xres Horizontal resolution.
+ * @return bool true in case of success.
+ */
+ function DrawObject($xres) {
+ $len = strlen($this->mValue);
+ if (($size = $this->GetSize($xres))==0) {
+ return false;
+ }
+
+ if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
+ else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
+ else $sPos = 0;
+
+ /* Total height of bar code -Bars only- */
+ if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
+ else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
+
+ /* Draw text */
+ if ($this->mStyle & BCS_DRAW_TEXT) {
+ if ($this->mStyle & BCS_STRETCH_TEXT) {
+ for ($i=0;$i<$len;$i++) {
+ $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i,
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
+ }
+ } else {/* Center */
+ $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
+ $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres),
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
+ }
+ }
+
+ $cPos = 0;
+ $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ do {
+ $c = $this->GetCharIndex($this->mValue[$cPos]);
+ $cset = $this->mCharSet[$c];
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[0], $xres);
+ $DrawPos += $this->GetBarSize($cset[1], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[2], $xres);
+ $DrawPos += $this->GetBarSize($cset[3], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[4], $xres);
+ $DrawPos += $this->GetBarSize($cset[5], $xres);
+ $cPos++;
+ } while ($cPos<$len);
+ $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ return true;
+ }
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/c128bobject.php b/htdocs/includes/fpdf/tcpdf/barcode/c128bobject.php
new file mode 100644
index 00000000000..b8edf28b25e
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/c128bobject.php
@@ -0,0 +1,399 @@
+
+* Code 128-B is a continuous, multilevel and full ASCII code.
+* @author Karim Mribti, Nicola Asuni
+* @name BarcodeObject
+* @package com.tecnick.tcpdf
+* @version 0.0.8a 2001-04-01 (original code)
+* @since 2001-03-25
+* @license http://www.gnu.org/copyleft/lesser.html LGPL
+*/
+
+/**
+* Code 128-B Barcode Render Class for PHP using the GD graphics library.
+* Code 128-B is a continuous, multilevel and full ASCII code.
+* @author Karim Mribti, Nicola Asuni
+* @name BarcodeObject
+* @package com.tecnick.tcpdf
+* @version 0.0.8a 2001-04-01 (original code)
+* @since 2001-03-25
+* @license http://www.gnu.org/copyleft/lesser.html LGPL
+*/
+class C128BObject extends BarcodeObject {
+
+ /**
+ * Class Constructor.
+ * @param int $Width Image width in pixels.
+ * @param int $Height Image height in pixels.
+ * @param int $Style Barcode style.
+ * @param int $Value value to print on barcode.
+ */
+ function C128BObject($Width, $Height, $Style, $Value) {
+ $this->BarcodeObject($Width, $Height, $Style);
+ $this->mValue = $Value;
+ $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{ }~";
+ $this->mCharSet = array (
+ "212222", /* 00 */
+ "222122", /* 01 */
+ "222221", /* 02 */
+ "121223", /* 03 */
+ "121322", /* 04 */
+ "131222", /* 05 */
+ "122213", /* 06 */
+ "122312", /* 07 */
+ "132212", /* 08 */
+ "221213", /* 09 */
+ "221312", /* 10 */
+ "231212", /* 11 */
+ "112232", /* 12 */
+ "122132", /* 13 */
+ "122231", /* 14 */
+ "113222", /* 15 */
+ "123122", /* 16 */
+ "123221", /* 17 */
+ "223211", /* 18 */
+ "221132", /* 19 */
+ "221231", /* 20 */
+ "213212", /* 21 */
+ "223112", /* 22 */
+ "312131", /* 23 */
+ "311222", /* 24 */
+ "321122", /* 25 */
+ "321221", /* 26 */
+ "312212", /* 27 */
+ "322112", /* 28 */
+ "322211", /* 29 */
+ "212123", /* 30 */
+ "212321", /* 31 */
+ "232121", /* 32 */
+ "111323", /* 33 */
+ "131123", /* 34 */
+ "131321", /* 35 */
+ "112313", /* 36 */
+ "132113", /* 37 */
+ "132311", /* 38 */
+ "211313", /* 39 */
+ "231113", /* 40 */
+ "231311", /* 41 */
+ "112133", /* 42 */
+ "112331", /* 43 */
+ "132131", /* 44 */
+ "113123", /* 45 */
+ "113321", /* 46 */
+ "133121", /* 47 */
+ "313121", /* 48 */
+ "211331", /* 49 */
+ "231131", /* 50 */
+ "213113", /* 51 */
+ "213311", /* 52 */
+ "213131", /* 53 */
+ "311123", /* 54 */
+ "311321", /* 55 */
+ "331121", /* 56 */
+ "312113", /* 57 */
+ "312311", /* 58 */
+ "332111", /* 59 */
+ "314111", /* 60 */
+ "221411", /* 61 */
+ "431111", /* 62 */
+ "111224", /* 63 */
+ "111422", /* 64 */
+ "121124", /* 65 */
+ "121421", /* 66 */
+ "141122", /* 67 */
+ "141221", /* 68 */
+ "112214", /* 69 */
+ "112412", /* 70 */
+ "122114", /* 71 */
+ "122411", /* 72 */
+ "142112", /* 73 */
+ "142211", /* 74 */
+ "241211", /* 75 */
+ "221114", /* 76 */
+ "413111", /* 77 */
+ "241112", /* 78 */
+ "134111", /* 79 */
+ "111242", /* 80 */
+ "121142", /* 81 */
+ "121241", /* 82 */
+ "114212", /* 83 */
+ "124112", /* 84 */
+ "124211", /* 85 */
+ "411212", /* 86 */
+ "421112", /* 87 */
+ "421211", /* 88 */
+ "212141", /* 89 */
+ "214121", /* 90 */
+ "412121", /* 91 */
+ "111143", /* 92 */
+ "111341", /* 93 */
+ "131141", /* 94 */
+ "114113", /* 95 */
+ "114311", /* 96 */
+ "411113", /* 97 */
+ "411311", /* 98 */
+ "113141", /* 99 */
+ "114131", /* 100 */
+ "311141", /* 101 */
+ "411131" /* 102 */
+ );
+ }
+
+ /**
+ * Returns the character index.
+ * @param char $char character.
+ * @return int character index or -1 in case of error.
+ * @access private
+ */
+ function GetCharIndex($char) {
+ for ($i=0;$i<95;$i++) {
+ if ($this->mChars[$i] == $char) {
+ return $i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the bar size.
+ * @param int $xres Horizontal resolution.
+ * @param char $char Character.
+ * @return int barcode size.
+ * @access private
+ */
+ function GetBarSize($xres, $char) {
+ switch ($char) {
+ case '1': {
+ $cVal = BCD_C128_BAR_1;
+ break;
+ }
+ case '2': {
+ $cVal = BCD_C128_BAR_2;
+ break;
+ }
+ case '3': {
+ $cVal = BCD_C128_BAR_3;
+ break;
+ }
+ case '4': {
+ $cVal = BCD_C128_BAR_4;
+ break;
+ }
+ default: {
+ $cVal = 0;
+ }
+ }
+ return $cVal * $xres;
+ }
+
+ /**
+ * Returns barcode size.
+ * @param int $xres Horizontal resolution.
+ * @return barcode size.
+ * @access private
+ */
+ function GetSize($xres) {
+ $len = strlen($this->mValue);
+
+ if ($len == 0) {
+ $this->mError = "Null value";
+ return false;
+ }
+ $ret = 0;
+ for ($i=0;$i<$len;$i++) {
+ if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) {
+ $this->mError = "C128B not include the char '".$this->mValue[$i]."'";
+ return false;
+ } else {
+ $cset = $this->mCharSet[$id];
+ $ret += $this->GetBarSize($xres, $cset[0]);
+ $ret += $this->GetBarSize($xres, $cset[1]);
+ $ret += $this->GetBarSize($xres, $cset[2]);
+ $ret += $this->GetBarSize($xres, $cset[3]);
+ $ret += $this->GetBarSize($xres, $cset[4]);
+ $ret += $this->GetBarSize($xres, $cset[5]);
+ }
+ }
+ /* length of Check character */
+ $cset = $this->GetCheckCharValue();
+ $CheckSize = 0;
+ for ($i=0;$i<6;$i++) {
+ $CheckSize += $this->GetBarSize($cset[$i], $xres);
+ }
+
+ $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres;
+ $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres;
+
+ return $StartSize + $ret + $CheckSize + $StopSize;
+ }
+
+ /**
+ * Returns the check-char value.
+ * @return string.
+ * @access private
+ */
+ function GetCheckCharValue() {
+ $len = strlen($this->mValue);
+ $sum = 104; // 'B' type;
+ for ($i=0;$i<$len;$i++) {
+ $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1);
+ }
+ $check = $sum % 103;
+ return $this->mCharSet[$check];
+ }
+
+ /**
+ * Draws the start code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStart($DrawPos, $yPos, $ySize, $xres) {
+ /* Start code is '211214' */
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('4', $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the stop code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStop($DrawPos, $yPos, $ySize, $xres) {
+ /* Stop code is '2331112' */
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the check-char code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) {
+ $cset = $this->GetCheckCharValue();
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[0], $xres);
+ $DrawPos += $this->GetBarSize($cset[1], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[2], $xres);
+ $DrawPos += $this->GetBarSize($cset[3], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[4], $xres);
+ $DrawPos += $this->GetBarSize($cset[5], $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the barcode object.
+ * @param int $xres Horizontal resolution.
+ * @return bool true in case of success.
+ */
+ function DrawObject($xres) {
+ $len = strlen($this->mValue);
+ if (($size = $this->GetSize($xres))==0) {
+ return false;
+ }
+
+ if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
+ else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
+ else $sPos = 0;
+
+ /* Total height of bar code -Bars only- */
+ if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
+ else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
+
+ /* Draw text */
+ if ($this->mStyle & BCS_DRAW_TEXT) {
+ if ($this->mStyle & BCS_STRETCH_TEXT) {
+ for ($i=0;$i<$len;$i++) {
+ $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i,
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
+ }
+ } else {/* Center */
+ $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
+ $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres),
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
+ }
+ }
+
+ $cPos = 0;
+ $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ do {
+ $c = $this->GetCharIndex($this->mValue[$cPos]);
+ $cset = $this->mCharSet[$c];
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[0], $xres);
+ $DrawPos += $this->GetBarSize($cset[1], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[2], $xres);
+ $DrawPos += $this->GetBarSize($cset[3], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[4], $xres);
+ $DrawPos += $this->GetBarSize($cset[5], $xres);
+ $cPos++;
+ } while ($cPos<$len);
+ $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ return true;
+ }
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/c128cobject.php b/htdocs/includes/fpdf/tcpdf/barcode/c128cobject.php
new file mode 100644
index 00000000000..041e06be08f
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/c128cobject.php
@@ -0,0 +1,419 @@
+
+ * Code 128-C is numeric only and provides the most efficiency.
+ * @author Karim Mribti, Nicola Asuni
+ * @name BarcodeObject
+ * @package com.tecnick.tcpdf
+ * @version 0.0.8a 2001-04-01 (original code)
+ * @since 2001-03-25
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+
+/**
+ * Code 128-C Barcode Render Class for PHP using the GD graphics library.
+ * Code 128-C is numeric only and provides the most efficiency.
+ * @author Karim Mribti, Nicola Asuni
+ * @name BarcodeObject
+ * @package com.tecnick.tcpdf
+ * @version 0.0.8a 2001-04-01 (original code)
+ * @since 2001-03-25
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+class C128CObject extends BarcodeObject {
+
+ /**
+ * Class Constructor.
+ * @param int $Width Image width in pixels.
+ * @param int $Height Image height in pixels.
+ * @param int $Style Barcode style.
+ * @param int $Value value to print on barcode.
+ */
+ function C128CObject($Width, $Height, $Style, $Value) {
+ $this->BarcodeObject($Width, $Height, $Style);
+ $this->mValue = $Value;
+ $this->mChars = array (
+ "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
+ "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
+ "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
+ "30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
+ "40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
+ "50", "51", "52", "53", "54", "55", "56", "57", "58", "59",
+ "60", "61", "62", "63", "64", "65", "66", "67", "68", "69",
+ "70", "71", "72", "73", "74", "75", "76", "77", "78", "79",
+ "80", "81", "82", "83", "84", "85", "86", "87", "88", "89",
+ "90", "91", "92", "93", "94", "95", "96", "97", "98", "99",
+ );
+ $this->mCharSet = array (
+ "212222", /* 00 */
+ "222122", /* 01 */
+ "222221", /* 02 */
+ "121223", /* 03 */
+ "121322", /* 04 */
+ "131222", /* 05 */
+ "122213", /* 06 */
+ "122312", /* 07 */
+ "132212", /* 08 */
+ "221213", /* 09 */
+ "221312", /* 10 */
+ "231212", /* 11 */
+ "112232", /* 12 */
+ "122132", /* 13 */
+ "122231", /* 14 */
+ "113222", /* 15 */
+ "123122", /* 16 */
+ "123221", /* 17 */
+ "223211", /* 18 */
+ "221132", /* 19 */
+ "221231", /* 20 */
+ "213212", /* 21 */
+ "223112", /* 22 */
+ "312131", /* 23 */
+ "311222", /* 24 */
+ "321122", /* 25 */
+ "321221", /* 26 */
+ "312212", /* 27 */
+ "322112", /* 28 */
+ "322211", /* 29 */
+ "212123", /* 30 */
+ "212321", /* 31 */
+ "232121", /* 32 */
+ "111323", /* 33 */
+ "131123", /* 34 */
+ "131321", /* 35 */
+ "112313", /* 36 */
+ "132113", /* 37 */
+ "132311", /* 38 */
+ "211313", /* 39 */
+ "231113", /* 40 */
+ "231311", /* 41 */
+ "112133", /* 42 */
+ "112331", /* 43 */
+ "132131", /* 44 */
+ "113123", /* 45 */
+ "113321", /* 46 */
+ "133121", /* 47 */
+ "313121", /* 48 */
+ "211331", /* 49 */
+ "231131", /* 50 */
+ "213113", /* 51 */
+ "213311", /* 52 */
+ "213131", /* 53 */
+ "311123", /* 54 */
+ "311321", /* 55 */
+ "331121", /* 56 */
+ "312113", /* 57 */
+ "312311", /* 58 */
+ "332111", /* 59 */
+ "314111", /* 60 */
+ "221411", /* 61 */
+ "431111", /* 62 */
+ "111224", /* 63 */
+ "111422", /* 64 */
+ "121124", /* 65 */
+ "121421", /* 66 */
+ "141122", /* 67 */
+ "141221", /* 68 */
+ "112214", /* 69 */
+ "112412", /* 70 */
+ "122114", /* 71 */
+ "122411", /* 72 */
+ "142112", /* 73 */
+ "142211", /* 74 */
+ "241211", /* 75 */
+ "221114", /* 76 */
+ "413111", /* 77 */
+ "241112", /* 78 */
+ "134111", /* 79 */
+ "111242", /* 80 */
+ "121142", /* 81 */
+ "121241", /* 82 */
+ "114212", /* 83 */
+ "124112", /* 84 */
+ "124211", /* 85 */
+ "411212", /* 86 */
+ "421112", /* 87 */
+ "421211", /* 88 */
+ "212141", /* 89 */
+ "214121", /* 90 */
+ "412121", /* 91 */
+ "111143", /* 92 */
+ "111341", /* 93 */
+ "131141", /* 94 */
+ "114113", /* 95 */
+ "114311", /* 96 */
+ "411113", /* 97 */
+ "411311", /* 98 */
+ "113141", /* 99 */
+ );
+ }
+
+ /**
+ * Returns the character index.
+ * @param char $char character.
+ * @return int character index or -1 in case of error.
+ * @access private
+ */
+ function GetCharIndex($char) {
+ for ($i=0;$i<100;$i++) {
+ if ($this->mChars[$i] == $char) {
+ return $i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the bar size.
+ * @param int $xres Horizontal resolution.
+ * @param char $char Character.
+ * @return int barcode size.
+ * @access private
+ */
+ function GetBarSize($xres, $char) {
+ switch ($char) {
+ case '1': {
+ $cVal = BCD_C128_BAR_1;
+ break;
+ }
+ case '2': {
+ $cVal = BCD_C128_BAR_2;
+ break;
+ }
+ case '3': {
+ $cVal = BCD_C128_BAR_3;
+ break;
+ }
+ case '4': {
+ $cVal = BCD_C128_BAR_4;
+ break;
+ }
+ default: {
+ $cVal = 0;
+ }
+ }
+ return $cVal * $xres;
+ }
+
+ /**
+ * Returns barcode size.
+ * @param int $xres Horizontal resolution.
+ * @return barcode size.
+ * @access private
+ */
+ function GetSize($xres) {
+ $len = strlen($this->mValue);
+
+ if ($len == 0) {
+ $this->mError = "Null value";
+ return false;
+ }
+ $ret = 0;
+
+ for ($i=0;$i<$len;$i++) {
+ if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) {
+ $this->mError = "Code-128C is numeric only";
+ return false;
+ }
+ }
+
+ if (($len%2) != 0) {
+ $this->mError = "The length of barcode value must be even. You must pad the number with zeros.";
+ return false;
+ }
+
+ for ($i=0;$i<$len;$i+=2) {
+ $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]);
+ $cset = $this->mCharSet[$id];
+ $ret += $this->GetBarSize($xres, $cset[0]);
+ $ret += $this->GetBarSize($xres, $cset[1]);
+ $ret += $this->GetBarSize($xres, $cset[2]);
+ $ret += $this->GetBarSize($xres, $cset[3]);
+ $ret += $this->GetBarSize($xres, $cset[4]);
+ $ret += $this->GetBarSize($xres, $cset[5]);
+ }
+ /* length of Check character */
+ $cset = $this->GetCheckCharValue();
+ $CheckSize = 0;
+ for ($i=0;$i<6;$i++) {
+ $CheckSize += $this->GetBarSize($cset[$i], $xres);
+ }
+
+ $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres;
+ $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres;
+ return $StartSize + $ret + $CheckSize + $StopSize;
+ }
+
+ /**
+ * Returns the check-char value.
+ * @return string.
+ * @access private
+ */
+ function GetCheckCharValue() {
+ $len = strlen($this->mValue);
+ $sum = 105; // 'C' type;
+ $m = 0;
+ for ($i=0;$i<$len;$i+=2) {
+ $m++;
+ $sum += $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]) * $m;
+ }
+ $check = $sum % 103;
+ return $this->mCharSet[$check];
+ }
+
+ /**
+ * Draws the start code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStart($DrawPos, $yPos, $ySize, $xres) {
+ /* Start code is '211232' */
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the stop code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStop($DrawPos, $yPos, $ySize, $xres) {
+ /* Stop code is '2331112' */
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('3', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $DrawPos += $this->GetBarSize('1', $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
+ $DrawPos += $this->GetBarSize('2', $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the check-char code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) {
+ $cset = $this->GetCheckCharValue();
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[0], $xres);
+ $DrawPos += $this->GetBarSize($cset[1], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[2], $xres);
+ $DrawPos += $this->GetBarSize($cset[3], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize);
+ $DrawPos += $this->GetBarSize($cset[4], $xres);
+ $DrawPos += $this->GetBarSize($cset[5], $xres);
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the barcode object.
+ * @param int $xres Horizontal resolution.
+ * @return bool true in case of success.
+ */
+ function DrawObject($xres) {
+ $len = strlen($this->mValue);
+ if (($size = $this->GetSize($xres))==0) {
+ return false;
+ }
+
+ if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
+ else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
+ else $sPos = 0;
+
+ /* Total height of bar code -Bars only- */
+ if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
+ else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
+
+ /* Draw text */
+ if ($this->mStyle & BCS_DRAW_TEXT) {
+ if ($this->mStyle & BCS_STRETCH_TEXT) {
+ for ($i=0;$i<$len;$i++) {
+ $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i,
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
+ }
+ } else {/* Center */
+ $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
+ $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres),
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
+ }
+ }
+
+ $cPos = 0;
+ $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ do {
+ $c = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos+1]);
+ $cset = $this->mCharSet[$c];
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[0], $xres);
+ $DrawPos += $this->GetBarSize($cset[1], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[2], $xres);
+ $DrawPos += $this->GetBarSize($cset[3], $xres);
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize);
+ $DrawPos += $this->GetBarSize($cset[4], $xres);
+ $DrawPos += $this->GetBarSize($cset[5], $xres);
+ $cPos += 2;
+ } while ($cPos<$len);
+ $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ return true;
+ }
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/c39object.php b/htdocs/includes/fpdf/tcpdf/barcode/c39object.php
new file mode 100644
index 00000000000..b7a3ebef232
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/c39object.php
@@ -0,0 +1,283 @@
+
+ * Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols.
+ * @author Karim Mribti, Nicola Asuni
+ * @name BarcodeObject
+ * @package com.tecnick.tcpdf
+ * @version 0.0.8a 2001-04-01 (original code)
+ * @since 2001-03-25
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+
+/**
+ * Code 39 Barcode Render Class.
+ * Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols.
+ * @author Karim Mribti, Nicola Asuni
+ * @name BarcodeObject
+ * @package com.tecnick.tcpdf
+ * @version 0.0.8a 2001-04-01 (original code)
+ * @since 2001-03-25
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+class C39Object extends BarcodeObject {
+
+ /**
+ * Class Constructor.
+ * @param int $Width Image width in pixels.
+ * @param int $Height Image height in pixels.
+ * @param int $Style Barcode style.
+ * @param int $Value value to print on barcode.
+ */
+ function C39Object($Width, $Height, $Style, $Value) {
+ $this->BarcodeObject($Width, $Height, $Style);
+ $this->mValue = $Value;
+ $this->mChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
+ $this->mCharSet = array (
+ /* 0 */ "000110100",
+ /* 1 */ "100100001",
+ /* 2 */ "001100001",
+ /* 3 */ "101100000",
+ /* 4 */ "000110001",
+ /* 5 */ "100110000",
+ /* 6 */ "001110000",
+ /* 7 */ "000100101",
+ /* 8 */ "100100100",
+ /* 9 */ "001100100",
+ /* A */ "100001001",
+ /* B */ "001001001",
+ /* C */ "101001000",
+ /* D */ "000011001",
+ /* E */ "100011000",
+ /* F */ "001011000",
+ /* G */ "000001101",
+ /* H */ "100001100",
+ /* I */ "001001100",
+ /* J */ "000011100",
+ /* K */ "100000011",
+ /* L */ "001000011",
+ /* M */ "101000010",
+ /* N */ "000010011",
+ /* O */ "100010010",
+ /* P */ "001010010",
+ /* Q */ "000000111",
+ /* R */ "100000110",
+ /* S */ "001000110",
+ /* T */ "000010110",
+ /* U */ "110000001",
+ /* V */ "011000001",
+ /* W */ "111000000",
+ /* X */ "010010001",
+ /* Y */ "110010000",
+ /* Z */ "011010000",
+ /* - */ "010000101",
+ /* . */ "110000100",
+ /* SP */ "011000100",
+ /* * */ "010010100",
+ /* $ */ "010101000",
+ /* / */ "010100010",
+ /* + */ "010001010",
+ /* % */ "000101010"
+ );
+ }
+
+ /**
+ * Returns the character index.
+ * @param char $char character.
+ * @return int character index or -1 in case of error.
+ * @access private
+ */
+ function GetCharIndex($char) {
+ for ($i=0;$i<44;$i++) {
+ if ($this->mChars[$i] == $char) {
+ return $i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns barcode size.
+ * @param int $xres Horizontal resolution.
+ * @return barcode size.
+ * @access private
+ */
+ function GetSize($xres) {
+ $len = strlen($this->mValue);
+
+ if ($len == 0) {
+ $this->mError = "Null value";
+ return false;
+ }
+
+ for ($i=0;$i<$len;$i++) {
+ if ($this->GetCharIndex($this->mValue[$i]) == -1 || $this->mValue[$i] == '*') {
+ /* The asterisk is only used as a start and stop code */
+ $this->mError = "C39 not include the char '".$this->mValue[$i]."'";
+ return false;
+ }
+ }
+
+ /* Start, Stop is 010010100 == '*' */
+ $StartSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3;
+ $StopSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3;
+ $CharSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; /* Same for all chars */
+
+ return $CharSize * $len + $StartSize + $StopSize + /* Space between chars */ BCD_C39_NARROW_BAR * $xres * ($len-1);
+ }
+
+ /**
+ * Draws the start code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStart($DrawPos, $yPos, $ySize, $xres) {
+ /* Start code is '*' */
+ $narrow = BCD_C39_NARROW_BAR * $xres;
+ $wide = BCD_C39_WIDE_BAR * $xres;
+ $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
+ $DrawPos += $narrow;
+ $DrawPos += $wide;
+ $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
+ $DrawPos += $narrow;
+ $DrawPos += $narrow;
+ $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
+ $DrawPos += $wide;
+ $DrawPos += $narrow;
+ $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
+ $DrawPos += $wide;
+ $DrawPos += $narrow;
+ $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize);
+ $DrawPos += $narrow;
+ $DrawPos += $narrow; /* Space between chars */
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the stop code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStop($DrawPos, $yPos, $ySize, $xres) {
+ /* Stop code is '*' */
+ $narrow = BCD_C39_NARROW_BAR * $xres;
+ $wide = BCD_C39_WIDE_BAR * $xres;
+ $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
+ $DrawPos += $narrow;
+ $DrawPos += $wide;
+ $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
+ $DrawPos += $narrow;
+ $DrawPos += $narrow;
+ $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
+ $DrawPos += $wide;
+ $DrawPos += $narrow;
+ $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
+ $DrawPos += $wide;
+ $DrawPos += $narrow;
+ $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize);
+ $DrawPos += $narrow;
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the barcode object.
+ * @param int $xres Horizontal resolution.
+ * @return bool true in case of success.
+ */
+ function DrawObject($xres) {
+ $len = strlen($this->mValue);
+
+ $narrow = BCD_C39_NARROW_BAR * $xres;
+ $wide = BCD_C39_WIDE_BAR * $xres;
+
+ if (($size = $this->GetSize($xres))==0) {
+ return false;
+ }
+
+ $cPos = 0;
+ if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
+ else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
+ else $sPos = 0;
+
+ /* Total height of bar code -Bars only- */
+ if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
+ else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
+
+ /* Draw text */
+ if ($this->mStyle & BCS_DRAW_TEXT) {
+ if ($this->mStyle & BCS_STRETCH_TEXT) {
+ for ($i=0;$i<$len;$i++) {
+ $this->DrawChar($this->mFont, $sPos+($narrow*6+$wide*3)+($size/$len)*$i,
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
+ }
+ } else {/* Center */
+ $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
+ $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+($narrow*6+$wide*3),
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
+ }
+ }
+
+ $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ do {
+ $c = $this->GetCharIndex($this->mValue[$cPos]);
+ $cset = $this->mCharSet[$c];
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[0] == '0') ? $narrow : $wide , $ysize);
+ $DrawPos += ($cset[0] == '0') ? $narrow : $wide;
+ $DrawPos += ($cset[1] == '0') ? $narrow : $wide;
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[2] == '0') ? $narrow : $wide , $ysize);
+ $DrawPos += ($cset[2] == '0') ? $narrow : $wide;
+ $DrawPos += ($cset[3] == '0') ? $narrow : $wide;
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[4] == '0') ? $narrow : $wide , $ysize);
+ $DrawPos += ($cset[4] == '0') ? $narrow : $wide;
+ $DrawPos += ($cset[5] == '0') ? $narrow : $wide;
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[6] == '0') ? $narrow : $wide , $ysize);
+ $DrawPos += ($cset[6] == '0') ? $narrow : $wide;
+ $DrawPos += ($cset[7] == '0') ? $narrow : $wide;
+ $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[8] == '0') ? $narrow : $wide , $ysize);
+ $DrawPos += ($cset[8] == '0') ? $narrow : $wide;
+ $DrawPos += $narrow; /* Space between chars */
+ $cPos++;
+ } while ($cPos<$len);
+ $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
+ return true;
+ }
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/i25object.php b/htdocs/includes/fpdf/tcpdf/barcode/i25object.php
new file mode 100644
index 00000000000..ecf3359d2f6
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/i25object.php
@@ -0,0 +1,217 @@
+BarcodeObject($Width, $Height, $Style);
+ $this->mValue = $Value;
+ $this->mCharSet = array (
+ /* 0 */ "00110",
+ /* 1 */ "10001",
+ /* 2 */ "01001",
+ /* 3 */ "11000",
+ /* 4 */ "00101",
+ /* 5 */ "10100",
+ /* 6 */ "01100",
+ /* 7 */ "00011",
+ /* 8 */ "10010",
+ /* 9 */ "01010"
+ );
+ }
+
+ /**
+ * Returns barcode size.
+ * @param int $xres Horizontal resolution.
+ * @return barcode size.
+ * @access private
+ */
+ function GetSize($xres) {
+ $len = strlen($this->mValue);
+
+ if ($len == 0) {
+ $this->mError = "Null value";
+ return false;
+ }
+
+ for ($i=0;$i<$len;$i++) {
+ if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) {
+ $this->mError = "I25 is numeric only";
+ return false;
+ }
+ }
+
+ if (($len%2) != 0) {
+ $this->mError = "The length of barcode value must be even";
+ return false;
+ }
+ $StartSize = BCD_I25_NARROW_BAR * 4 * $xres;
+ $StopSize = BCD_I25_WIDE_BAR * $xres + 2 * BCD_I25_NARROW_BAR * $xres;
+ $cPos = 0;
+ $sPos = 0;
+ do {
+ $c1 = $this->mValue[$cPos];
+ $c2 = $this->mValue[$cPos+1];
+ $cset1 = $this->mCharSet[$c1];
+ $cset2 = $this->mCharSet[$c2];
+
+ for ($i=0;$i<5;$i++) {
+ $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres);
+ $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres);
+ $sPos += ($type1 + $type2);
+ }
+ $cPos+=2;
+ } while ($cPos<$len);
+
+ return $sPos + $StartSize + $StopSize;
+ }
+
+ /**
+ * Draws the start code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStart($DrawPos, $yPos, $ySize, $xres) {
+ /* Start code is "0000" */
+ $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize);
+ $DrawPos += BCD_I25_NARROW_BAR * $xres;
+ $DrawPos += BCD_I25_NARROW_BAR * $xres;
+ $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize);
+ $DrawPos += BCD_I25_NARROW_BAR * $xres;
+ $DrawPos += BCD_I25_NARROW_BAR * $xres;
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the stop code.
+ * @param int $DrawPos Drawing position.
+ * @param int $yPos Vertical position.
+ * @param int $ySize Vertical size.
+ * @param int $xres Horizontal resolution.
+ * @return int drawing position.
+ * @access private
+ */
+ function DrawStop($DrawPos, $yPos, $ySize, $xres) {
+ /* Stop code is "100" */
+ $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_WIDE_BAR * $xres , $ySize);
+ $DrawPos += BCD_I25_WIDE_BAR * $xres;
+ $DrawPos += BCD_I25_NARROW_BAR * $xres;
+ $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize);
+ $DrawPos += BCD_I25_NARROW_BAR * $xres;
+ return $DrawPos;
+ }
+
+ /**
+ * Draws the barcode object.
+ * @param int $xres Horizontal resolution.
+ * @return bool true in case of success.
+ */
+ function DrawObject($xres) {
+ $len = strlen($this->mValue);
+
+ if (($size = $this->GetSize($xres))==0) {
+ return false;
+ }
+
+ $cPos = 0;
+
+ if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
+ else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
+
+ if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
+ else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
+ else $sPos = 0;
+
+ if ($this->mStyle & BCS_DRAW_TEXT) {
+ if ($this->mStyle & BCS_STRETCH_TEXT) {
+ /* Stretch */
+ for ($i=0;$i<$len;$i++) {
+ $this->DrawChar($this->mFont, $sPos+BCD_I25_NARROW_BAR*4*$xres+($size/$len)*$i,
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET , $this->mValue[$i]);
+ }
+ }else {/* Center */
+ $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
+ $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(BCD_I25_NARROW_BAR*4*$xres),
+ $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
+ }
+ }
+
+ $sPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
+ do {
+ $c1 = $this->mValue[$cPos];
+ $c2 = $this->mValue[$cPos+1];
+ $cset1 = $this->mCharSet[$c1];
+ $cset2 = $this->mCharSet[$c2];
+
+ for ($i=0;$i<5;$i++) {
+ $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres);
+ $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres);
+ $this->DrawSingleBar($sPos, BCD_DEFAULT_MAR_Y1, $type1 , $ysize);
+ $sPos += ($type1 + $type2);
+ }
+ $cPos+=2;
+ } while ($cPos<$len);
+ $sPos = $this->DrawStop($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
+ return true;
+ }
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/image.php b/htdocs/includes/fpdf/tcpdf/barcode/image.php
new file mode 100644
index 00000000000..dccafd4630b
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/image.php
@@ -0,0 +1,88 @@
+SetFont($_REQUEST['font']);
+ $obj->DrawObject($_REQUEST['xres']);
+ $obj->FlushObject();
+ $obj->DestroyObject();
+ unset($obj); /* clean */
+}
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/barcode/lesser.txt b/htdocs/includes/fpdf/tcpdf/barcode/lesser.txt
new file mode 100644
index 00000000000..678c6921d59
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/barcode/lesser.txt
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/htdocs/includes/fpdf/tcpdf/config/lang/eng.php b/htdocs/includes/fpdf/tcpdf/config/lang/eng.php
new file mode 100644
index 00000000000..a86a3bbf594
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/config/lang/eng.php
@@ -0,0 +1,49 @@
+
diff --git a/htdocs/includes/fpdf/tcpdf/config/tcpdf_config.php b/htdocs/includes/fpdf/tcpdf/config/tcpdf_config.php
new file mode 100644
index 00000000000..af00b2b3bde
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/config/tcpdf_config.php
@@ -0,0 +1,191 @@
+
diff --git a/htdocs/includes/fpdf/tcpdf/doc/blank.html b/htdocs/includes/fpdf/tcpdf/doc/blank.html
new file mode 100644
index 00000000000..0da23a2fad9
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/doc/blank.html
@@ -0,0 +1,13 @@
+
+
+ TCPDF Documentation
+
+
+
+
+
TCPDF Documentation
+Welcome to com.tecnick.com.tcpdf!
+
+This documentation was generated by phpDocumentor v1.3.0RC3
+
+
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/doc/classtrees_com.tecnick.tcpdf.html b/htdocs/includes/fpdf/tcpdf/doc/classtrees_com.tecnick.tcpdf.html
new file mode 100644
index 00000000000..7566c4e46fa
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/doc/classtrees_com.tecnick.tcpdf.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code 128-A Barcode Render Class for PHP using the GD graphics library. Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
+
Code 128-A Barcode Render Class for PHP using the GD graphics library. Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
This is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.
+
This class is an extension and improvement of the FPDF class by Olivier Plathey (http://www.fpdf.org). This version contains some changes: [porting to PHP4, support for UTF-8 Unicode, code style and formatting, php documentation (www.phpdoc.org), ISO page formats, minor improvements, image scale factor] TCPDF project (http://tcpdf.sourceforge.net) is based on the public Domain FPDF class by Olivier Plathey (http://www.fpdf.org). To add your own TTF fonts please read /fonts/README.TXT
+ string
+ $orientation: page orientation. Possible values are (case insensitive):
P or Portrait (default)
L or Landscape
+
+ string
+ $unit: User measure unit. Possible values are:
pt: point
mm: millimeter (default)
cm: centimeter
in: inch
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
+
+ mixed
+ $format: The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).
4A0
2A0
A0
A1
A2
A3
A4 (default)
A5
A6
A7
A8
A9
A10
B0
B1
B2
B3
B4
B5
B6
B7
B8
B9
B10
C0
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
RA0
RA1
RA2
RA3
RA4
SRA0
SRA1
SRA2
SRA3
SRA4
LETTER
LEGAL
EXECUTIVE
FOLIO
+
+ boolean
+ $unicode: TRUE means that the input text is unicode (default = true)
+
+ String
+ $encoding: charset encoding; default is UTF-8
+
+
+
+
+
+
+
+
+ AcceptPageBreak (line 1927)
+
+
+
+
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak().
+
This method is called automatically and should not be called directly by the application. Example: The method is overriden in an inherited class in order to obtain a 3 column layout:
class PDF extends FPDF {
+ var $col=0;
+
+ function SetCol($col) {
+ //Move position to a column
+ $this->col=$col;
+ $x=10+$col*65;
+ $this->SetLeftMargin($x);
+ $this->SetX($x);
+ }
+
+ function AcceptPageBreak() {
+ if($this->col<2) {
+ //Go to next column
+ $this->SetCol($this->col+1);
+ $this->SetY(10);
+ return false;
+ }
+ else {
+ //Go back to first column and issue page break
+ $this->SetCol(0);
+ return true;
+ }
+ }
+ }
+
+ $pdf=new PDF();
+ $pdf->Open();
+ $pdf->AddPage();
+ $pdf->SetFont('Arial','',12);
+ for($i=1;$i<=300;$i++) {
+ $pdf->Cell(0,5,"Line $i",0,1);
+ }
+ $pdf->Output();
Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
+
Support UTF-8 Unicode [Nicola Asuni, 2005-01-02]. Example:
$pdf->AddFont('Comic','I');
+ // is equivalent to:
+ $pdf->AddFont('Comic','I','comici.php');
+ int
+ $fill: Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
+
+
+
+
+
+
+
+
+ AddLink (line 1821)
+
+
+
+
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document. The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header.
+
The font which was set before calling is automatically restored. There is no need to call SetFont() again if you want to continue with the same font. The same is true for colors and line width. The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.
+ string
+ $orientation: Page orientation. Possible values are (case insensitive):
P or Portrait
L or Landscape
The default value is the one passed to the constructor.
+
+
+
+
+
+
+
+
+ AliasNbPages (line 1162)
+
+
+
+
Defines an alias for the total number of pages. It will be substituted as the document is closed.
+
Example:
class PDF extends FPDF {
+ function Footer() {
+ //Go to 1.5 cm from bottom
+ $this->SetY(-15);
+ //Select Arial italic 8
+ $this->SetFont('Arial','I',8);
+ //Print current and total page numbers
+ $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+ }
+ }
+ $pdf=new PDF();
+ $pdf->AliasNbPages();
+ string
+ $alias: The alias. Default value: {nb}.
+
+
+
+
+
+
+
+
+ Cell (line 1947)
+
+
+
+
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
+ mixed
+ $border: Indicates if borders must be drawn around the cell. The value can be either a number:
0: no border (default)
1: frame
or a string containing some or all of the following characters (in any order):
L: left
T: top
R: right
B: bottom
+
+ int
+ $ln: Indicates where the current position should go after the call. Possible values are:
0: to the right
1: to the beginning of the next line
2: below
+
+ string
+ $align: Allows to center or align the text. Possible values are:
L or empty string: left align (default value)
C: center
R: right align
+
+ int
+ $fill: Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
+
+ mixed
+ $link: URL or identifier returned by AddLink().
+
+
+
+
+
+
+
+
+ Close (line 1194)
+
+
+
+
Terminates the PDF document. It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.
+ string
+ $color: hexadecimal html color [#rrggbb]
+
+
+
+
+
+
+
+
+ Error (line 1173)
+
+
+
+
This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
+
2004-06-11 :: Nicola Asuni : changed bold tag with strong
+
+
since: 1.0
+
+
+
+ void
+
+ Error
+
+ (string$msg)
+
+
+
+
+ string
+ $msg: The error message
+
+
+
+
+
+
+
+
+ Footer (line 1378)
+
+
+
+
This method is used to render the page footer.
+
It is automatically called by AddPage() and could be overwritten in your own inherited class.
+
+
+ void
+
+ Footer
+
+ ()
+
+
+
+
+
+
+
+
+
+ getBreakMargin (line 966)
+
+
+
+
Returns the page break margin.
+
+
return: page break margin.
+
since: 1.5.2
+
author: Nicola Asuni
+
+
+
+ int
+
+ getBreakMargin
+
+ ()
+
+
+
+
+
+
+
+
+
+ getImageScale (line 936)
+
+
+
+
Returns the image scale.
+
+
return: image scale.
+
since: 1.5.2
+
author: Nicola Asuni
+
+
+
+ float
+
+ getImageScale
+
+ ()
+
+
+
+
+
+
+
+
+
+ getPageHeight (line 956)
+
+
+
+
Returns the page height in units.
+
+
return: page height.
+
since: 1.5.2
+
author: Nicola Asuni
+
+
+
+ int
+
+ getPageHeight
+
+ ()
+
+
+
+
+
+
+
+
+
+ getPageWidth (line 946)
+
+
+
+
Returns the page width in units.
+
+
return: page width.
+
since: 1.5.2
+
author: Nicola Asuni
+
+
+
+ int
+
+ getPageWidth
+
+ ()
+
+
+
+
+
+
+
+
+
+ getPDFData (line 3577)
+
+
+
+
Returns the PDF data.
+
+
+ void
+
+ getPDFData
+
+ ()
+
+
+
+
+
+
+
+
+
+ getScaleFactor (line 976)
+
+
+
+
Returns the scale factor (number of points in user unit).
+
+
return: scale factor.
+
since: 1.5.2
+
author: Nicola Asuni
+
+
+
+ int
+
+ getScaleFactor
+
+ ()
+
+
+
+
+
+
+
+
+
+ GetStringWidth (line 1505)
+
+
+
+
Returns the length of a string in user unit. A font must be selected.
+
Support UTF-8 Unicode [Nicola Asuni, 2005-01-02]
+
+
since: 1.2
+
+
+
+ int
+
+ GetStringWidth
+
+ (string$s)
+
+
+
+
+ string
+ $s: The string whose length is to be computed
It is automatically called by AddPage() and could be overwritten in your own inherited class.
+
+
+ void
+
+ Header
+
+ ()
+
+
+
+
+
+
+
+
+
+ Image (line 2288)
+
+
+
+
Puts an image in the page. The upper-left corner must be given. The dimensions can be specified in different ways:
explicit width and height (expressed in user unit)
one explicit dimension, the other being calculated automatically in order to keep the original proportions
no explicit dimension, in which case the image is put at 72 dpi
Supported formats are JPEG and PNG.
+
For JPEG, all flavors are allowed:
gray scales
true colors (24 bits)
CMYK (32 bits)
For PNG, are allowed:
gray scales on at most 8 bits (256 levels)
indexed colors
true colors (24 bits)
but are not supported:
Interlacing
Alpha channel
If a transparent color is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above). The format can be specified explicitly or inferred from the file extension. It is possible to put a link on the image. Remark: if an image is used several times, only one copy will be embedded in the file.
+
+ string
+ $file: Name of the file containing the image.
+
+ float
+ $x: Abscissa of the upper-left corner.
+
+ float
+ $y: Ordinate of the upper-left corner.
+
+ float
+ $w: Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
+
+ float
+ $h: Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
+
+ string
+ $type: Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension.
+
+ mixed
+ $link: URL or identifier returned by AddLink().
Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
+ float
+ $h: The height of the break. By default, the value equals the height of the last printed cell.
+
+
+
+
+
+
+
+
+ MultiCell (line 2050)
+
+
+
+
This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other. Text can be aligned, centered or justified. The cell block can be framed and the background painted.
+ int
+ $fill: Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
+
+
+
+
+
+
+
+
+ Output (line 2440)
+
+
+
+
Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced. The method first calls Close() if necessary to terminate the document.
+ string
+ $name: The name of the file. If not given, the document will be sent to the browser (destination I) with the name doc.pdf.
+
+ string
+ $dest: Destination where to send the document. It can take one of the following values:
I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
D: send to the browser and force a file download with the name given by name.
F: save to a local file with the name given by name.
S: return the document as a string. name is ignored.
If the parameter is not specified but a name is given, destination is F. If no parameter is specified at all, destination is I. Note: for compatibility with previous versions, a boolean value is also accepted (false for F and true for D).
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
+ boolean
+ $auto: Boolean indicating if mode should be on or off.
+
+ float
+ $margin: Distance from the bottom of the page.
+
+
+
+
+
+
+
+
+ setBarcode (line 3494)
+
+
+
+
Set document barcode.
+
+
+ void
+
+ setBarcode
+
+ ([string$bc = ""])
+
+
+
+
+ string
+ $bc: barcode
+
+
+
+
+
+
+
+
+ SetCompression (line 1076)
+
+
+
+
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
+
Note: the Zlib extension is required for this feature. If not present, compression will be turned off.
Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display.
+ mixed
+ $zoom: The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
fullpage: displays the entire page on screen
fullwidth: uses maximum width of window
real: uses real size (equivalent to 100% zoom)
default: uses viewer default mode
+
+ string
+ $layout: The page layout. Possible values are:
single: displays one page at once
continuous: displays pages continuously (default)
two: displays two pages on two columns
default: uses viewer default mode
+
+
+
+
+
+
+
+
+ SetDrawColor (line 1434)
+
+
+
+
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
+ int
+ $r: If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255
+
+ int
+ $g: Green component (between 0 and 255)
+
+ int
+ $b: Blue component (between 0 and 255)
+
+
+
+
+
+
+
+
+ SetFillColor (line 1456)
+
+
+
+
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
+ int
+ $r: If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255
+
+ int
+ $g: Green component (between 0 and 255)
+
+ int
+ $b: Blue component (between 0 and 255)
+
+ boolean
+ $storeprev: if true stores the RGB array on $prevFillColor variable.
+
+
+
+
+
+
+
+
+ SetFont (line 1704)
+
+
+
+
Sets the font used to print character strings. It is mandatory to call this method at least once before printing text or the resulting document would not be valid.
+
The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe). The method can be called before the first page is created and the font is retained from page to page. Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:
They are in the current directory (the one where the running script lies)
They are in one of the directories defined by the include_path parameter
They are in the directory defined by the FPDF_FONTPATH constant
Example for the last case (note the trailing slash):
+ string
+ $family: Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
Courier (fixed-width)
Helvetica or Arial (synonymous; sans serif)
Times (serif)
Symbol (symbolic)
ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is retained.
+
+ string
+ $style: Font style. Possible values are (case insensitive):
empty string: regular
B: bold
I: italic
U: underline
or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats
+
+ float
+ $size: Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page.
Prints a character string. The origin is on the left of the first charcter, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text.
Encoding UTF-16:
+
+ Encoding of a single character from an ISO 10646 character value to
+ UTF-16 proceeds as follows. Let U be the character number, no greater
+ than 0x10FFFF.
+
+ 1) If U < 0x10000, encode U as a 16-bit unsigned integer and
+ terminate.
+
+ 2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF,
+ U' must be less than or equal to 0xFFFFF. That is, U' can be
+ represented in 20 bits.
+
+ 3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and
+ 0xDC00, respectively. These integers each have 10 bits free to
+ encode the character value, for a total of 20 bits.
+
+ 4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order
+ bits of W1 and the 10 low-order bits of U' to the 10 low-order
+ bits of W2. Terminate.
+
+ Graphically, steps 2 through 4 look like:
+ U' = yyyyyyyyyyxxxxxxxxxx
+ W1 = 110110yyyyyyyyyy
+ W2 = 110111xxxxxxxxxx
+ boolean
+ $setbom: if true set the Byte Order Mark (BOM = 0xFEFF)
+
+
+
+
+
+
+
+
+ Write (line 2180)
+
+
+
+
This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.
+
Example:
//Begin with regular font
+ $pdf->SetFont('Arial','',14);
+ $pdf->Write(5,'Visit ');
+ //Then put a blue underlined link
+ $pdf->SetTextColor(0,0,255);
+ $pdf->SetFont('','U');
+ $pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');
+ boolean
+ $ln: if true add a new line after text (default = true)
+
+ int
+ $fill: Indicates if the background must be painted (1) or transparent (0). Default value: 0.
+
+
+
+
+
+
+
+
+ writeHTMLCell (line 3665)
+
+
+
+
Prints a cell (rectangular area) with optional borders, background color and html text string. The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Code 128-A Barcode Render Class for PHP using the GD graphics library. Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
+ Code 128-A Barcode Render Class for PHP using the GD graphics library. Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
+
+
+
+
+
+
+
+
+
+
+
+ Documentation generated on Fri, 23 Jun 2006 10:11:52 +0200 by phpDocumentor 1.3.0RC3
+
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak().
Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document. The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header.
Code 128-A Barcode Render Class for PHP using the GD graphics library. Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Terminates the PDF document. It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.
This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other. Text can be aligned, centered or justified. The cell block can be framed and the background painted.
Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced. The method first calls Close() if necessary to terminate the document.
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display.
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Sets the font used to print character strings. It is mandatory to call this method at least once before printing text or the resulting document would not be valid.
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page.
Prints a character string. The origin is on the left of the first charcter, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text.
This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.
Prints a cell (rectangular area) with optional borders, background color and html text string. The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak().
Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document. The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header.
Code 128-A Barcode Render Class for PHP using the GD graphics library. Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Terminates the PDF document. It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.
This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other. Text can be aligned, centered or justified. The cell block can be framed and the background painted.
Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced. The method first calls Close() if necessary to terminate the document.
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display.
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Sets the font used to print character strings. It is mandatory to call this method at least once before printing text or the resulting document would not be valid.
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page.
Prints a character string. The origin is on the left of the first charcter, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text.
This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.
Prints a cell (rectangular area) with optional borders, background color and html text string. The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
+Warning on line 4134 - File "D:\Inetpub\wwwroot\_OPENSOURCE\tcpdf_php4\tcpdf.php" has no page-level DocBlock, use @package in the first DocBlock to create one
+
+ Documentation generated on Fri, 23 Jun 2006 10:11:57 +0200 by phpDocumentor 1.3.0RC3
+
source code documentation using phpDocumentor (www.phpdoc.org)
+ *
All ISO page formats were included
+ *
image scale factor
+ *
includes methods to parse and printsome XHTML code, supporting the following elements: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small;
+ *
includes a method to print various barcode formats using an improved version of "Generic Barcode Render Class" by Karim Mribti (http://www.mribti.com/barcode/) (require GD library: http://www.boutell.com/gd/)
+ *
defines standard Header() and Footer() methods.
+ *
+ * Tools to encode your unicode fonts can be found at: http://www.acko.net/blog/ufpdf
+ * @name TCPDF
+ * @package com.tecnick.tcpdf
+ * @abstract Class for generating PDF files on-the-fly without requiring external extensions.
+ * @author Nicola Asuni
+ * @copyright 2004-2006 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
+ * @link http://tcpdf.sourceforge.net
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ @version 1.53.0.TC021_PHP4
+ */
+
+if(!class_exists('TCPDF')) {
+ /**
+ * define default PDF document producer
+ */
+ define('PDF_PRODUCER','TCPDF 1.53.0.TC021_PHP4 (http://tcpdf.sourceforge.net)');
+
+ /**
+ * This is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.
+ * This class is an extension and improvement of the FPDF class by Olivier Plathey (http://www.fpdf.org).
+ * This version contains some changes: [porting to PHP4, support for UTF-8 Unicode, code style and formatting, php documentation (www.phpdoc.org), ISO page formats, minor improvements, image scale factor]
+ * TCPDF project (http://tcpdf.sourceforge.net) is based on the public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).
+ * To add your own TTF fonts please read /fonts/README.TXT
+ * @name TCPDF
+ * @package com.tecnick.tcpdf
+ * @version 1.53.0.TC021
+ * @author Nicola Asuni
+ * @link http://tcpdf.sourceforge.net
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ */
+ class TCPDF {
+ //var properties
+
+ /**
+ * @var current page number
+ * @access protected
+ */
+ var $page;
+
+ /**
+ * @var current object number
+ * @access protected
+ */
+ var $n;
+
+ /**
+ * @var array of object offsets
+ * @access protected
+ */
+ var $offsets;
+
+ /**
+ * @var buffer holding in-memory PDF
+ * @access protected
+ */
+ var $buffer;
+
+ /**
+ * @var array containing pages
+ * @access protected
+ */
+ var $pages;
+
+ /**
+ * @var current document state
+ * @access protected
+ */
+ var $state;
+
+ /**
+ * @var compression flag
+ * @access protected
+ */
+ var $compress;
+
+ /**
+ * @var default orientation
+ * @access protected
+ */
+ var $DefOrientation;
+
+ /**
+ * @var current orientation
+ * @access protected
+ */
+ var $CurOrientation;
+
+ /**
+ * @var array indicating orientation changes
+ * @access protected
+ */
+ var $OrientationChanges;
+
+ /**
+ * @var scale factor (number of points in user unit)
+ * @access protected
+ */
+ var $k;
+
+ /**
+ * @var width of page format in points
+ * @access protected
+ */
+ var $fwPt;
+
+ /**
+ * @var height of page format in points
+ * @access protected
+ */
+ var $fhPt;
+
+ /**
+ * @var width of page format in user unit
+ * @access protected
+ */
+ var $fw;
+
+ /**
+ * @var height of page format in user unit
+ * @access protected
+ */
+ var $fh;
+
+ /**
+ * @var current width of page in points
+ * @access protected
+ */
+ var $wPt;
+
+ /**
+ * @var current height of page in points
+ * @access protected
+ */
+ var $hPt;
+
+ /**
+ * @var current width of page in user unit
+ * @access protected
+ */
+ var $w;
+
+ /**
+ * @var current height of page in user unit
+ * @access protected
+ */
+ var $h;
+
+ /**
+ * @var left margin
+ * @access protected
+ */
+ var $lMargin;
+
+ /**
+ * @var top margin
+ * @access protected
+ */
+ var $tMargin;
+
+ /**
+ * @var right margin
+ * @access protected
+ */
+ var $rMargin;
+
+ /**
+ * @var page break margin
+ * @access protected
+ */
+ var $bMargin;
+
+ /**
+ * @var cell margin
+ * @access protected
+ */
+ var $cMargin;
+
+ /**
+ * @var current horizontal position in user unit for cell positioning
+ * @access protected
+ */
+ var $x;
+
+ /**
+ * @var current vertical position in user unit for cell positioning
+ * @access protected
+ */
+ var $y;
+
+ /**
+ * @var height of last cell printed
+ * @access protected
+ */
+ var $lasth;
+
+ /**
+ * @var line width in user unit
+ * @access protected
+ */
+ var $LineWidth;
+
+ /**
+ * @var array of standard font names
+ * @access protected
+ */
+ var $CoreFonts;
+
+ /**
+ * @var array of used fonts
+ * @access protected
+ */
+ var $fonts;
+
+ /**
+ * @var array of font files
+ * @access protected
+ */
+ var $FontFiles;
+
+ /**
+ * @var array of encoding differences
+ * @access protected
+ */
+ var $diffs;
+
+ /**
+ * @var array of used images
+ * @access protected
+ */
+ var $images;
+
+ /**
+ * @var array of links in pages
+ * @access protected
+ */
+ var $PageLinks;
+
+ /**
+ * @var array of internal links
+ * @access protected
+ */
+ var $links;
+
+ /**
+ * @var current font family
+ * @access protected
+ */
+ var $FontFamily;
+
+ /**
+ * @var current font style
+ * @access protected
+ */
+ var $FontStyle;
+
+ /**
+ * @var underlining flag
+ * @access protected
+ */
+ var $underline;
+
+ /**
+ * @var current font info
+ * @access protected
+ */
+ var $CurrentFont;
+
+ /**
+ * @var current font size in points
+ * @access protected
+ */
+ var $FontSizePt;
+
+ /**
+ * @var current font size in user unit
+ * @access protected
+ */
+ var $FontSize;
+
+ /**
+ * @var commands for drawing color
+ * @access protected
+ */
+ var $DrawColor;
+
+ /**
+ * @var commands for filling color
+ * @access protected
+ */
+ var $FillColor;
+
+ /**
+ * @var commands for text color
+ * @access protected
+ */
+ var $TextColor;
+
+ /**
+ * @var indicates whether fill and text colors are different
+ * @access protected
+ */
+ var $ColorFlag;
+
+ /**
+ * @var word spacing
+ * @access protected
+ */
+ var $ws;
+
+ /**
+ * @var automatic page breaking
+ * @access protected
+ */
+ var $AutoPageBreak;
+
+ /**
+ * @var threshold used to trigger page breaks
+ * @access protected
+ */
+ var $PageBreakTrigger;
+
+ /**
+ * @var flag set when processing footer
+ * @access protected
+ */
+ var $InFooter;
+
+ /**
+ * @var zoom display mode
+ * @access protected
+ */
+ var $ZoomMode;
+
+ /**
+ * @var layout display mode
+ * @access protected
+ */
+ var $LayoutMode;
+
+ /**
+ * @var title
+ * @access protected
+ */
+ var $title;
+
+ /**
+ * @var subject
+ * @access protected
+ */
+ var $subject;
+
+ /**
+ * @var author
+ * @access protected
+ */
+ var $author;
+
+ /**
+ * @var keywords
+ * @access protected
+ */
+ var $keywords;
+
+ /**
+ * @var creator
+ * @access protected
+ */
+ var $creator;
+
+ /**
+ * @var alias for total number of pages
+ * @access protected
+ */
+ var $AliasNbPages;
+
+ /**
+ * @var right-bottom corner X coordinate of inserted image
+ * @since 2002-07-31
+ * @author Nicola Asuni
+ * @access protected
+ */
+ var $img_rb_x;
+
+ /**
+ * @var right-bottom corner Y coordinate of inserted image
+ * @since 2002-07-31
+ * @author Nicola Asuni
+ * @access protected
+ */
+ var $img_rb_y;
+
+ /**
+ * @var image scale factor
+ * @since 2004-06-14
+ * @author Nicola Asuni
+ * @access protected
+ */
+ var $imgscale = 1;
+
+ /**
+ * @var boolean set to true when the input text is unicode (require unicode fonts)
+ * @since 2005-01-02
+ * @author Nicola Asuni
+ * @access protected
+ */
+ var $isunicode = false;
+
+ /**
+ * @var PDF version
+ * @since 1.5.3
+ * @access protected
+ */
+ var $PDFVersion = "1.3";
+
+
+ // ----------------------
+
+ /**
+ * @var Minimum distance between header and top page margin.
+ * @access private
+ */
+ var $header_margin;
+
+ /**
+ * @var Minimum distance between footer and bottom page margin.
+ * @access private
+ */
+ var $footer_margin;
+
+ /**
+ * @var original left margin value
+ * @access private
+ * @since 1.53.0.TC013
+ */
+ var $original_lMargin;
+
+ /**
+ * @var original right margin value
+ * @access private
+ * @since 1.53.0.TC013
+ */
+ var $original_rMargin;
+
+ /**
+ * @var Header font.
+ * @access private
+ */
+ var $header_font;
+
+ /**
+ * @var Footer font.
+ * @access private
+ */
+ var $footer_font;
+
+ /**
+ * @var Language templates.
+ * @access private
+ */
+ var $l;
+
+ /**
+ * @var Barcode to print on page footer (only if set).
+ * @access private
+ */
+ var $barcode = false;
+
+ /**
+ * @var If true prints header
+ * @access private
+ */
+ var $print_header = true;
+
+ /**
+ * @var If true prints footer.
+ * @access private
+ */
+ var $print_footer = true;
+
+ /**
+ * @var Header width (0 = full page width).
+ * @access private
+ */
+ var $header_width = 0;
+
+ /**
+ * @var Header image logo.
+ * @access private
+ */
+ var $header_logo = "";
+
+ /**
+ * @var Header image logo width in mm.
+ * @access private
+ */
+ var $header_logo_width = 30;
+
+ /**
+ * @var String to print as title on document header.
+ * @access private
+ */
+ var $header_title = "";
+
+ /**
+ * @var String to print on document header.
+ * @access private
+ */
+ var $header_string = "";
+
+ /**
+ * @var Default number of columns for html table.
+ * @access private
+ */
+ var $default_table_columns = 4;
+
+
+ // variables for html parser
+
+ /**
+ * @var HTML PARSER: store current link.
+ * @access private
+ */
+ var $HREF;
+
+ /**
+ * @var HTML PARSER: store font list.
+ * @access private
+ */
+ var $fontList;
+
+ /**
+ * @var HTML PARSER: true when font attribute is set.
+ * @access private
+ */
+ var $issetfont;
+
+ /**
+ * @var HTML PARSER: true when color attribute is set.
+ * @access private
+ */
+ var $issetcolor;
+
+ /**
+ * @var HTML PARSER: true in case of ordered list (OL), false otherwise.
+ * @access private
+ */
+ var $listordered = false;
+
+ /**
+ * @var HTML PARSER: count list items.
+ * @access private
+ */
+ var $listcount = 0;
+
+ /**
+ * @var HTML PARSER: size of table border.
+ * @access private
+ */
+ var $tableborder = 0;
+
+ /**
+ * @var HTML PARSER: true at the beginning of table.
+ * @access private
+ */
+ var $tdbegin = false;
+
+ /**
+ * @var HTML PARSER: table width.
+ * @access private
+ */
+ var $tdwidth = 0;
+
+ /**
+ * @var HTML PARSER: table height.
+ * @access private
+ */
+ var $tdheight = 0;
+
+ /**
+ * @var HTML PARSER: table align.
+ * @access private
+ */
+ var $tdalign = "L";
+
+ /**
+ * @var HTML PARSER: table background color.
+ * @access private
+ */
+ var $tdbgcolor = false;
+
+ /**
+ * @var Store temporary font size in points.
+ * @access private
+ */
+ var $tempfontsize = 10;
+
+ /**
+ * @var Bold font style status.
+ * @access private
+ */
+ var $b;
+
+ /**
+ * @var Underlined font style status.
+ * @access private
+ */
+ var $u;
+
+ /**
+ * @var Italic font style status.
+ * @access private
+ */
+ var $i;
+
+ /**
+ * @var spacer for LI tags.
+ * @access private
+ */
+ var $lispacer = "";
+
+ /**
+ * @var default encoding
+ * @access private
+ * @since 1.53.0.TC010
+ */
+ var $encoding = "UTF-8";
+
+ /**
+ * @var PHP internal encoding
+ * @access private
+ * @since 1.53.0.TC016
+ */
+ var $internal_encoding;
+
+ /**
+ * @var store previous fill color as RGB array
+ * @access private
+ * @since 1.53.0.TC017
+ */
+ var $prevFillColor = array(255,255,255);
+
+ /**
+ * @var store previous text color as RGB array
+ * @access private
+ * @since 1.53.0.TC017
+ */
+ var $prevTextColor = array(0,0,0);
+
+ /**
+ * @var store previous font family
+ * @access private
+ * @since 1.53.0.TC017
+ */
+ var $prevFontFamily;
+
+ /**
+ * @var store previous font style
+ * @access private
+ * @since 1.53.0.TC017
+ */
+ var $prevFontStyle;
+
+ //------------------------------------------------------------
+ // var methods
+ //------------------------------------------------------------
+
+ /**
+ * This is the class constructor.
+ * It allows to set up the page format, the orientation and
+ * the measure unit used in all the methods (except for the font sizes).
+ * @since 1.0
+ * @param string $orientation page orientation. Possible values are (case insensitive):
P or Portrait (default)
L or Landscape
+ * @param string $unit User measure unit. Possible values are:
pt: point
mm: millimeter (default)
cm: centimeter
in: inch
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
+ * @param mixed $format The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).
4A0
2A0
A0
A1
A2
A3
A4 (default)
A5
A6
A7
A8
A9
A10
B0
B1
B2
B3
B4
B5
B6
B7
B8
B9
B10
C0
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
RA0
RA1
RA2
RA3
RA4
SRA0
SRA1
SRA2
SRA3
SRA4
LETTER
LEGAL
EXECUTIVE
FOLIO
+ * @param boolean $unicode TRUE means that the input text is unicode (default = true)
+ * @param String $encoding charset encoding; default is UTF-8
+ */
+ function TCPDF($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding="UTF-8") {
+
+ /* Set internal character encoding to ASCII */
+ if (function_exists("mb_internal_encoding") AND mb_internal_encoding()) {
+ $this->internal_encoding = mb_internal_encoding();
+ mb_internal_encoding("ASCII");
+ }
+
+ //Some checks
+ $this->_dochecks();
+ //Initialization of properties
+ $this->isunicode=$unicode;
+ $this->page=0;
+ $this->n=2;
+ $this->buffer='';
+ $this->pages=array();
+ $this->OrientationChanges=array();
+ $this->state=0;
+ $this->fonts=array();
+ $this->FontFiles=array();
+ $this->diffs=array();
+ $this->images=array();
+ $this->links=array();
+ $this->InFooter=false;
+ $this->lasth=0;
+ $this->FontFamily='';
+ $this->FontStyle='';
+ $this->FontSizePt=12;
+ $this->underline=false;
+ $this->DrawColor='0 G';
+ $this->FillColor='0 g';
+ $this->TextColor='0 g';
+ $this->ColorFlag=false;
+ $this->ws=0;
+ //Standard Unicode fonts
+ $this->CoreFonts=array(
+ 'courier'=>'Courier',
+ 'courierB'=>'Courier-Bold',
+ 'courierI'=>'Courier-Oblique',
+ 'courierBI'=>'Courier-BoldOblique',
+ 'helvetica'=>'Helvetica',
+ 'helveticaB'=>'Helvetica-Bold',
+ 'helveticaI'=>'Helvetica-Oblique',
+ 'helveticaBI'=>'Helvetica-BoldOblique',
+ 'times'=>'Times-Roman',
+ 'timesB'=>'Times-Bold',
+ 'timesI'=>'Times-Italic',
+ 'timesBI'=>'Times-BoldItalic',
+ 'symbol'=>'Symbol',
+ 'zapfdingbats'=>'ZapfDingbats'
+ );
+
+ //Scale factor
+ // 2003-06-11 - Nicola Asuni : changed if/else with switch statement
+ switch (strtolower($unit)){
+ case 'pt': {$this->k=1; break;}
+ case 'mm': {$this->k=72/25.4; break;}
+ case 'cm': {$this->k=72/2.54; break;}
+ case 'in': {$this->k=72; break;}
+ default : {$this->Error('Incorrect unit: '.$unit); break;}
+ }
+
+ //Page format
+ if(is_string($format)) {
+ // 2002-07-24 - Nicola Asuni (info@tecnick.com)
+ // Added new page formats (45 standard ISO paper formats and 4 american common formats).
+ // Paper cordinates are calculated in this way: (inches * 72) where (1 inch = 2.54 cm)
+ switch (strtoupper($format)){
+ case '4A0': {$format = array(4767.87,6740.79); break;}
+ case '2A0': {$format = array(3370.39,4767.87); break;}
+ case 'A0': {$format = array(2383.94,3370.39); break;}
+ case 'A1': {$format = array(1683.78,2383.94); break;}
+ case 'A2': {$format = array(1190.55,1683.78); break;}
+ case 'A3': {$format = array(841.89,1190.55); break;}
+ case 'A4': default: {$format = array(595.28,841.89); break;}
+ case 'A5': {$format = array(419.53,595.28); break;}
+ case 'A6': {$format = array(297.64,419.53); break;}
+ case 'A7': {$format = array(209.76,297.64); break;}
+ case 'A8': {$format = array(147.40,209.76); break;}
+ case 'A9': {$format = array(104.88,147.40); break;}
+ case 'A10': {$format = array(73.70,104.88); break;}
+ case 'B0': {$format = array(2834.65,4008.19); break;}
+ case 'B1': {$format = array(2004.09,2834.65); break;}
+ case 'B2': {$format = array(1417.32,2004.09); break;}
+ case 'B3': {$format = array(1000.63,1417.32); break;}
+ case 'B4': {$format = array(708.66,1000.63); break;}
+ case 'B5': {$format = array(498.90,708.66); break;}
+ case 'B6': {$format = array(354.33,498.90); break;}
+ case 'B7': {$format = array(249.45,354.33); break;}
+ case 'B8': {$format = array(175.75,249.45); break;}
+ case 'B9': {$format = array(124.72,175.75); break;}
+ case 'B10': {$format = array(87.87,124.72); break;}
+ case 'C0': {$format = array(2599.37,3676.54); break;}
+ case 'C1': {$format = array(1836.85,2599.37); break;}
+ case 'C2': {$format = array(1298.27,1836.85); break;}
+ case 'C3': {$format = array(918.43,1298.27); break;}
+ case 'C4': {$format = array(649.13,918.43); break;}
+ case 'C5': {$format = array(459.21,649.13); break;}
+ case 'C6': {$format = array(323.15,459.21); break;}
+ case 'C7': {$format = array(229.61,323.15); break;}
+ case 'C8': {$format = array(161.57,229.61); break;}
+ case 'C9': {$format = array(113.39,161.57); break;}
+ case 'C10': {$format = array(79.37,113.39); break;}
+ case 'RA0': {$format = array(2437.80,3458.27); break;}
+ case 'RA1': {$format = array(1729.13,2437.80); break;}
+ case 'RA2': {$format = array(1218.90,1729.13); break;}
+ case 'RA3': {$format = array(864.57,1218.90); break;}
+ case 'RA4': {$format = array(609.45,864.57); break;}
+ case 'SRA0': {$format = array(2551.18,3628.35); break;}
+ case 'SRA1': {$format = array(1814.17,2551.18); break;}
+ case 'SRA2': {$format = array(1275.59,1814.17); break;}
+ case 'SRA3': {$format = array(907.09,1275.59); break;}
+ case 'SRA4': {$format = array(637.80,907.09); break;}
+ case 'LETTER': {$format = array(612.00,792.00); break;}
+ case 'LEGAL': {$format = array(612.00,1008.00); break;}
+ case 'EXECUTIVE': {$format = array(521.86,756.00); break;}
+ case 'FOLIO': {$format = array(612.00,936.00); break;}
+ // default: {$this->Error('Unknown page format: '.$format); break;}
+ // END CHANGES Nicola Asuni
+ }
+ $this->fwPt=$format[0];
+ $this->fhPt=$format[1];
+ }
+ else {
+ $this->fwPt=$format[0]*$this->k;
+ $this->fhPt=$format[1]*$this->k;
+ }
+
+ $this->fw=$this->fwPt/$this->k;
+ $this->fh=$this->fhPt/$this->k;
+
+ //Page orientation
+ $orientation=strtolower($orientation);
+ if($orientation=='p' or $orientation=='portrait') {
+ $this->DefOrientation='P';
+ $this->wPt=$this->fwPt;
+ $this->hPt=$this->fhPt;
+ }
+ elseif($orientation=='l' or $orientation=='landscape') {
+ $this->DefOrientation='L';
+ $this->wPt=$this->fhPt;
+ $this->hPt=$this->fwPt;
+ }
+ else {
+ $this->Error('Incorrect orientation: '.$orientation);
+ }
+
+ $this->CurOrientation=$this->DefOrientation;
+ $this->w=$this->wPt/$this->k;
+ $this->h=$this->hPt/$this->k;
+ //Page margins (1 cm)
+ $margin=28.35/$this->k;
+ $this->SetMargins($margin,$margin);
+ //Interior cell margin (1 mm)
+ $this->cMargin=$margin/10;
+ //Line width (0.2 mm)
+ $this->LineWidth=.567/$this->k;
+ //Automatic page break
+ $this->SetAutoPageBreak(true,2*$margin);
+ //Full width display mode
+ $this->SetDisplayMode('fullwidth');
+ //Compression
+ $this->SetCompression(true);
+ //Set default PDF version number
+ $this->PDFVersion = "1.3";
+
+ $this->encoding = $encoding;
+ $this->b = 0;
+ $this->i = 0;
+ $this->u = 0;
+ $this->HREF = '';
+ $this->fontlist = array("arial", "times", "courier", "helvetica", "symbol");
+ $this->issetfont = false;
+ $this->issetcolor = false;
+ $this->tableborder = 0;
+ $this->tdbegin = false;
+ $this->tdwidth= 0;
+ $this->tdheight = 0;
+ $this->tdalign = "L";
+ $this->tdbgcolor = false;
+
+ $this->SetFillColor(200, 200, 200, true);
+ $this->SetTextColor(0, 0, 0, true);
+ }
+
+ /**
+ * Set the image scale.
+ * @param float $scale image scale.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function setImageScale($scale) {
+ $this->imgscale=$scale;
+ }
+
+ /**
+ * Returns the image scale.
+ * @return float image scale.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function getImageScale() {
+ return $this->imgscale;
+ }
+
+ /**
+ * Returns the page width in units.
+ * @return int page width.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function getPageWidth() {
+ return $this->w;
+ }
+
+ /**
+ * Returns the page height in units.
+ * @return int page height.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function getPageHeight() {
+ return $this->fh;
+ }
+
+ /**
+ * Returns the page break margin.
+ * @return int page break margin.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function getBreakMargin() {
+ return $this->bMargin;
+ }
+
+ /**
+ * Returns the scale factor (number of points in user unit).
+ * @return int scale factor.
+ * @author Nicola Asuni
+ * @since 1.5.2
+ */
+ function getScaleFactor() {
+ return $this->k;
+ }
+
+ /**
+ * Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change them.
+ * @param float $left Left margin.
+ * @param float $top Top margin.
+ * @param float $right Right margin. Default value is the left one.
+ * @since 1.0
+ * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak()
+ */
+ function SetMargins($left, $top, $right=-1) {
+ //Set left, top and right margins
+ $this->lMargin=$left;
+ $this->tMargin=$top;
+ if($right==-1) {
+ $right=$left;
+ }
+ $this->rMargin=$right;
+ }
+
+ /**
+ * Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
+ * @param float $margin The margin.
+ * @since 1.4
+ * @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()
+ */
+ function SetLeftMargin($margin) {
+ //Set left margin
+ $this->lMargin=$margin;
+ if(($this->page>0) and ($this->x<$margin)) {
+ $this->x=$margin;
+ }
+ }
+
+ /**
+ * Defines the top margin. The method can be called before creating the first page.
+ * @param float $margin The margin.
+ * @since 1.5
+ * @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()
+ */
+ function SetTopMargin($margin) {
+ //Set top margin
+ $this->tMargin=$margin;
+ }
+
+ /**
+ * Defines the right margin. The method can be called before creating the first page.
+ * @param float $margin The margin.
+ * @since 1.5
+ * @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins()
+ */
+ function SetRightMargin($margin) {
+ //Set right margin
+ $this->rMargin=$margin;
+ }
+
+ /**
+ * Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
+ * @param boolean $auto Boolean indicating if mode should be on or off.
+ * @param float $margin Distance from the bottom of the page.
+ * @since 1.0
+ * @see Cell(), MultiCell(), AcceptPageBreak()
+ */
+ function SetAutoPageBreak($auto, $margin=0) {
+ //Set auto page break mode and triggering margin
+ $this->AutoPageBreak=$auto;
+ $this->bMargin=$margin;
+ $this->PageBreakTrigger=$this->h-$margin;
+ }
+
+ /**
+ * Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display.
+ * @param mixed $zoom The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
fullpage: displays the entire page on screen
fullwidth: uses maximum width of window
real: uses real size (equivalent to 100% zoom)
default: uses viewer default mode
+ * @param string $layout The page layout. Possible values are:
single: displays one page at once
continuous: displays pages continuously (default)
two: displays two pages on two columns
default: uses viewer default mode
+ * @since 1.2
+ */
+ function SetDisplayMode($zoom, $layout='continuous') {
+ //Set display mode in viewer
+ if($zoom=='fullpage' or $zoom=='fullwidth' or $zoom=='real' or $zoom=='default' or !is_string($zoom)) {
+ $this->ZoomMode=$zoom;
+ }
+ else {
+ $this->Error('Incorrect zoom display mode: '.$zoom);
+ }
+ if($layout=='single' or $layout=='continuous' or $layout=='two' or $layout=='default') {
+ $this->LayoutMode=$layout;
+ }
+ else {
+ $this->Error('Incorrect layout display mode: '.$layout);
+ }
+ }
+
+ /**
+ * Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
+ * Note: the Zlib extension is required for this feature. If not present, compression will be turned off.
+ * @param boolean $compress Boolean indicating if compression must be enabled.
+ * @since 1.4
+ */
+ function SetCompression($compress) {
+ //Set page compression
+ if(function_exists('gzcompress')) {
+ $this->compress=$compress;
+ }
+ else {
+ $this->compress=false;
+ }
+ }
+
+ /**
+ * Defines the title of the document.
+ * @param string $title The title.
+ * @since 1.2
+ * @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject()
+ */
+ function SetTitle($title) {
+ //Title of document
+ $this->title=$title;
+ }
+
+ /**
+ * Defines the subject of the document.
+ * @param string $subject The subject.
+ * @since 1.2
+ * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle()
+ */
+ function SetSubject($subject) {
+ //Subject of document
+ $this->subject=$subject;
+ }
+
+ /**
+ * Defines the author of the document.
+ * @param string $author The name of the author.
+ * @since 1.2
+ * @see SetCreator(), SetKeywords(), SetSubject(), SetTitle()
+ */
+ function SetAuthor($author) {
+ //Author of document
+ $this->author=$author;
+ }
+
+ /**
+ * Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
+ * @param string $keywords The list of keywords.
+ * @since 1.2
+ * @see SetAuthor(), SetCreator(), SetSubject(), SetTitle()
+ */
+ function SetKeywords($keywords) {
+ //Keywords of document
+ $this->keywords=$keywords;
+ }
+
+ /**
+ * Defines the creator of the document. This is typically the name of the application that generates the PDF.
+ * @param string $creator The name of the creator.
+ * @since 1.2
+ * @see SetAuthor(), SetKeywords(), SetSubject(), SetTitle()
+ */
+ function SetCreator($creator) {
+ //Creator of document
+ $this->creator=$creator;
+ }
+
+ /**
+ * Defines an alias for the total number of pages. It will be substituted as the document is closed.
+ * Example:
+ *
+ * class PDF extends FPDF {
+ * function Footer() {
+ * //Go to 1.5 cm from bottom
+ * $this->SetY(-15);
+ * //Select Arial italic 8
+ * $this->SetFont('Arial','I',8);
+ * //Print current and total page numbers
+ * $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+ * }
+ * }
+ * $pdf=new PDF();
+ * $pdf->AliasNbPages();
+ *
+ * @param string $alias The alias. Default value: {nb}.
+ * @since 1.4
+ * @see PageNo(), Footer()
+ */
+ function AliasNbPages($alias='{nb}') {
+ //Define an alias for total number of pages
+ $this->AliasNbPages = $this->_escapetext($alias);
+ }
+
+ /**
+ * This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
+ * 2004-06-11 :: Nicola Asuni : changed bold tag with strong
+ * @param string $msg The error message
+ * @since 1.0
+ */
+ function Error($msg) {
+ //Fatal error
+ die('FPDF error: '.$msg);
+ }
+
+ /**
+ * This method begins the generation of the PDF document. It is not necessary to call it explicitly because AddPage() does it automatically.
+ * Note: no page is created by this method
+ * @since 1.0
+ * @see AddPage(), Close()
+ */
+ function Open() {
+ //Begin document
+ $this->state=1;
+ }
+
+ /**
+ * Terminates the PDF document. It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.
+ * @since 1.0
+ * @see Open(), Output()
+ */
+ function Close() {
+ //Terminate document
+ if($this->state==3) {
+ return;
+ }
+ if($this->page==0) {
+ $this->AddPage();
+ }
+ //Page footer
+ $this->InFooter=true;
+ $this->Footer();
+ $this->InFooter=false;
+ //Close page
+ $this->_endpage();
+ //Close document
+ $this->_enddoc();
+ }
+
+ /**
+ * Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header.
+ * The font which was set before calling is automatically restored. There is no need to call SetFont() again if you want to continue with the same font. The same is true for colors and line width.
+ * The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.
+ * @param string $orientation Page orientation. Possible values are (case insensitive):
P or Portrait
L or Landscape
The default value is the one passed to the constructor.
+ * @since 1.0
+ * @see FPDF(), Header(), Footer(), SetMargins()
+ */
+ function AddPage($orientation='') {
+ //Start a new page
+ if($this->state==0) {
+ $this->Open();
+ }
+ $family=$this->FontFamily;
+ $style=$this->FontStyle.($this->underline ? 'U' : '');
+ $size=$this->FontSizePt;
+ $lw=$this->LineWidth;
+ $dc=$this->DrawColor;
+ $fc=$this->FillColor;
+ $tc=$this->TextColor;
+ $cf=$this->ColorFlag;
+ if($this->page>0) {
+ //Page footer
+ $this->InFooter=true;
+ $this->Footer();
+ $this->InFooter=false;
+ //Close page
+ $this->_endpage();
+ }
+ //Start new page
+ $this->_beginpage($orientation);
+ //Set line cap style to square
+ $this->_out('2 J');
+ //Set line width
+ $this->LineWidth=$lw;
+ $this->_out(sprintf('%.2f w',$lw*$this->k));
+ //Set font
+ if($family) {
+ $this->SetFont($family,$style,$size);
+ }
+ //Set colors
+ $this->DrawColor=$dc;
+ if($dc!='0 G') {
+ $this->_out($dc);
+ }
+ $this->FillColor=$fc;
+ if($fc!='0 g') {
+ $this->_out($fc);
+ }
+ $this->TextColor=$tc;
+ $this->ColorFlag=$cf;
+ //Page header
+ $this->Header();
+ //Restore line width
+ if($this->LineWidth!=$lw) {
+ $this->LineWidth=$lw;
+ $this->_out(sprintf('%.2f w',$lw*$this->k));
+ }
+ //Restore font
+ if($family) {
+ $this->SetFont($family,$style,$size);
+ }
+ //Restore colors
+ if($this->DrawColor!=$dc) {
+ $this->DrawColor=$dc;
+ $this->_out($dc);
+ }
+ if($this->FillColor!=$fc) {
+ $this->FillColor=$fc;
+ $this->_out($fc);
+ }
+ $this->TextColor=$tc;
+ $this->ColorFlag=$cf;
+ }
+
+
+
+ /**
+ * Set header data.
+ * @param string $ln header image logo
+ * @param string $lw header image logo width in mm
+ * @param string $ht string to print as title on document header
+ * @param string $hs string to print on document header
+ */
+ function setHeaderData($ln="", $lw=0, $ht="", $hs="") {
+ $this->header_logo = $ln;
+ $this->header_logo_width = $lw;
+ $this->header_title = $ht;
+ $this->header_string = $hs;
+ }
+
+ /**
+ * Set header margin.
+ * (minimum distance between header and top page margin)
+ * @param int $hm distance in millimeters
+ */
+ function setHeaderMargin($hm=10) {
+ $this->header_margin = $hm;
+ }
+
+ /**
+ * Set footer margin.
+ * (minimum distance between footer and bottom page margin)
+ * @param int $fm distance in millimeters
+ */
+ function setFooterMargin($fm=10) {
+ $this->footer_margin = $fm;
+ }
+
+ /**
+ * This method is used to render the page header.
+ * It is automatically called by AddPage() and could be overwritten in your own inherited class.
+ */
+ function Header() {
+ if ($this->print_header) {
+
+ if (!isset($this->original_lMargin)) {
+ $this->original_lMargin = $this->lMargin;
+ }
+ if (!isset($this->original_rMargin)) {
+ $this->original_rMargin = $this->rMargin;
+ }
+
+ //set current position
+ $this->SetXY($this->original_lMargin, $this->header_margin);
+
+ if (($this->header_logo) AND ($this->header_logo != K_BLANK_IMAGE)) {
+ $this->Image(K_PATH_IMAGES.$this->header_logo, $this->original_lMargin, $this->header_margin, $this->header_logo_width);
+ }
+ else {
+ $this->img_rb_y = $this->GetY();
+ }
+
+ $cell_height = round((K_CELL_HEIGHT_RATIO * $this->header_font[2]) / $this->k, 2);
+
+ $header_x = $this->original_lMargin + ($this->header_logo_width * 1.05); //set left margin for text data cell
+
+ // header title
+ $this->SetFont($this->header_font[0], 'B', $this->header_font[2] + 1);
+ $this->SetX($header_x);
+ $this->Cell($this->header_width, $cell_height, $this->header_title, 0, 1, 'L');
+
+ // header string
+ $this->SetFont($this->header_font[0], $this->header_font[1], $this->header_font[2]);
+ $this->SetX($header_x);
+ $this->MultiCell($this->header_width, $cell_height, $this->header_string, 0, 'L', 0);
+
+ // print an ending header line
+ if (empty($this->header_width)) {
+ //set style for cell border
+ $this->SetLineWidth(0.3);
+ $this->SetDrawColor(0, 0, 0);
+ $this->SetY(1 + max($this->img_rb_y, $this->GetY()));
+ $this->SetX($this->original_lMargin);
+ $this->Cell(0, 0, '', 'T', 0, 'C');
+ }
+
+ //restore position
+ $this->SetXY($this->original_lMargin, $this->tMargin);
+ }
+ }
+
+ /**
+ * This method is used to render the page footer.
+ * It is automatically called by AddPage() and could be overwritten in your own inherited class.
+ */
+ function Footer() {
+ if ($this->print_footer) {
+
+ if (!isset($this->original_lMargin)) {
+ $this->original_lMargin = $this->lMargin;
+ }
+ if (!isset($this->original_rMargin)) {
+ $this->original_rMargin = $this->rMargin;
+ }
+
+ //set font
+ $this->SetFont($this->footer_font[0], $this->footer_font[1] , $this->footer_font[2]);
+ //set style for cell border
+ $line_width = 0.3;
+ $this->SetLineWidth($line_width);
+ $this->SetDrawColor(0, 0, 0);
+
+ $footer_height = round((K_CELL_HEIGHT_RATIO * $this->footer_font[2]) / $this->k, 2); //footer height
+ //get footer y position
+ $footer_y = $this->h - $this->footer_margin - $footer_height;
+ //set current position
+ $this->SetXY($this->original_lMargin, $footer_y);
+
+ //print document barcode
+ if ($this->barcode) {
+ $this->Ln();
+ $barcode_width = round(($this->w - $this->original_lMargin - $this->original_rMargin)); //max width
+ $this->writeBarcode($this->original_lMargin, $footer_y + $line_width, $barcode_width, $footer_height - $line_width, "C128B", false, false, 2, $this->barcode);
+ }
+
+ $this->SetXY($this->original_lMargin, $footer_y);
+
+ //Print page number
+ $this->Cell(0, $footer_height, $this->l['w_page']." ".$this->PageNo().' / {nb}', 'T', 0, 'R');
+ }
+ }
+
+ /**
+ * Returns the current page number.
+ * @return int page number
+ * @since 1.0
+ * @see AliasNbPages()
+ */
+ function PageNo() {
+ //Get current page number
+ return $this->page;
+ }
+
+ /**
+ * Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
+ * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255
+ * @param int $g Green component (between 0 and 255)
+ * @param int $b Blue component (between 0 and 255)
+ * @since 1.3
+ * @see SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell()
+ */
+ function SetDrawColor($r, $g=-1, $b=-1) {
+ //Set color for all stroking operations
+ if(($r==0 and $g==0 and $b==0) or $g==-1) {
+ $this->DrawColor=sprintf('%.3f G',$r/255);
+ }
+ else {
+ $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255);
+ }
+ if($this->page>0) {
+ $this->_out($this->DrawColor);
+ }
+ }
+
+ /**
+ * Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
+ * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255
+ * @param int $g Green component (between 0 and 255)
+ * @param int $b Blue component (between 0 and 255)
+ * @param boolean $storeprev if true stores the RGB array on $prevFillColor variable.
+ * @since 1.3
+ * @see SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell()
+ */
+ function SetFillColor($r, $g=-1, $b=-1, $storeprev=false) {
+ //Set color for all filling operations
+ if(($r==0 and $g==0 and $b==0) or $g==-1) {
+ $this->FillColor=sprintf('%.3f g',$r/255);
+ }
+ else {
+ $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
+ }
+ $this->ColorFlag=($this->FillColor!=$this->TextColor);
+ if($this->page>0) {
+ $this->_out($this->FillColor);
+ }
+ if ($storeprev) {
+ // store color as previous value
+ $this->prevFillColor = array($r, $g, $b);
+ }
+ }
+
+ /**
+ * Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
+ * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255
+ * @param int $g Green component (between 0 and 255)
+ * @param int $b Blue component (between 0 and 255)
+ * @param boolean $storeprev if true stores the RGB array on $prevTextColor variable.
+ * @since 1.3
+ * @see SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell()
+ */
+ function SetTextColor($r, $g=-1, $b=-1, $storeprev=false) {
+ //Set color for text
+ if(($r==0 and $g==0 and $b==0) or $g==-1) {
+ $this->TextColor=sprintf('%.3f g',$r/255);
+ }
+ else {
+ $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
+ }
+ $this->ColorFlag=($this->FillColor!=$this->TextColor);
+ if ($storeprev) {
+ // store color as previous value
+ $this->prevTextColor = array($r, $g, $b);
+ }
+ }
+
+ /**
+ * Returns the length of a string in user unit. A font must be selected.
+ * Support UTF-8 Unicode [Nicola Asuni, 2005-01-02]
+ * @param string $s The string whose length is to be computed
+ * @return int
+ * @since 1.2
+ */
+ function GetStringWidth($s) {
+ //Get width of a string in the current font
+ $s = (string)$s;
+ $cw = &$this->CurrentFont['cw'];
+ $w = 0;
+ if($this->isunicode) {
+ $unicode = $this->UTF8StringToArray($s);
+ foreach($unicode as $char) {
+ if (isset($cw[$char])) {
+ $w+=$cw[$char];
+ } elseif(isset($cw[ord($char)])) {
+ $w+=$cw[ord($char)];
+ } elseif(isset($cw[chr($char)])) {
+ $w+=$cw[chr($char)];
+ } elseif(isset($this->CurrentFont['desc']['MissingWidth'])) {
+ $w += $this->CurrentFont['desc']['MissingWidth']; // set default size
+ } else {
+ $w += 500;
+ }
+ }
+ } else {
+ $l = strlen($s);
+ for($i=0; $i<$l; $i++) {
+ if (isset($cw[$s{$i}])) {
+ $w += $cw[$s{$i}];
+ } else if (isset($cw[ord($s{$i})])) {
+ $w += $cw[ord($s{$i})];
+ }
+ }
+ }
+ return ($w * $this->FontSize / 1000);
+ }
+
+ /**
+ * Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
+ * @param float $width The width.
+ * @since 1.0
+ * @see Line(), Rect(), Cell(), MultiCell()
+ */
+ function SetLineWidth($width) {
+ //Set line width
+ $this->LineWidth=$width;
+ if($this->page>0) {
+ $this->_out(sprintf('%.2f w',$width*$this->k));
+ }
+ }
+
+ /**
+ * Draws a line between two points.
+ * @param float $x1 Abscissa of first point
+ * @param float $y1 Ordinate of first point
+ * @param float $x2 Abscissa of second point
+ * @param float $y2 Ordinate of second point
+ * @since 1.0
+ * @see SetLineWidth(), SetDrawColor()
+ */
+ function Line($x1, $y1, $x2, $y2) {
+ //Draw a line
+ $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S', $x1*$this->k, ($this->h-$y1)*$this->k, $x2*$this->k, ($this->h-$y2)*$this->k));
+ }
+
+ /**
+ * Outputs a rectangle. It can be drawn (border only), filled (with no border) or both.
+ * @param float $x Abscissa of upper-left corner
+ * @param float $y Ordinate of upper-left corner
+ * @param float $w Width
+ * @param float $h Height
+ * @param string $style Style of rendering. Possible values are:
D or empty string: draw (default)
F: fill
DF or FD: draw and fill
+ * @since 1.0
+ * @see SetLineWidth(), SetDrawColor(), SetFillColor()
+ */
+ function Rect($x, $y, $w, $h, $style='') {
+ //Draw a rectangle
+ if($style=='F') {
+ $op='f';
+ }
+ elseif($style=='FD' or $style=='DF') {
+ $op='B';
+ }
+ else {
+ $op='S';
+ }
+ $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
+ }
+
+ /**
+ * Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
+ * Support UTF-8 Unicode [Nicola Asuni, 2005-01-02].
+ * Example:
+ *
+ * $pdf->AddFont('Comic','I');
+ * // is equivalent to:
+ * $pdf->AddFont('Comic','I','comici.php');
+ *
+ * @param string $family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
+ * @param string $style Font style. Possible values are (case insensitive):
empty string: regular (default)
B: bold
I: italic
BI or IB: bold italic
+ * @param string $file The font definition file. By default, the name is built from the family and style, in lower case with no space.
+ * @since 1.5
+ * @see SetFont()
+ */
+ function AddFont($family, $style='', $file='') {
+ if(empty($family)) {
+ return;
+ }
+
+ //Add a TrueType or Type1 font
+ $family = strtolower($family);
+ if((!$this->isunicode) AND ($family == 'arial')) {
+ $family = 'helvetica';
+ }
+
+ $style=strtoupper($style);
+ $style=str_replace('U','',$style);
+ if($style == 'IB') {
+ $style = 'BI';
+ }
+
+ $fontkey = $family.$style;
+ // check if the font has been already added
+ if(isset($this->fonts[$fontkey])) {
+ return;
+ }
+
+ if($file=='') {
+ $file = str_replace(' ', '', $family).strtolower($style).'.php';
+ }
+ if(!file_exists($this->_getfontpath().$file)) {
+ // try to load the basic file without styles
+ $file = str_replace(' ', '', $family).'.php';
+ }
+
+ include($this->_getfontpath().$file);
+
+ if(!isset($name) AND !isset($fpdf_charwidths)) {
+ $this->Error('Could not include font definition file');
+ }
+
+ $i = count($this->fonts)+1;
+
+ if($this->isunicode) {
+ $this->fonts[$fontkey] = array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file, 'ctg'=>$ctg);
+ $fpdf_charwidths[$fontkey] = $cw;
+ } else {
+ $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]);
+ }
+
+ if(isset($diff) AND (!empty($diff))) {
+ //Search existing encodings
+ $d=0;
+ $nb=count($this->diffs);
+ for($i=1;$i<=$nb;$i++) {
+ if($this->diffs[$i]==$diff) {
+ $d=$i;
+ break;
+ }
+ }
+ if($d==0) {
+ $d=$nb+1;
+ $this->diffs[$d]=$diff;
+ }
+ $this->fonts[$fontkey]['diff']=$d;
+ }
+ if(!empty($file)) {
+ if((strcasecmp($type,"TrueType") == 0) OR (strcasecmp($type,"TrueTypeUnicode") == 0)) {
+ $this->FontFiles[$file]=array('length1'=>$originalsize);
+ }
+ else {
+ $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2);
+ }
+ }
+ }
+
+ /**
+ * Sets the font used to print character strings. It is mandatory to call this method at least once before printing text or the resulting document would not be valid.
+ * The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe).
+ * The method can be called before the first page is created and the font is retained from page to page.
+ If you just wish to change the current font size, it is simpler to call SetFontSize().
+ * Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:
They are in the current directory (the one where the running script lies)
They are in one of the directories defined by the include_path parameter
They are in the directory defined by the FPDF_FONTPATH constant
+ * Example for the last case (note the trailing slash):
+ *
+ * If the file corresponding to the requested font is not found, the error "Could not include font metric file" is generated.
+ * @param string $family Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
Courier (fixed-width)
Helvetica or Arial (synonymous; sans serif)
Times (serif)
Symbol (symbolic)
ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is retained.
+ * @param string $style Font style. Possible values are (case insensitive):
empty string: regular
B: bold
I: italic
U: underline
or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats
+ * @param float $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12
+ * @since 1.0
+ * @see AddFont(), SetFontSize(), Cell(), MultiCell(), Write()
+ */
+ function SetFont($family, $style='', $size=0) {
+ $family = 'vera';
+ // save previous values
+ $this->prevFontFamily = $this->FontFamily;
+ $this->prevFontStyle = $this->FontStyle;
+
+ //Select a font; size given in points
+ global $fpdf_charwidths;
+
+ $family=strtolower($family);
+ if($family=='') {
+ $family=$this->FontFamily;
+ }
+ if((!$this->isunicode) AND ($family == 'arial')) {
+ $family = 'helvetica';
+ }
+ elseif(($family=="symbol") OR ($family=="zapfdingbats")) {
+ $style='';
+ }
+ $style=strtoupper($style);
+
+ if(strpos($style,'U')!==false) {
+ $this->underline=true;
+ $style=str_replace('U','',$style);
+ }
+ else {
+ $this->underline=false;
+ }
+ if($style=='IB') {
+ $style='BI';
+ }
+ if($size==0) {
+ $size=$this->FontSizePt;
+ }
+
+ // try to add font (if not already added)
+ if($this->isunicode) {
+ $this->AddFont($family, $style);
+ }
+
+ //Test if font is already selected
+ if(($this->FontFamily == $family) AND ($this->FontStyle == $style) AND ($this->FontSizePt == $size)) {
+ return;
+ }
+
+ $fontkey = $family.$style;
+ //if(!isset($this->fonts[$fontkey]) AND isset($this->fonts[$family])) {
+ // $style='';
+ //}
+
+ //Test if used for the first time
+ if(!isset($this->fonts[$fontkey])) {
+ //Check if one of the standard fonts
+ if(isset($this->CoreFonts[$fontkey])) {
+ if(!isset($fpdf_charwidths[$fontkey])) {
+ //Load metric file
+ $file = $family;
+ if(($family!='symbol') AND ($family!='zapfdingbats')) {
+ $file .= strtolower($style);
+ }
+ if(!file_exists($this->_getfontpath().$file.'.php')) {
+ // try to load the basic file without styles
+ $file = $family;
+ $fontkey = $family;
+ }
+ include($this->_getfontpath().$file.'.php');
+ if (($this->isunicode AND !isset($ctg)) OR ((!$this->isunicode) AND (!isset($fpdf_charwidths[$fontkey]))) ) {
+ $this->Error("Could not include font metric file [".$fontkey."]: ".$this->_getfontpath().$file.".php");
+ }
+ }
+ $i = count($this->fonts) + 1;
+
+ if($this->isunicode) {
+ $this->fonts[$fontkey] = array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file, 'ctg'=>$ctg);
+ $fpdf_charwidths[$fontkey] = $cw;
+ } else {
+ $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]);
+ }
+ }
+ else {
+ $this->Error('Undefined font: '.$family.' '.$style);
+ }
+ }
+ //Select it
+ $this->FontFamily = $family;
+ $this->FontStyle = $style;
+ $this->FontSizePt = $size;
+ $this->FontSize = $size / $this->k;
+ $this->CurrentFont = &$this->fonts[$fontkey];
+ if($this->page>0) {
+ $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
+ }
+ }
+
+ /**
+ * Defines the size of the current font.
+ * @param float $size The size (in points)
+ * @since 1.0
+ * @see SetFont()
+ */
+ function SetFontSize($size) {
+ //Set font size in points
+ if($this->FontSizePt==$size) {
+ return;
+ }
+ $this->FontSizePt = $size;
+ $this->FontSize = $size / $this->k;
+ if($this->page > 0) {
+ $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
+ }
+ }
+
+ /**
+ * Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
+ * The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
+ * @since 1.5
+ * @see Cell(), Write(), Image(), Link(), SetLink()
+ */
+ function AddLink() {
+ //Create a new internal link
+ $n=count($this->links)+1;
+ $this->links[$n]=array(0,0);
+ return $n;
+ }
+
+ /**
+ * Defines the page and position a link points to
+ * @param int $link The link identifier returned by AddLink()
+ * @param float $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page)
+ * @param int $page Number of target page; -1 indicates the current page. This is the default value
+ * @since 1.5
+ * @see AddLink()
+ */
+ function SetLink($link, $y=0, $page=-1) {
+ //Set destination of internal link
+ if($y==-1) {
+ $y=$this->y;
+ }
+ if($page==-1) {
+ $page=$this->page;
+ }
+ $this->links[$link]=array($page,$y);
+ }
+
+ /**
+ * Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
+ * @param float $x Abscissa of the upper-left corner of the rectangle
+ * @param float $y Ordinate of the upper-left corner of the rectangle
+ * @param float $w Width of the rectangle
+ * @param float $h Height of the rectangle
+ * @param mixed $link URL or identifier returned by AddLink()
+ * @since 1.5
+ * @see AddLink(), Cell(), Write(), Image()
+ */
+ function Link($x, $y, $w, $h, $link) {
+ //Put a link on the page
+ $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h*$this->k, $link);
+ }
+
+ /**
+ * Prints a character string. The origin is on the left of the first charcter, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text.
+ * @param float $x Abscissa of the origin
+ * @param float $y Ordinate of the origin
+ * @param string $txt String to print
+ * @since 1.0
+ * @see SetFont(), SetTextColor(), Cell(), MultiCell(), Write()
+ */
+ function Text($x, $y, $txt) {
+ //Output a string
+ $s=sprintf('BT %.2f %.2f Td (%s) Tj ET', $x * $this->k, ($this->h-$y) * $this->k, $this->_escapetext($txt));
+ if($this->underline AND ($txt!='')) {
+ $s .= ' '.$this->_dounderline($x,$y,$txt);
+ }
+ if($this->ColorFlag) {
+ $s='q '.$this->TextColor.' '.$s.' Q';
+ }
+ $this->_out($s);
+ }
+
+ /**
+ * Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak().
+ * This method is called automatically and should not be called directly by the application.
+ * Example:
+ * The method is overriden in an inherited class in order to obtain a 3 column layout:
+ *
+ * class PDF extends FPDF {
+ * var $col=0;
+ *
+ * function SetCol($col) {
+ * //Move position to a column
+ * $this->col=$col;
+ * $x=10+$col*65;
+ * $this->SetLeftMargin($x);
+ * $this->SetX($x);
+ * }
+ *
+ * function AcceptPageBreak() {
+ * if($this->col<2) {
+ * //Go to next column
+ * $this->SetCol($this->col+1);
+ * $this->SetY(10);
+ * return false;
+ * }
+ * else {
+ * //Go back to first column and issue page break
+ * $this->SetCol(0);
+ * return true;
+ * }
+ * }
+ * }
+ *
+ * $pdf=new PDF();
+ * $pdf->Open();
+ * $pdf->AddPage();
+ * $pdf->SetFont('Arial','',12);
+ * for($i=1;$i<=300;$i++) {
+ * $pdf->Cell(0,5,"Line $i",0,1);
+ * }
+ * $pdf->Output();
+ *
+ * @return boolean
+ * @since 1.4
+ * @see SetAutoPageBreak()
+ */
+ function AcceptPageBreak() {
+ //Accept automatic page break or not
+ return $this->AutoPageBreak;
+ }
+
+ /**
+ * Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
+ * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
+ * @param float $w Cell width. If 0, the cell extends up to the right margin.
+ * @param float $h Cell height. Default value: 0.
+ * @param string $txt String to print. Default value: empty string.
+ * @param mixed $border Indicates if borders must be drawn around the cell. The value can be either a number:
0: no border (default)
1: frame
or a string containing some or all of the following characters (in any order):
L: left
T: top
R: right
B: bottom
+ * @param int $ln Indicates where the current position should go after the call. Possible values are:
0: to the right
1: to the beginning of the next line
2: below
+ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
+ * @param string $align Allows to center or align the text. Possible values are:
L or empty string: left align (default value)
C: center
R: right align
+ * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
+ * @param mixed $link URL or identifier returned by AddLink().
+ * @since 1.0
+ * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak()
+ */
+ function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='') {
+ //Output a cell
+ $k=$this->k;
+ if(($this->y + $h) > $this->PageBreakTrigger AND empty($this->InFooter) AND $this->AcceptPageBreak()) {
+ //Automatic page break
+ $x = $this->x;
+ $ws = $this->ws;
+ if($ws > 0) {
+ $this->ws = 0;
+ $this->_out('0 Tw');
+ }
+ $this->AddPage($this->CurOrientation);
+ $this->x = $x;
+ if($ws > 0) {
+ $this->ws = $ws;
+ $this->_out(sprintf('%.3f Tw',$ws * $k));
+ }
+ }
+ if($w == 0) {
+ $w = $this->w - $this->rMargin - $this->x;
+ }
+ $s = '';
+ if(($fill == 1) OR ($border == 1)) {
+ if($fill == 1) {
+ $op = ($border == 1) ? 'B' : 'f';
+ }
+ else {
+ $op = 'S';
+ }
+ $s = sprintf('%.2f %.2f %.2f %.2f re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
+ }
+ if(is_string($border)) {
+ $x=$this->x;
+ $y=$this->y;
+ if(strpos($border,'L')!==false) {
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
+ }
+ if(strpos($border,'T')!==false) {
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
+ }
+ if(strpos($border,'R')!==false) {
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+ }
+ if(strpos($border,'B')!==false) {
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+ }
+ }
+ if($txt != '') {
+ $width = $this->GetStringWidth($txt);
+ if($align == 'R') {
+ $dx = $w - $this->cMargin - $width;
+ }
+ elseif($align=='C') {
+ $dx = ($w - $width)/2;
+ }
+ else {
+ $dx = $this->cMargin;
+ }
+ if($this->ColorFlag) {
+ $s .= 'q '.$this->TextColor.' ';
+ }
+ $txt2 = $this->_escapetext($txt);
+ $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + 0.5 * $h + 0.3 * $this->FontSize)) * $k, $txt2);
+ if($this->underline) {
+ $s.=' '.$this->_dounderline($this->x + $dx, $this->y + 0.5 * $h + 0.3 * $this->FontSize, $txt);
+ }
+ if($this->ColorFlag) {
+ $s.=' Q';
+ }
+ if($link) {
+ $this->Link($this->x + $dx, $this->y + 0.5 * $h - 0.5 * $this->FontSize, $width, $this->FontSize, $link);
+ }
+ }
+ if($s) {
+ $this->_out($s);
+ }
+ $this->lasth = $h;
+ if($ln>0) {
+ //Go to next line
+ $this->y += $h;
+ if($ln == 1) {
+ $this->x = $this->lMargin;
+ }
+ }
+ else {
+ $this->x += $w;
+ }
+ }
+
+ /**
+ * This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.
+ * Text can be aligned, centered or justified. The cell block can be framed and the background painted.
+ * @param float $w Width of cells. If 0, they extend up to the right margin of the page.
+ * @param float $h Height of cells.
+ * @param string $txt String to print
+ * @param mixed $border Indicates if borders must be drawn around the cell block. The value can be either a number:
0: no border (default)
1: frame
or a string containing some or all of the following characters (in any order):
L: left
T: top
R: right
B: bottom
+ * @param int $ln Indicates where the current position should go after the call. Possible values are:
0: to the right
1: to the beginning of the next line
2: below
+ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
+ * @param string $align Allows to center or align the text. Possible values are:
L or empty string: left align
C: center
R: right align
J: justification (default value)
+ * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
+ * @since 1.3
+ * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak()
+ */
+ function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0) {
+ //Output text with automatic or explicit line breaks
+ $cw = &$this->CurrentFont['cw'];
+
+ if($w == 0) {
+ $w = $this->w - $this->rMargin - $this->x;
+ }
+
+ $wmax = ($w - 2 * $this->cMargin);
+
+ $s = str_replace("\r", '', $txt); // remove carriage returns
+ $nb = strlen($s);
+
+ $b=0;
+ if($border) {
+ if($border==1) {
+ $border='LTRB';
+ $b='LRT';
+ $b2='LR';
+ }
+ else {
+ $b2='';
+ if(strpos($border,'L')!==false) {
+ $b2.='L';
+ }
+ if(strpos($border,'R')!==false) {
+ $b2.='R';
+ }
+ $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2;
+ }
+ }
+ $sep=-1;
+ $i=0;
+ $j=0;
+ $l=0;
+ $ns=0;
+ $nl=1;
+ while($i<$nb) {
+ //Get next character
+ $c = $s{$i};
+ if(preg_match("/[\n]/u", $c)) {
+ //Explicit line break
+ if($this->ws > 0) {
+ $this->ws = 0;
+ $this->_out('0 Tw');
+ }
+ $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
+ $i++;
+ $sep=-1;
+ $j=$i;
+ $l=0;
+ $ns=0;
+ $nl++;
+ if($border and $nl==2) {
+ $b = $b2;
+ }
+ continue;
+ }
+ if(preg_match("/[ ]/u", $c)) {
+ $sep = $i;
+ $ls = $l;
+ $ns++;
+ }
+
+ $l = $this->GetStringWidth(substr($s, $j, $i-$j));
+
+ if($l > $wmax) {
+ //Automatic line break
+ if($sep == -1) {
+ if($i == $j) {
+ $i++;
+ }
+ if($this->ws > 0) {
+ $this->ws = 0;
+ $this->_out('0 Tw');
+ }
+ $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
+ }
+ else {
+ if($align=='J') {
+ $this->ws = ($ns>1) ? ($wmax-$ls)/($ns-1) : 0;
+ $this->_out(sprintf('%.3f Tw', $this->ws * $this->k));
+ }
+ $this->Cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
+ $i = $sep + 1;
+ }
+ $sep=-1;
+ $j=$i;
+ $l=0;
+ $ns=0;
+ $nl++;
+ if($border AND ($nl==2)) {
+ $b=$b2;
+ }
+ }
+ else {
+ $i++;
+ }
+ }
+ //Last chunk
+ if($this->ws>0) {
+ $this->ws=0;
+ $this->_out('0 Tw');
+ }
+ if($border and is_int(strpos($border,'B'))) {
+ $b.='B';
+ }
+ $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
+ $this->x=$this->lMargin;
+ }
+
+ /**
+ * This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.
+ * Example:
+ *
+ * //Begin with regular font
+ * $pdf->SetFont('Arial','',14);
+ * $pdf->Write(5,'Visit ');
+ * //Then put a blue underlined link
+ * $pdf->SetTextColor(0,0,255);
+ * $pdf->SetFont('','U');
+ * $pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');
+ *
explicit width and height (expressed in user unit)
one explicit dimension, the other being calculated automatically in order to keep the original proportions
no explicit dimension, in which case the image is put at 72 dpi
+ * Supported formats are JPEG and PNG.
+ * For JPEG, all flavors are allowed:
gray scales
true colors (24 bits)
CMYK (32 bits)
+ * For PNG, are allowed:
gray scales on at most 8 bits (256 levels)
indexed colors
true colors (24 bits)
+ * but are not supported:
Interlacing
Alpha channel
+ * If a transparent color is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above).
+ * The format can be specified explicitly or inferred from the file extension.
+ * It is possible to put a link on the image.
+ * Remark: if an image is used several times, only one copy will be embedded in the file.
+ * @param string $file Name of the file containing the image.
+ * @param float $x Abscissa of the upper-left corner.
+ * @param float $y Ordinate of the upper-left corner.
+ * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
+ * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
+ * @param string $type Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension.
+ * @param mixed $link URL or identifier returned by AddLink().
+ * @since 1.1
+ * @see AddLink()
+ */
+ function Image($file, $x, $y, $w=0, $h=0, $type='', $link='') {
+ //Put an image on the page
+ if(!isset($this->images[$file])) {
+ //First use of image, get info
+ if($type == '') {
+ $pos = strrpos($file,'.');
+ if(empty($pos)) {
+ $this->Error('Image file has no extension and no type was specified: '.$file);
+ }
+ $type = substr($file, $pos+1);
+ }
+ $type = strtolower($type);
+ $mqr = get_magic_quotes_runtime();
+ set_magic_quotes_runtime(0);
+ if($type == 'jpg' or $type == 'jpeg') {
+ $info=$this->_parsejpg($file);
+ }
+ elseif($type == 'png') {
+ $info=$this->_parsepng($file);
+ }
+ else {
+ //Allow for additional formats
+ $mtd='_parse'.$type;
+ if(!method_exists($this,$mtd)) {
+ $this->Error('Unsupported image type: '.$type);
+ }
+ $info=$this->$mtd($file);
+ }
+ set_magic_quotes_runtime($mqr);
+ $info['i']=count($this->images)+1;
+ $this->images[$file]=$info;
+ }
+ else {
+ $info=$this->images[$file];
+ }
+ //Automatic width and height calculation if needed
+ if(($w == 0) and ($h == 0)) {
+ //Put image at 72 dpi
+ // 2004-06-14 :: Nicola Asuni, scale factor where added
+ $w = $info['w'] / ($this->imgscale * $this->k);
+ $h = $info['h'] / ($this->imgscale * $this->k);
+ }
+ if($w == 0) {
+ $w = $h * $info['w'] / $info['h'];
+ }
+ if($h == 0) {
+ $h = $w * $info['h'] / $info['w'];
+ }
+ $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q', $w*$this->k, $h*$this->k, $x*$this->k, ($this->h-($y+$h))*$this->k, $info['i']));
+ if($link) {
+ $this->Link($x, $y, $w, $h, $link);
+ }
+
+ //2002-07-31 - Nicola Asuni
+ // set right-bottom corner coordinates
+ $this->img_rb_x = $x + $w;
+ $this->img_rb_y = $y + $h;
+ }
+
+ /**
+ * Performs a line break. The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.
+ * @param float $h The height of the break. By default, the value equals the height of the last printed cell.
+ * @since 1.0
+ * @see Cell()
+ */
+ function Ln($h='') {
+ //Line feed; default value is last cell height
+ $this->x=$this->lMargin;
+ if(is_string($h)) {
+ $this->y+=$this->lasth;
+ }
+ else {
+ $this->y+=$h;
+ }
+ }
+
+ /**
+ * Returns the abscissa of the current position.
+ * @return float
+ * @since 1.2
+ * @see SetX(), GetY(), SetY()
+ */
+ function GetX() {
+ //Get x position
+ return $this->x;
+ }
+
+ /**
+ * Defines the abscissa of the current position. If the passed value is negative, it is relative to the right of the page.
+ * @param float $x The value of the abscissa.
+ * @since 1.2
+ * @see GetX(), GetY(), SetY(), SetXY()
+ */
+ function SetX($x) {
+ //Set x position
+ if($x>=0) {
+ $this->x=$x;
+ }
+ else {
+ $this->x=$this->w+$x;
+ }
+ }
+
+ /**
+ * Returns the ordinate of the current position.
+ * @return float
+ * @since 1.0
+ * @see SetY(), GetX(), SetX()
+ */
+ function GetY() {
+ //Get y position
+ return $this->y;
+ }
+
+ /**
+ * Moves the current abscissa back to the left margin and sets the ordinate. If the passed value is negative, it is relative to the bottom of the page.
+ * @param float $y The value of the ordinate.
+ * @since 1.0
+ * @see GetX(), GetY(), SetY(), SetXY()
+ */
+ function SetY($y) {
+ //Set y position and reset x
+ $this->x=$this->lMargin;
+ if($y>=0) {
+ $this->y=$y;
+ }
+ else {
+ $this->y=$this->h+$y;
+ }
+ }
+
+ /**
+ * Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page.
+ * @param float $x The value of the abscissa
+ * @param float $y The value of the ordinate
+ * @since 1.2
+ * @see SetX(), SetY()
+ */
+ function SetXY($x, $y) {
+ //Set x and y positions
+ $this->SetY($y);
+ $this->SetX($x);
+ }
+
+ /**
+ * Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
+ * The method first calls Close() if necessary to terminate the document.
+ * @param string $name The name of the file. If not given, the document will be sent to the browser (destination I) with the name doc.pdf.
+ * @param string $dest Destination where to send the document. It can take one of the following values:
I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
D: send to the browser and force a file download with the name given by name.
F: save to a local file with the name given by name.
S: return the document as a string. name is ignored.
+ * @param string $str string to process.
+ * @return array containing codepoints (UTF-8 characters values)
+ * @access protected
+ * @author Nicola Asuni
+ * @since 1.53.0.TC005 (2005-01-05)
+ */
+ function UTF8StringToArray($str) {
+ if(!$this->isunicode) {
+ return $str; // string is not in unicode
+ }
+ $unicode = array(); // array containing unicode values
+ $bytes = array(); // array containing single character byte sequences
+ $numbytes = 1; // number of octetc needed to represent the UTF-8 character
+
+ $str .= ""; // force $str to be a string
+ $length = strlen($str);
+
+ for($i = 0; $i < $length; $i++) {
+ $char = ord($str{$i}); // get one string character at time
+ if(count($bytes) == 0) { // get starting octect
+ if ($char <= 0x7F) {
+ $unicode[] = $char; // use the character "as is" because is ASCII
+ } elseif (($char >> 0x05) == 0x06) { // 2 bytes character (0x06 = 110 BIN)
+ $bytes[] = ($char - 0xC0) << 0x06;
+ $numbytes = 2;
+ } elseif (($char >> 0x04) == 0x0E) { // 3 bytes character (0x0E = 1110 BIN)
+ $bytes[] = ($char - 0xE0) << 0x0C;
+ $numbytes = 3;
+ } elseif (($char >> 0x03) == 0x1E) { // 4 bytes character (0x1E = 11110 BIN)
+ $bytes[] = ($char - 0xF0) << 0x12;
+ $numbytes = 4;
+ } else {
+ // use replacement character for other invalid sequences
+ $unicode[] = 0xFFFD;
+ $bytes = array();
+ $numbytes = 1;
+ }
+ } elseif (($char >> 0x06) == 0x02) { // bytes 2, 3 and 4 must start with 0x02 = 10 BIN
+ $bytes[] = $char - 0x80;
+ if (count($bytes) == $numbytes) {
+ // compose UTF-8 bytes to a single unicode value
+ $char = $bytes[0];
+ for($j = 1; $j < $numbytes; $j++) {
+ $char += ($bytes[$j] << (($numbytes - $j - 1) * 0x06));
+ }
+ if ((($char >= 0xD800) AND ($char <= 0xDFFF)) OR ($char >= 0x10FFFF)) {
+ /* The definition of UTF-8 prohibits encoding character numbers between
+ U+D800 and U+DFFF, which are reserved for use with the UTF-16
+ encoding form (as surrogate pairs) and do not directly represent
+ characters. */
+ $unicode[] = 0xFFFD; // use replacement character
+ }
+ else {
+ $unicode[] = $char; // add char to array
+ }
+ // reset data for next char
+ $bytes = array();
+ $numbytes = 1;
+ }
+ } else {
+ // use replacement character for other invalid sequences
+ $unicode[] = 0xFFFD;
+ $bytes = array();
+ $numbytes = 1;
+ }
+ }
+ return $unicode;
+ }
+
+ /**
+ * Converts UTF-8 strings to UTF16-BE.
+ * Based on: http://www.faqs.org/rfcs/rfc2781.html
+ *
+ * Encoding UTF-16:
+ *
+ * Encoding of a single character from an ISO 10646 character value to
+ * UTF-16 proceeds as follows. Let U be the character number, no greater
+ * than 0x10FFFF.
+ *
+ * 1) If U < 0x10000, encode U as a 16-bit unsigned integer and
+ * terminate.
+ *
+ * 2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF,
+ * U' must be less than or equal to 0xFFFFF. That is, U' can be
+ * represented in 20 bits.
+ *
+ * 3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and
+ * 0xDC00, respectively. These integers each have 10 bits free to
+ * encode the character value, for a total of 20 bits.
+ *
+ * 4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order
+ * bits of W1 and the 10 low-order bits of U' to the 10 low-order
+ * bits of W2. Terminate.
+ *
+ * Graphically, steps 2 through 4 look like:
+ * U' = yyyyyyyyyyxxxxxxxxxx
+ * W1 = 110110yyyyyyyyyy
+ * W2 = 110111xxxxxxxxxx
+ *
+ * @param string $str string to process.
+ * @param boolean $setbom if true set the Byte Order Mark (BOM = 0xFEFF)
+ * @return string
+ * @access protected
+ * @author Nicola Asuni
+ * @since 1.53.0.TC005 (2005-01-05)
+ * @uses UTF8StringToArray
+ */
+ function UTF8ToUTF16BE($str, $setbom=true) {
+ if(!$this->isunicode) {
+ return $str; // string is not in unicode
+ }
+ $outstr = ""; // string to be returned
+ $unicode = $this->UTF8StringToArray($str); // array containing UTF-8 unicode values
+ $numitems = count($unicode);
+
+ if ($setbom) {
+ $outstr .= "\xFE\xFF"; // Byte Order Mark (BOM)
+ }
+ foreach($unicode as $char) {
+ if($char == 0xFFFD) {
+ $outstr .= "\xFF\xFD"; // replacement character
+ } elseif ($char < 0x10000) {
+ $outstr .= chr($char >> 0x08);
+ $outstr .= chr($char & 0xFF);
+ } else {
+ $char -= 0x10000;
+ $w1 = 0xD800 | ($char >> 0x10);
+ $w2 = 0xDC00 | ($char & 0x3FF);
+ $outstr .= chr($w1 >> 0x08);
+ $outstr .= chr($w1 & 0xFF);
+ $outstr .= chr($w2 >> 0x08);
+ $outstr .= chr($w2 & 0xFF);
+ }
+ }
+ return $outstr;
+ }
+
+ // ====================================================
+
+ /**
+ * Set header font.
+ * @param array $font font
+ * @since 1.1
+ */
+ function setHeaderFont($font) {
+ $this->header_font = $font;
+ }
+
+ /**
+ * Set footer font.
+ * @param array $font font
+ * @since 1.1
+ */
+ function setFooterFont($font) {
+ $this->footer_font = $font;
+ }
+
+ /**
+ * Set language array.
+ * @param array $language
+ * @since 1.1
+ */
+ function setLanguageArray($language) {
+ $this->l = $language;
+ }
+
+ /**
+ * Set document barcode.
+ * @param string $bc barcode
+ */
+ function setBarcode($bc="") {
+ $this->barcode = $bc;
+ }
+
+ /**
+ * Print Barcode.
+ * @param int $x x position in user units
+ * @param int $y y position in user units
+ * @param int $w width in user units
+ * @param int $h height position in user units
+ * @param string $type type of barcode (I25, C128A, C128B, C128C, C39)
+ * @param string $style barcode style
+ * @param string $font font for text
+ * @param int $xres x resolution
+ * @param string $code code to print
+ */
+ function writeBarcode($x, $y, $w, $h, $type, $style, $font, $xres, $code) {
+ require_once("barcode/barcode.php");
+ require_once("barcode/i25object.php");
+ require_once("barcode/c39object.php");
+ require_once("barcode/c128aobject.php");
+ require_once("barcode/c128bobject.php");
+ require_once("barcode/c128cobject.php");
+
+ if (empty($code)) {
+ return;
+ }
+
+ if (empty($style)) {
+ $style = BCS_ALIGN_LEFT;
+ $style |= BCS_IMAGE_PNG;
+ $style |= BCS_TRANSPARENT;
+ //$style |= BCS_BORDER;
+ //$style |= BCS_DRAW_TEXT;
+ //$style |= BCS_STRETCH_TEXT;
+ //$style |= BCS_REVERSE_COLOR;
+ }
+ if (empty($font)) {$font = BCD_DEFAULT_FONT;}
+ if (empty($xres)) {$xres = BCD_DEFAULT_XRES;}
+
+ $scale_factor = 1.5 * $xres * $this->k;
+ $bc_w = round($w * $scale_factor); //width in points
+ $bc_h = round($h * $scale_factor); //height in points
+
+ switch (strtoupper($type)) {
+ case "I25": {
+ $obj = new I25Object($bc_w, $bc_h, $style, $code);
+ break;
+ }
+ case "C128A": {
+ $obj = new C128AObject($bc_w, $bc_h, $style, $code);
+ break;
+ }
+ default:
+ case "C128B": {
+ $obj = new C128BObject($bc_w, $bc_h, $style, $code);
+ break;
+ }
+ case "C128C": {
+ $obj = new C128CObject($bc_w, $bc_h, $style, $code);
+ break;
+ }
+ case "C39": {
+ $obj = new C39Object($bc_w, $bc_h, $style, $code);
+ break;
+ }
+ }
+
+ $obj->SetFont($font);
+ $obj->DrawObject($xres);
+
+ //use a temporary file....
+ $tmpName = tempnam(K_PATH_CACHE,'img');
+ imagepng($obj->getImage(), $tmpName);
+ $this->Image($tmpName, $x, $y, $w, $h, 'png');
+ $obj->DestroyObject();
+ unset($obj);
+ unlink($tmpName);
+ }
+
+ /**
+ * Returns the PDF data.
+ */
+ function getPDFData() {
+ if($this->state < 3) {
+ $this->Close();
+ }
+ return $this->buffer;
+ }
+
+ // --- HTML PARSER FUNCTIONS ---
+
+ /**
+ * Allows to preserve some HTML formatting.
+ * Supports: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small
+ * @param string $html text to display
+ * @param boolean $ln if true add a new line after text (default = true)
+ * @param int $fill Indicates if the background must be painted (1) or transparent (0). Default value: 0.
+ */
+ function writeHTML($html, $ln=true, $fill=0) {
+
+ // store some variables
+ $html=strip_tags($html,"
image: ";
+
+require_once('config/lang/eng.php');
+require_once('tcpdf.php');
+
+//create new PDF document (document units are set by default to millimeters)
+$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
+
+// set document information
+$pdf->SetCreator(PDF_CREATOR);
+$pdf->SetAuthor(PDF_AUTHOR);
+$pdf->SetTitle($doc_title);
+$pdf->SetSubject($doc_subject);
+$pdf->SetKeywords($doc_keywords);
+
+$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
+
+//set margins
+$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+//set auto page breaks
+$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor
+
+$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+$pdf->setLanguageArray($l); //set language items
+
+//initialize document
+$pdf->AliasNbPages();
+
+$pdf->AddPage();
+
+// set barcode
+$pdf->SetBarcode(date("Y-m-d H:i:s", time()));
+
+// output some HTML code
+$pdf->WriteHTML($htmlcontent, true, 0);
+
+// output some content
+$pdf->SetFont("vera", "BI", 20);
+$pdf->Cell(0,10,"TEST Bold-Italic Cell",1,1,'C');
+
+// output some UTF-8 test content
+$pdf->AddPage();
+$pdf->SetFont("FreeSerif", "", 12);
+$utf8text = file_get_contents("utf8test.txt", false); // get utf-8 text form file
+$pdf->SetFillColor(230, 240, 255, true);
+$pdf->Write(5,$utf8text, '', 1);
+
+
+//Close and output PDF document
+$pdf->Output();
+
+//============================================================+
+// END OF FILE
+//============================================================+
+?>
\ No newline at end of file
diff --git a/htdocs/includes/fpdf/tcpdf/utf8test.txt b/htdocs/includes/fpdf/tcpdf/utf8test.txt
new file mode 100644
index 00000000000..5db94434385
--- /dev/null
+++ b/htdocs/includes/fpdf/tcpdf/utf8test.txt
@@ -0,0 +1,126 @@
+Sentences that contain all letters commonly used in a language
+--------------------------------------------------------------
+
+Markus Kuhn -- 2001-09-02
+
+This file is UTF-8 encoded.
+
+
+Danish (da)
+---------
+
+ Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen
+ Wolther spillede på xylofon.
+ (= Quiz contestants were eating strawbery with cream while Wolther
+ the circus clown played on xylophone.)
+
+German (de)
+-----------
+
+ Falsches Üben von Xylophonmusik quält jeden größeren Zwerg
+ (= Wrongful practicing of xylophone music tortures every larger dwarf)
+
+ Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich
+ (= Twelve boxing fighters hunted Eva across the dike of Sylt)
+
+ Heizölrückstoßabdämpfung
+ (= fuel oil recoil absorber)
+ (jqvwxy missing, but all non-ASCII letters in one word)
+
+English (en)
+------------
+
+ The quick brown fox jumps over the lazy dog
+
+Spanish (es)
+------------
+
+ El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y
+ frío, añoraba a su querido cachorro.
+ (Contains every letter and every accent, but not every combination
+ of vowel + acute.)
+
+French (fr)
+-----------
+
+ Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à
+ côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce
+ qui lui permet de penser à la cænogenèse de l'être dont il est question
+ dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui,
+ pense-t-il, diminue çà et là la qualité de son œuvre.
+
+ l'île exiguë
+ Où l'obèse jury mûr
+ Fête l'haï volapük,
+ Âne ex aéquo au whist,
+ Ôtez ce vœu déçu.
+
+ Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en
+ canoë au delà des îles, près du mälström où brûlent les novæ.
+
+Irish Gaelic (ga)
+-----------------
+
+ D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh
+
+Hungarian (hu)
+--------------
+
+ Árvíztűrő tükörfúrógép
+ (= flood-proof mirror-drilling machine, only all non-ASCII letters)
+
+Icelandic (is)
+--------------
+
+ Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa
+
+ Sævör grét áðan því úlpan var ónýt
+ (some ASCII letters missing)
+
+Japanese (jp)
+-------------
+
+ Hiragana: (Iroha)
+
+ いろはにほへとちりぬるを
+ わかよたれそつねならむ
+ うゐのおくやまけふこえて
+ あさきゆめみしゑひもせす
+
+ Katakana:
+
+ イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム
+ ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン
+
+Hebrew (iw)
+-----------
+
+ ? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה
+
+Polish (pl)
+-----------
+
+ Pchnąć w tę łódź jeża lub ośm skrzyń fig
+ (= To push a hedgehog or eight bins of figs in this boat)
+
+Russian (ru)
+------------
+
+ В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
+ (= Would a citrus live in the bushes of south? Yes, but only a fake one!)
+
+Thai (th)
+---------
+
+ [--------------------------|------------------------]
+ ๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน
+ จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร
+ ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย
+ ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ
+
+ [The copyright for the Thai example is owned by The Computer
+ Association of Thailand under the Royal Patronage of His Majesty the
+ King.]
+
+Please let me know if you find others! Special thanks to the people
+from all over the world who contributed these sentences.