forked from LibrePDF/OpenPDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
pdf-toolbox/src/test/java/com/lowagie/examples/objects/LongList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* $Id: Lists.java 3373 2008-05-12 16:21:24Z xlv $ | ||
* | ||
* This code is part of the 'OpenPDF Tutorial'. | ||
* You can find the complete tutorial at the following address: | ||
* https://github.com/LibrePDF/OpenPDF/wiki/Tutorial | ||
* | ||
* This code 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. | ||
* | ||
* | ||
*/ | ||
|
||
package com.lowagie.examples.objects; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.io.FileOutputStream; | ||
|
||
import com.lowagie.text.Document; | ||
import com.lowagie.text.List; | ||
import com.lowagie.text.ListItem; | ||
import com.lowagie.text.pdf.PdfWriter; | ||
|
||
/** | ||
* Demonstrates some List functionality. | ||
* | ||
* @author blowagie | ||
*/ | ||
|
||
public class LongList { | ||
|
||
/** | ||
* Demonstrates some List functionality. | ||
* | ||
* @param args no arguments needed here | ||
*/ | ||
public static void main(String[] args) throws FileNotFoundException { | ||
System.out.println("the Long List example"); | ||
// step 1: creation of a document-object | ||
Document document = new Document(); | ||
// step 2: | ||
PdfWriter.getInstance(document, new FileOutputStream("longList.pdf")); | ||
// step 3: we open the document | ||
document.open(); | ||
// step 4: | ||
List list = new List(true); | ||
for (int i = 0; i < 30; i++) { | ||
list.add(new ListItem("This is the line with the number " + (i + 1) | ||
+ ". Don't worry if the line is very long, but we need to a line break.")); | ||
} | ||
document.add(list); | ||
// step 5: we close the document | ||
document.close(); | ||
} | ||
} |