Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DBC1D18844 for ; Fri, 23 Oct 2015 13:34:00 +0000 (UTC) Received: (qmail 22795 invoked by uid 500); 23 Oct 2015 13:34:00 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 22742 invoked by uid 500); 23 Oct 2015 13:34:00 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 22733 invoked by uid 99); 23 Oct 2015 13:34:00 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Oct 2015 13:34:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 35F80C4F06 for ; Fri, 23 Oct 2015 13:34:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.001 X-Spam-Level: * X-Spam-Status: No, score=1.001 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id xwSmWBHNm7Cj for ; Fri, 23 Oct 2015 13:33:59 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id 4DC5720562 for ; Fri, 23 Oct 2015 13:33:59 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0DD32E049C for ; Fri, 23 Oct 2015 13:33:59 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 0BDC23A0907 for ; Fri, 23 Oct 2015 13:33:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r969976 - /websites/production/pdfbox/content/2.0/migration.html Date: Fri, 23 Oct 2015 13:33:59 -0000 To: commits@pdfbox.apache.org From: msahyoun@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151023133359.0BDC23A0907@svn01-us-west.apache.org> Author: msahyoun Date: Fri Oct 23 13:33:58 2015 New Revision: 969976 Log: Site checkin for project Apache PDFBox Website Modified: websites/production/pdfbox/content/2.0/migration.html Modified: websites/production/pdfbox/content/2.0/migration.html ============================================================================== --- websites/production/pdfbox/content/2.0/migration.html (original) +++ websites/production/pdfbox/content/2.0/migration.html Fri Oct 23 13:33:58 2015 @@ -222,7 +222,7 @@ results when switching to PDFBox 2.0.0.<

Font handling now has full Unicode support and supports font subsetting.

TrueType fonts shall now be loaded using

-
PDType0Font.load
+
PDType0Font.load
 

to leverage that.

@@ -247,41 +247,47 @@ and so on. The add method n

Iterating Pages

With PDFBox 2.0.0 the prefered way to iterate through the pages of a document is

-
for(PDPage page : document.getPages())
+
+

~~java +for(PDPage page : document.getPages()) { - ... (do something) + ... (do something) } -

+~~~

+

PDF Rendering

With PDFBox 2.0.0 PDPage.convertToImagehas been removed. Instead the new PDFRenderer class shall be used.

-
PDDocument document = PDDocument.load(new File(pdfFilename));
-PDFRenderer pdfRenderer = new PDFRenderer(document);
-int pageCounter = 0;
-for (PDPage page : document.getPages())
-{ 
-    pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
-
-    // suffix in filename will be used as the file format
-    ImageIOUtil.writeImage(bim, pdfFilename + "-" + (pageCounter++) + ".png", 300);
-}
-document.close();
+
PDDocument document = PDDocument.load(new File(pdfFilename));
+PDFRenderer pdfRenderer = new PDFRenderer(document);
+int pageCounter = 0;
+for (PDPage page : document.getPages())
+{ 
+    pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
+
+    // suffix in filename will be used as the file format
+    ImageIOUtil.writeImage(bim, pdfFilename + "-" + (pageCounter++) + ".png", 300);
+}
+document.close();
 

PDF Printing

With PDFBox 2.0.0 PDFPrinter has been removed.

Users of PDFPrinter.silentPrint() should now use this code:

-
PrinterJob job = PrinterJob.getPrinterJob();
+
+

~~java +PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(new PDFPageable(document)); job.print(); -

+~~~

+

While users of PDFPrinter.print() should now use this code:

-
PrinterJob job = PrinterJob.getPrinterJob();
-job.setPageable(new PDFPageable(document));
-if (job.printDialog()) {
-    job.print();
-}
+
PrinterJob job = PrinterJob.getPrinterJob();
+job.setPageable(new PDFPageable(document));
+if (job.printDialog()) {
+    job.print();
+}
 

Advanced use case examples can be found in th examples package under org/apache/pdfbox/examples/printing/Printing.java

@@ -292,10 +298,10 @@ there is a clear distinction between fie tree are now represented by the PDNonTerminalField class.

With PDFBox 2.0.0 the prefered way to iterate through the fields is now

-
for (PDField field : form.getFieldTree())
-{
-    ... (do something)
-}
+
for (PDField field : form.getFieldTree())
+{
+    ... (do something)
+}
 

Most PDField subclasses now accept Java generic types such as String as parameters instead of the former COSBase subclasses.