|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.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
|
static int |
PERMISSION_MODIFY_ANNOTATIONS
|
static int |
PERMISSION_MODIFY_CONTENTS
|
static int |
PERMISSION_PRINT_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 file. |
void |
saveDocument(String fileName,
int numCopies)
|
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
BadLocationExceptionpublic 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
BadLocationExceptionpublic 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
BadLocationExceptionpublic 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.
IOExceptionpublic void saveDocument(OutputStream outStream) throws IOException
outStream - OutputStream where the document will be written to.
IOExceptionpublic void saveDocument(String fileName, int numCopies) throws IOException
IOExceptionpublic 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
FontFormatExceptionpublic 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 | |||||||||