IText

  • 8.0.5 (2024年7月24日;穩定版本)[1]
編輯維基數據鏈接源代码库
  • github.com/itext/itext7
編輯維基數據鏈接编程语言Java、C#操作系统跨平台类型函式庫许可协议AGPLv3[2]
专有软件网站https://itextpdf.com/

iText是Java中用于创建和操作PDF文件的开源。它是由Bruno Lowagie、Paulo Soares等人编写的。Ohloh英语Ohloh报告称2001年以来[3],26个不同的贡献者进行了1万多次提交,超过100多万行代码。[4]iText具有一个由大型开发团队维护的完善的、成熟的、活跃度同比持平的代码库。[5]利用COCOMO模型,花了大约250人年英语工时的努力后,2000年11月iText项目开始了第一次提交。[6]

5.0.0版(2009年12月7日发布)后的iText是在Affero通用公共许可证第3版下分发的。之前版本的iText(Java版的至4.2.1版,和C#版的至4.1.6版)是在Mozilla公共许可证LGPL下分发的。iText同时由iText软件公司通过一个专有许可证进行分发。iText®是1T3XT BVBA的注册商标

iText已经以iTextSharp的名义移植到.NET Framework下。iTextSharp是用C#编写的,它有一个独立于iText的代码库,但与iText的版本同步。

在2013年中,iText(Java)和iTextSharp(.NET)仅在SourceForge就有超过500万次的下载量。2013年10月,iText在SourceForge上每周约有3000次下载[7],而iTextSharp每周约有4000次下载[8]

特性

开发者可以用iText来:

  • 从XML文件或数据库来动态生成PDF文档
  • 为浏览器生成PDF文档
  • 利用PDF的许多互动功能
  • 添加书签、页码、水印、条形码等
  • 分割、拼接和处理PDF页面
  • 自动填写PDF表单
  • 给PDF文件添加数字签名

通常情况下,在具有下列情况之一的项目中会使用iText:

  • 内容不是提前准备好的:它基于用户输入或数据库的实时信息来计算、处理。
  • 内容太多,PDF文件无法手动生成。
  • 在批处理过程中,文档需要在无人值守模式下创建。
  • 需要对内容进行定制或个性化。例如,最终用户的名字需要被印在多个页面上。

支持的ISO标准

  • ISO 32000-1 (PDF 1.7)
  • ISO 19005 (PDF/A)[9]
  • ISO 14289 (PDF/UA)[10]

历史

1998年冬天,Bruno Lowagie在根特大学的一个内部项目开发了一个PDF——rugPdf,用来创建一个PDF文档应用(针对学生管理用)。rugPdf是一个非常小、很复杂,实现的功能很少,例如简单的读取和写入PDF文件。为了利用这个,开发者必须了解PDF语法、对象、运算符和操作数。

1999年,Lowagie抛弃了rugPdf的代码,从头开始写了一个新的——iText。Lowagie创建iText,意图使Java开发者在不了解PDF语法的情况下也可以使用这个创建PDF文档,并在2000年2月14日将其作为自由及开放源代码软件发布。在2000年的夏天,Paulo Soares加盟了这个项目,现在他已经是iText新功能的主要开发者之一。

2007年,《SOA World》(SOA世界)杂志将iText作为企业应该使用的10种开源解决方案之一。詹姆斯·高斯林称赞iText库,并在Huckster的新版本使用。[11]纽约时报还利用iText来创建其公共领域文章的PDF版本。 [12]

iText被嵌入在许多产品和服务中,包括Eclipse BIRTJasper ReportsRed Hat JBoss Seam英语Red Hat JBoss SeamWindward Reports英语Windward Reportspdftk等等。[13]

2008年末,iText的专有许可证可用;2009年初,iText软件公司成立,成为iText产品的全球许可方。[14]

2013年,德勤提名iText软件集团为比荷卢联盟高科技、高成长50强。该公司在比荷卢联盟中排名第10位,在比利时中排名第3位。[15][16][17][18]

许可证和复刻

iTextSharp 4.1.6/iText 4.2.0之前的版本是在MPLLGPL许可证下分发的,允许用户在闭源软件项目中使用。2009年底,iText第5版发布,其许可证被更换为Affero通用公共许可证第3版。 那些不愿意提供其源代码的项目,可以购买iText第5版的商业许可,或没有任何变化的继续使用iText的以前版本(其许可证更宽松)。[19][20]然而,开发商Bruno Lowagie警告说[來源請求],第5版之前的版本可能包含非LGPL授权的代码,因而以前版本的闭源项目的用户可能需要为侵犯版权负责。虽然AGPL库可以链接到GPL的程序,但AGPL许可证与GPL许可证不兼容。

示例

下面的源代码生成一个PDF文件,作为一个Hello World的例子。

import java.io.FileOutputStream;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
 
public class ITextHelloWorld {
    public static void main(String args[]) {
        try {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream("HelloWorld.pdf"));
            document.open();
            document.add(new Paragraph("Hello World"));
            document.close();
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

延展阅读

  • Lowagie, Bruno. iText in Action 2nd. Manning Publications. Summer 2010: 600. ISBN 978-1-935182-61-0. 
  • Review first edition on JFree.org(页面存档备份,存于互联网档案馆) by David Gilbert
  • Review first edition on JavaLobby by Stephen Kitt
  • Lowagie, Bruno. iText in Action 1st. Manning Publications. 8 December 2006: 656. ISBN 1-932394-79-6. 
  • Review second edition in Freies Magazin(页面存档备份,存于互联网档案馆) by Michael Niedermair
  • PDF Generation Made Easy(页面存档备份,存于互联网档案馆) by Benoy Jose
  • Tools of the Trade, Part 1: Creating PDF documents with iText(页面存档备份,存于互联网档案馆) by Jeff Friesen (Adobe Press)
  • Dynamically Creating PDFs in a Web Application(页面存档备份,存于互联网档案馆) by Sean C. Sullivan
  • Creating PDFs with iText(页面存档备份,存于互联网档案馆) by Christoph Bartneck
  • Generate PDF files from Java applications dynamically(页面存档备份,存于互联网档案馆) by Amit Tuli, Staff Software Engineer, IBM
  • Create PDF With iText Java Tutorial(页面存档备份,存于互联网档案馆
  • Itext Add / Insert Image Into PDF(页面存档备份,存于互联网档案馆
  • Snyder, Thomas. Advanced Integrated RPG. MC Press. 19 January 2010: 400. ISBN 978-1583470954.  外部链接存在于|title= (帮助) (Chapters 10, 11 and 12(页面存档备份,存于互联网档案馆) are dedicated entirely to iText)
  • Johnson, Rod. Expert One-on-One J2EE Design and Development. Wrox. 23 October 2002: 768. ISBN 978-0764543852.  外部链接存在于|title= (帮助) (see section "Generating PDF with iText" starting on p705)
  • Danciu, Teodor. [http://books.google.be/books?id=LWTbssKt6MUC&printsec=frontcover&dq=iText&hl=en&sa=X&ei=IdtcUuLjBeGl0QXvgoDYCw&redir_esc=y#v=onepage&q=iText&f=false The Definitive Guide to JasperReports]. APress. 27 August 2007: 223. ISBN 978-1590599273.  外部链接存在于|title= (帮助)
  • Whitington, John. PDF Explained. O'Reilly. 10 December 2011: 142. ISBN 978-1449310028.  外部链接存在于|title= (帮助)
  • Steward, Sid. [http://books.google.be/books?id=ozWeSBkPQW4C&printsec=frontcover&dq=iText&hl=en&sa=X&ei=E9tcUsPeM4m70QWQtICQDg&redir_esc=y#v=onepage&q=iText&f=false PDF Hacks]. O'Reilly. 23 August 2004: 298. ISBN 978-0596006556.  外部链接存在于|title= (帮助) (translated into Italian: Acrobat e PDF. Trucchi e segreti(页面存档备份,存于互联网档案馆))

参见

  • 自由软件主题

参考文献

  1. ^ Release 8.0.5. 2024年7月24日 [2024年8月22日]. 
  2. ^ The 'LICENSE.txt' file in iText source code repository. Itext.svn.sourceforge.net. [2013-10-26]. [永久失效連結]
  3. ^  . Ohloh commits summary. Ohloh.net. 2013-08-19 [2013-10-26]. (原始内容存档于2013-10-23). 
  4. ^  . Ohloh languages summary. Ohloh.net. 2013-08-19 [2013-10-26]. (原始内容存档于2013-10-23). 
  5. ^  . Ohloh iText overview page. Ohloh.net. [2013-10-26]. (原始内容存档于2013-10-23). 
  6. ^  . Ohloh Estimated development cost. Ohloh.net. 2013-08-19 [2013-10-26]. (原始内容存档于2013-10-23). 
  7. ^ iText on SourceForge. Sourceforge.net. [2013-10-26]. (原始内容存档于2013-10-29). 
  8. ^ iTextSharp on SourceForge. Sourceforge.net. [2013-10-26]. (原始内容存档于2013-10-21). 
  9. ^ PDF Association. How to create PDF/A-3 using iText (PDF). Pdfa.org. 2013-06-06 [2013-10-26]. (原始内容 (PDF)存档于2013-10-03). 
  10. ^ iText bringing PDF/UA support to Java Implementations (页面存档备份,存于互联网档案馆) by Duff Johnson
  11. ^ James Gosling praises iText. Blogs.oracle.com. 2007-09-20 [2013-10-26]. (原始内容存档于2013-12-15). 
  12. ^ Derek Gottfrid. Self-Service, Prorated Supercomputing Fun!. Code - Open Blog - NYTimes.com. [2014-08-11]. (原始内容存档于2019-02-16). 
  13. ^ list with references. [2014-07-15]. (原始内容存档于2014-06-25). 
  14. ^ Feature article in Wereldwijs, a monthly magazine by Flanders Investment and Trade (in Dutch). Epub01.publitas.com. [2013-10-26]. (原始内容存档于2012-10-10). 
  15. ^ Ranking Deloitte Technology Fast 50 Benelux (PDF). [2014-07-15]. (原始内容 (PDF)存档于2013-10-14). 
  16. ^ DataNews: 10 Belgians in Deloitte's Technology Fast 50 (Dutch article). [2014-07-15]. (原始内容存档于2014-07-06). 
  17. ^ digimedia: the 5 Belgian digital start-ups with the fastest growth rate (Dutch article). [2014-07-15]. (原始内容存档于2014-08-02). 
  18. ^ Deloitte's Fast 50 Newspaper article (PDF). [2014-07-15]. (原始内容存档 (PDF)于2013-10-19). 
  19. ^ mailing list discussion. [2014-07-15]. (原始内容存档于2014-10-25). 
  20. ^ Talk about the (A)GPL (页面存档备份,存于互联网档案馆) by Ywein Van den Brande, IP lawyer and technologist

外部链接