4 The original version of this class was published in an article by Heinz Kabutz.
5 Read http://www.javaspecialists.co.za/archive/newsletter.do?issue=033&print=yes&locale=en_US
6 "This material from The Java(tm) Specialists' Newsletter by Maximum Solutions
7 (South Africa). Please contact Maximum Solutions for more information.
12 The original version of this class was published in a JavaWorld article by Steven Brandt:
13 http://www.javaworld.com/javaworld/javatips/jw-javatip128.html
14 Jennifer Orr (JavaWorld) wrote: "You have permission to use the code appearing in
15 Steven Brandt's JavaWorld article, 'Java Tip 128: Create a quick-and-dirty XML parser.'
16 We ask that you reference the author as the creator and JavaWorld as the original publisher
17 of the code." Steven Brandt also agreed with the use of this class.
21 The following files contain material that was copyrighted by SUN:
23 com/itextpdf/text/pdf/LZWDecoder.java (first appearance in iText: 2002-02-08)
24 com/itextpdf/text/pdf/codec/BmpImage.java (first appearance in iText: 2003-06-20)
25 com/itextpdf/text/pdf/codec/PngImage.java (first appearance in iText: 2003-04-25)
26 com/itextpdf/text/pdf/codec/TIFFDirectory.java (first appearance in iText: 2003-04-09)
27 com/itextpdf/text/pdf/codec/TIFFFaxDecoder.java (first appearance in iText: 2003-04-09)
28 com/itextpdf/text/pdf/codec/TIFFField.java (first appearance in iText: 2003-04-09)
29 com/itextpdf/text/pdf/codec/TIFFLZWDecoder.java (first appearance in iText: 2003-04-09)
31 The original code was released under the BSD license, and contained the following
32 extra restriction: "You acknowledge that Software is not designed, licensed or intended
33 for use in the design, construction, operation or maintenance of any nuclear facility."
35 In a mail sent to Bruno Lowagie on January 23, 2008, Brian Burkhalter (@sun.com)
36 writes: "This code is under a BSD license and supersedes the older codec packages
37 on which your code is based. It also includes numerous fixes among them being the
38 ability to handle a lot of 'broken' TIFFs."
40 Note that numerous fixes were applied to the code used in iText by Paulo Soares,
41 but apart from the fixes there were no essential changes between the code that
42 was originally adapted and the code that is now available under the following
45 Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
47 Redistribution and use in source and binary forms, with or without
48 modification, are permitted provided that the following conditions
51 - Redistribution of source code must retain the above copyright
52 notice, this list of conditions and the following disclaimer.
54 - Redistribution in binary form must reproduce the above copyright
55 notice, this list of conditions and the following disclaimer in
56 the documentation and/or other materials provided with the
59 Neither the name of Sun Microsystems, Inc. or the names of
60 contributors may be used to endorse or promote products derived
61 from this software without specific prior written permission.
63 This software is provided "AS IS," without a warranty of any
64 kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
65 WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
66 FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
67 EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
68 NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
69 USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
70 DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
71 ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
72 CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
73 REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
74 INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
75 POSSIBILITY OF SUCH DAMAGES.
77 You acknowledge that this software is not designed or intended for
78 use in the design, construction, operation or maintenance of any
81 The main difference can be found in the final paragraph: the restriction
82 that the source code is not "licensed" in this particular situation has
85 FYI: Brian also added: "A bit of history might be in order.
86 The codec classes that you used originally were based on some
87 classes included with JAI but not strictly part of JAI.
88 As of Java SE 1.4 an official Image I/O framework was
89 added in javax.imageio.... This frameork supports these formats:
91 Java 1.4: GIF (read only), JPEG, PNG
92 Java 1.5: Added support for BMP and WBMP
93 Java 1.6: Added support for writing GIF
95 The JAI Image I/O Tools packages (jai-imageio-core) were created
96 to support formats handled by JAI but not included in Java SE
97 as well as some new things like JPEG2000."
99 (4) the file com/itextpdf/text/pdf/codec/TIFFConstants
100 and some other TIFF related code is derived from LIBTIFF:
102 Copyright (c) 1988-1997 Sam Leffler
103 Copyright (c) 1991-1997 Silicon Graphics, Inc.
105 Permission to use, copy, modify, distribute, and sell this software and
106 its documentation for any purpose is hereby granted without fee, provided
107 that (i) the above copyright notices and this permission notice appear in
108 all copies of the software and related documentation, and (ii) the names of
109 Sam Leffler and Silicon Graphics may not be used in any advertising or
110 publicity relating to the software without the specific, prior written
111 permission of Sam Leffler and Silicon Graphics.
113 THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
114 EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
115 WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
117 IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
118 ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
119 OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
120 WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
121 LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
127 As stated in the Javadoc comments, materials from Unicode.org
128 are used in the class com/itextpdf/text/pdf/BidiOrder.java
129 The following license applies to these materials:
130 http://www.unicode.org/copyright.html#Exhibit1
133 UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
135 Unicode Data Files include all data files under the directories
136 http://www.unicode.org/Public/, http://www.unicode.org/reports/,
137 and http://www.unicode.org/cldr/data/ .
138 Unicode Software includes any source code published in the Unicode Standard
139 or under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/,
140 and http://www.unicode.org/cldr/data/.
142 NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
143 INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA FILES"),
144 AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY,
145 ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
146 DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
148 COPYRIGHT AND PERMISSION NOTICE
149 Copyright (C) 1991-2007 Unicode, Inc. All rights reserved. Distributed under
150 the Terms of Use in http://www.unicode.org/copyright.html.
152 Permission is hereby granted, free of charge, to any person obtaining a copy
153 of the Unicode data files and any associated documentation (the "Data Files")
154 or Unicode software and any associated documentation (the "Software") to deal
155 in the Data Files or Software without restriction, including without limitation
156 the rights to use, copy, modify, merge, publish, distribute, and/or sell copies
157 of the Data Files or Software, and to permit persons to whom the Data Files
158 or Software are furnished to do so, provided that (a) the above copyright
159 notice(s) and this permission notice appear with all copies of the Data Files
160 or Software, (b) both the above copyright notice(s) and this permission notice
161 appear in associated documentation, and (c) there is clear notice in each
162 modified Data File or in the Software as well as in the documentation associated
163 with the Data File(s) or Software that the data or software has been modified.
165 THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
166 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
168 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
169 LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
170 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
171 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
172 CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
174 Except as contained in this notice, the name of a copyright holder shall not
175 be used in advertising or otherwise to promote the sale, use or other dealings
176 in these Data Files or Software without prior written authorization of the
180 Some files use code from different Apache projects.
181 The source code of these files contains the appropriate copyright notices
182 as described in the Appendix of http://www.apache.org/licenses/LICENSE-2.0
183 This is a copy of the text that can be found at that specific URL:
186 Version 2.0, January 2004
187 http://www.apache.org/licenses/
189 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
193 "License" shall mean the terms and conditions for use, reproduction,
194 and distribution as defined by Sections 1 through 9 of this document.
196 "Licensor" shall mean the copyright owner or entity authorized by
197 the copyright owner that is granting the License.
199 "Legal Entity" shall mean the union of the acting entity and all
200 other entities that control, are controlled by, or are under common
201 control with that entity. For the purposes of this definition,
202 "control" means (i) the power, direct or indirect, to cause the
203 direction or management of such entity, whether by contract or
204 otherwise, or (ii) ownership of fifty percent (50%) or more of the
205 outstanding shares, or (iii) beneficial ownership of such entity.
207 "You" (or "Your") shall mean an individual or Legal Entity
208 exercising permissions granted by this License.
210 "Source" form shall mean the preferred form for making modifications,
211 including but not limited to software source code, documentation
212 source, and configuration files.
214 "Object" form shall mean any form resulting from mechanical
215 transformation or translation of a Source form, including but
216 not limited to compiled object code, generated documentation,
217 and conversions to other media types.
219 "Work" shall mean the work of authorship, whether in Source or
220 Object form, made available under the License, as indicated by a
221 copyright notice that is included in or attached to the work
222 (an example is provided in the Appendix below).
224 "Derivative Works" shall mean any work, whether in Source or Object
225 form, that is based on (or derived from) the Work and for which the
226 editorial revisions, annotations, elaborations, or other modifications
227 represent, as a whole, an original work of authorship. For the purposes
228 of this License, Derivative Works shall not include works that remain
229 separable from, or merely link (or bind by name) to the interfaces of,
230 the Work and Derivative Works thereof.
232 "Contribution" shall mean any work of authorship, including
233 the original version of the Work and any modifications or additions
234 to that Work or Derivative Works thereof, that is intentionally
235 submitted to Licensor for inclusion in the Work by the copyright owner
236 or by an individual or Legal Entity authorized to submit on behalf of
237 the copyright owner. For the purposes of this definition, "submitted"
238 means any form of electronic, verbal, or written communication sent
239 to the Licensor or its representatives, including but not limited to
240 communication on electronic mailing lists, source code control systems,
241 and issue tracking systems that are managed by, or on behalf of, the
242 Licensor for the purpose of discussing and improving the Work, but
243 excluding communication that is conspicuously marked or otherwise
244 designated in writing by the copyright owner as "Not a Contribution."
246 "Contributor" shall mean Licensor and any individual or Legal Entity
247 on behalf of whom a Contribution has been received by Licensor and
248 subsequently incorporated within the Work.
250 2. Grant of Copyright License.
252 Subject to the terms and conditions of
253 this License, each Contributor hereby grants to You a perpetual,
254 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
255 copyright license to reproduce, prepare Derivative Works of,
256 publicly display, publicly perform, sublicense, and distribute the
257 Work and such Derivative Works in Source or Object form.
259 3. Grant of Patent License.
261 Subject to the terms and conditions of
262 this License, each Contributor hereby grants to You a perpetual,
263 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
264 (except as stated in this section) patent license to make, have made,
265 use, offer to sell, sell, import, and otherwise transfer the Work,
266 where such license applies only to those patent claims licensable
267 by such Contributor that are necessarily infringed by their
268 Contribution(s) alone or by combination of their Contribution(s)
269 with the Work to which such Contribution(s) was submitted. If You
270 institute patent litigation against any entity (including a
271 cross-claim or counterclaim in a lawsuit) alleging that the Work
272 or a Contribution incorporated within the Work constitutes direct
273 or contributory patent infringement, then any patent licenses
274 granted to You under this License for that Work shall terminate
275 as of the date such litigation is filed.
279 You may reproduce and distribute copies of the
280 Work or Derivative Works thereof in any medium, with or without
281 modifications, and in Source or Object form, provided that You
282 meet the following conditions:
284 * You must give any other recipients of the Work or
285 Derivative Works a copy of this License; and
286 * You must cause any modified files to carry prominent notices
287 stating that You changed the files; and
288 * You must retain, in the Source form of any Derivative Works
289 that You distribute, all copyright, patent, trademark, and
290 attribution notices from the Source form of the Work,
291 excluding those notices that do not pertain to any part of
292 the Derivative Works; and
293 * If the Work includes a "NOTICE" text file as part of its
294 distribution, then any Derivative Works that You distribute must
295 include a readable copy of the attribution notices contained
296 within such NOTICE file, excluding those notices that do not
297 pertain to any part of the Derivative Works, in at least one
298 of the following places: within a NOTICE text file distributed
299 as part of the Derivative Works; within the Source form or
300 documentation, if provided along with the Derivative Works; or,
301 within a display generated by the Derivative Works, if and
302 wherever such third-party notices normally appear. The contents
303 of the NOTICE file are for informational purposes only and
304 do not modify the License. You may add Your own attribution
305 notices within Derivative Works that You distribute, alongside
306 or as an addendum to the NOTICE text from the Work, provided
307 that such additional attribution notices cannot be construed
308 as modifying the License.
310 You may add Your own copyright statement to Your modifications and
311 may provide additional or different license terms and conditions
312 for use, reproduction, or distribution of Your modifications, or
313 for any such Derivative Works as a whole, provided Your use,
314 reproduction, and distribution of the Work otherwise complies with
315 the conditions stated in this License.
317 5. Submission of Contributions.
319 Unless You explicitly state otherwise,
320 any Contribution intentionally submitted for inclusion in the Work
321 by You to the Licensor shall be under the terms and conditions of
322 this License, without any additional terms or conditions.
323 Notwithstanding the above, nothing herein shall supersede or modify
324 the terms of any separate license agreement you may have executed
325 with Licensor regarding such Contributions.
329 This License does not grant permission to use the trade
330 names, trademarks, service marks, or product names of the Licensor,
331 except as required for reasonable and customary use in describing the
332 origin of the Work and reproducing the content of the NOTICE file.
334 7. Disclaimer of Warranty.
336 Unless required by applicable law or
337 agreed to in writing, Licensor provides the Work (and each
338 Contributor provides its Contributions) on an "AS IS" BASIS,
339 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
340 implied, including, without limitation, any warranties or conditions
341 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
342 PARTICULAR PURPOSE. You are solely responsible for determining the
343 appropriateness of using or redistributing the Work and assume any
344 risks associated with Your exercise of permissions under this License.
346 8. Limitation of Liability.
348 In no event and under no legal theory,
349 whether in tort (including negligence), contract, or otherwise,
350 unless required by applicable law (such as deliberate and grossly
351 negligent acts) or agreed to in writing, shall any Contributor be
352 liable to You for damages, including any direct, indirect, special,
353 incidental, or consequential damages of any character arising as a
354 result of this License or out of the use or inability to use the
355 Work (including but not limited to damages for loss of goodwill,
356 work stoppage, computer failure or malfunction, or any and all
357 other commercial damages or losses), even if such Contributor
358 has been advised of the possibility of such damages.
360 9. Accepting Warranty or Additional Liability.
363 the Work or Derivative Works thereof, You may choose to offer,
364 and charge a fee for, acceptance of support, warranty, indemnity,
365 or other liability obligations and/or rights consistent with this
366 License. However, in accepting such obligations, You may act only
367 on Your own behalf and on Your sole responsibility, not on behalf
368 of any other Contributor, and only if You agree to indemnify,
369 defend, and hold each Contributor harmless for any liability
370 incurred by, or claims asserted against, such Contributor by reason
371 of your accepting any such warranty or additional liability.
373 END OF TERMS AND CONDITIONS
375 APPENDIX: How to apply the Apache License to your work
377 To apply the Apache License to your work, attach the following
378 boilerplate notice, with the fields enclosed by brackets "[]"
379 replaced with your own identifying information. (Don't include
380 the brackets!) The text should be enclosed in the appropriate
381 comment syntax for the file format. We also recommend that a
382 file or class name and description of purpose be included on the
383 same "printed page" as the copyright notice for easier
384 identification within third-party archives.
386 Copyright [yyyy] [name of copyright owner]
388 Licensed under the Apache License, Version 2.0 (the "License");
389 you may not use this file except in compliance with the License.
390 You may obtain a copy of the License at
392 http://www.apache.org/licenses/LICENSE-2.0
394 Unless required by applicable law or agreed to in writing, software
395 distributed under the License is distributed on an "AS IS" BASIS,
396 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
397 See the License for the specific language governing permissions and
398 limitations under the License.