Package org.apache.pdfbox
Class TextToPDF
- java.lang.Object
-
- org.apache.pdfbox.TextToPDF
-
public class TextToPDF extends java.lang.ObjectThis will take a text file and ouput a pdf with that text.- Version:
- $Revision: 1.4 $
- Author:
- Ben Litchfield
-
-
Constructor Summary
Constructors Constructor Description TextToPDF()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PDDocumentcreatePDFFromText(java.io.Reader text)Create a PDF document with some text.voidcreatePDFFromText(PDDocument doc, java.io.Reader text)Create a PDF document with some text.PDSimpleFontgetFont()intgetFontSize()booleanisLandscape()Tells the paper orientation.static voidmain(java.lang.String[] args)This will create a PDF document with some text in it.voidsetFont(PDSimpleFont aFont)voidsetFontSize(int aFontSize)voidsetLandscape(boolean landscape)Sets paper orientation.
-
-
-
Method Detail
-
createPDFFromText
public PDDocument createPDFFromText(java.io.Reader text) throws java.io.IOException
Create a PDF document with some text.- Parameters:
text- The stream of text data.- Returns:
- The document with the text in it.
- Throws:
java.io.IOException- If there is an error writing the data.
-
createPDFFromText
public void createPDFFromText(PDDocument doc, java.io.Reader text) throws java.io.IOException
Create a PDF document with some text.- Parameters:
doc- The PDF document that shall content the text.text- The stream of text data.- Throws:
java.io.IOException- If there is an error writing the data.
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionThis will create a PDF document with some text in it.
see usage() for commandline- Parameters:
args- Command line arguments.- Throws:
java.io.IOException- If there is an error with the PDF.
-
getFont
public PDSimpleFont getFont()
- Returns:
- Returns the font.
-
setFont
public void setFont(PDSimpleFont aFont)
- Parameters:
aFont- The font to set.
-
getFontSize
public int getFontSize()
- Returns:
- Returns the fontSize.
-
setFontSize
public void setFontSize(int aFontSize)
- Parameters:
aFontSize- The fontSize to set.
-
isLandscape
public boolean isLandscape()
Tells the paper orientation.- Returns:
-
setLandscape
public void setLandscape(boolean landscape)
Sets paper orientation.- Parameters:
landscape-
-
-