|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.qoppa.pdfWriter.PDFDocument
PDF document object.
This class is used to create PDF documents from Java programs.
The steps to create a document are:
createPage
.
Field Summary | |
String |
PAGEMODE_FULLSCREEN
Full-screen mode, with no menu bar, window controls, or any other window visible |
String |
PAGEMODE_USEATTACHMENTS
(PDF 1.6) Attachments panel visible |
String |
PAGEMODE_USENONE
Neither document outline nor thumbnail images visible |
String |
PAGEMODE_USEOC
(PDF 1.5) Optional content group panel visible |
String |
PAGEMODE_USEOUTLINES
Document outline visible |
String |
PAGEMODE_USETHUMBS
Thumbnail images visible |
static int |
PERMISSION_COPY_TEXT_GRAPHICS
Permission flag to copy / extract text from the document. |
static int |
PERMISSION_MODIFY_ANNOTATIONS
Permission flag to add / modify annotations. |
static int |
PERMISSION_MODIFY_CONTENTS
Permission flag to modify the contents. |
static int |
PERMISSION_PRINT_DOCUMENT
Permission flag to print the document. |
Constructor Summary | |
PDFDocument()
Constructs a new PDF document. |
Method Summary | |
void |
addPage(PDFPage page)
Adds a page to this document. |
PDFPage |
createPage(PageFormat pf)
Creates a new PDFPage. |
Font |
embedFont(String fileName,
int fontFormat,
float size)
Embeds a font in the PDF file. |
static PageFormat |
getDefaultPageFormat()
Returns default page format for PDF documents. |
PDFPage |
getPage(int index)
Returns the PDFPage object corresponding to the given index. |
int |
getPageCount()
Returns the number of pages in the document. |
static String |
getVersion()
Returns version string for the jPDFWriter. |
static PDFDocument |
loadHTML(byte[] htmlContent,
URL baseURL,
PageFormat pf,
boolean fitToPage)
Creates a PDFDocument from a byte array containing HTML script. |
static PDFDocument |
loadHTML(URL url,
PageFormat pf,
boolean fitToPage)
Creates a PDFDocument from an HTML URL. |
static PDFDocument |
loadRTF(String rtfFile,
PageFormat pf)
Creates a PDFDocument from an RTF file. |
void |
saveDocument(OutputStream outStream)
Saves this document to an output stream. |
void |
saveDocument(String fileName)
Saves this document to a PDF file. |
void |
saveDocument(String fileName,
int numCopies)
Saves this document to a PDF file and replicates the document to simulate number of copies. |
void |
setDocumentInfo(DocumentInfo docInfo)
Sets document information, such as the author, creation date and more. |
void |
setEncryption(String ownerPwd,
String userPwd,
int permissions)
Sets the encryption for this document. |
static void |
setKey(String key)
Sets product key. |
void |
setPageMode(String pageMode)
Changes the value of the page mode viewer preference in the document. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PERMISSION_PRINT_DOCUMENT
public static final int PERMISSION_MODIFY_CONTENTS
public static final int PERMISSION_COPY_TEXT_GRAPHICS
public static final int PERMISSION_MODIFY_ANNOTATIONS
public String PAGEMODE_USENONE
public String PAGEMODE_USEOUTLINES
public String PAGEMODE_USETHUMBS
public String PAGEMODE_FULLSCREEN
public String PAGEMODE_USEOC
public String PAGEMODE_USEATTACHMENTS
Constructor Detail |
public PDFDocument()
Method Detail |
public static PDFDocument loadRTF(String rtfFile, PageFormat pf) throws IOException, BadLocationException
rtfFile
- - Name of the RTF file.pf
- - PageFormat to use when creating pages in the PDF document.
IOException
BadLocationException
public static PDFDocument loadHTML(URL url, PageFormat pf, boolean fitToPage) throws IOException, BadLocationException
url
- - url pointing to the HTML content.pf
- - PageFormat to use when creating pages in the PDF document.fitToPage
- - Set to shrink the document so that pages fit horizontally.
IOException
BadLocationException
public static PDFDocument loadHTML(byte[] htmlContent, URL baseURL, PageFormat pf, boolean fitToPage) throws IOException, BadLocationException
htmlContent
- - byte array containing HTML script.baseURL
- - URL to use when using relative references within the HTML content.pf
- - PageFormat to use when creating pages in the PDF document.fitToPage
- - Set to shrink the document so that pages fit horizontally.
IOException
BadLocationException
public PDFPage createPage(PageFormat pf)
addPage
must be called to add the page to the document.
pf
- The format of the new page.public void addPage(PDFPage page)
page
- The new page.public PDFPage getPage(int index)
index
- The index of the desired page.
public int getPageCount()
public void saveDocument(String fileName) throws IOException
fileName
- Name of the file to save the document.
IOException
public void saveDocument(OutputStream outStream) throws IOException
outStream
- OutputStream where the document will be written to.
IOException
public void saveDocument(String fileName, int numCopies) throws IOException
fileName
- The name of the output file.numCopies
- The number of copies of the document.
IOException
public static final String getVersion()
public static PageFormat getDefaultPageFormat()
public static void setKey(String key)
key
- - Product key.public void setEncryption(String ownerPwd, String userPwd, int permissions)
ownerPwd
- The document's owner password.userPwd
- The document's user password.permissions
- Permission bits. The value of this parameter should be
the or'ed values of the constant values PERMISSION_PRINT_DOCUMENT, PERMISSION_MODIFY_CONTENTS,
PERMISSION_COPY_TEXT_GRAPHICS and PERMISSION_MODIFY_ANNOTATIONS. Passing a value of 0 means
that no permissions will be granted.public void setDocumentInfo(DocumentInfo docInfo)
docInfo
- The document information.public Font embedFont(String fileName, int fontFormat, float size) throws IOException, FontFormatException
fileName
- Name of the font file.fontFormat
- Font format. This can be Font.TRUETYPE_FONT or Font.TYPE1_FONT (if using JDK1.5)
IOException
FontFormatException
public void setPageMode(String pageMode)
pageMode
- The new page mode. This value has to be one of the following predefined constants:
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |