You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2015/10/23 15:33:42 UTC
svn commit: r1710207 -
/pdfbox/cmssite/branches/jekyll-migration/content/2.0/migration.md
Author: msahyoun
Date: Fri Oct 23 13:33:42 2015
New Revision: 1710207
URL: http://svn.apache.org/viewvc?rev=1710207&view=rev
Log:
PDFBOX-3040: specify source code language
Modified:
pdfbox/cmssite/branches/jekyll-migration/content/2.0/migration.md
Modified: pdfbox/cmssite/branches/jekyll-migration/content/2.0/migration.md
URL: http://svn.apache.org/viewvc/pdfbox/cmssite/branches/jekyll-migration/content/2.0/migration.md?rev=1710207&r1=1710206&r2=1710207&view=diff
==============================================================================
--- pdfbox/cmssite/branches/jekyll-migration/content/2.0/migration.md (original)
+++ pdfbox/cmssite/branches/jekyll-migration/content/2.0/migration.md Fri Oct 23 13:33:42 2015
@@ -52,7 +52,9 @@ Font handling now has full Unicode suppo
TrueType fonts shall now be loaded using
- PDType0Font.load
+~~~java
+PDType0Font.load
+~~~~
to leverage that.
@@ -73,42 +75,50 @@ In addition there are some specialized c
### Iterating Pages
With PDFBox 2.0.0 the prefered way to iterate through the pages of a document is
- for(PDPage page : document.getPages())
- {
- ... (do something)
- }
+~~java
+for(PDPage page : document.getPages())
+{
+ ... (do something)
+}
+~~~
### PDF Rendering
With PDFBox 2.0.0 `PDPage.convertToImage`has 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();
+~~~java
+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();
- job.setPageable(new PDFPageable(document));
- job.print();
+~~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();
- }
+~~~java
+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
@@ -119,10 +129,11 @@ tree are now represented by the `PDNonTe
With PDFBox 2.0.0 the prefered way to iterate through the fields is now
- 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.
+~~~java
+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.
\ No newline at end of file