public class PdfDocument extends Object implements Serializable
You can use an instance of this class to create a new PDF document
from scratch. Alternatively, you can load an existing document and
make modifications to it. A loaded PDF document can also be
displayed using a PdfViewer
component
and printed using a PdfPrinter
component.
To create a new PDF document, just create a new instance of this
class. When you do this, a blank page will be automatically added
to the document. For more pages, you need to create
PdfPage
objects and add to the
document. You can create content across pages using the methods in
this class or individually using similar methods in the
PdfPage
class. Finally, you need to
save the document to a disk file, stream object, or a File
instance.
package com.gnostice.pdfonej_examples; import com.gnostice.pdfone.PDFOne; import com.gnostice.pdfone.PdfDocument; import com.gnostice.pdfone.PdfPage; import com.gnostice.pdfone.PdfPageSize; public class PdfDocument_Creation { public static void main(String[] args) { PDFOne.activate("your-authorization-key", "your-product-key"); if (args.length < 2) { System.out.println("Sorry, 2 arguments are required: image file and output file"); System.exit(1); } // Create a new PDF document PdfDocument doc = new PdfDocument(); // A blank page (page #1) is automatically added try { // Create content page #1 doc.getFont().setSize(30); doc.writeText("Hello, world!", 25, 25); doc.drawImage(args[0], 25, 100); doc.drawRect(500, 35, 50, 75); // Create another page and add to document PdfPage page2 = new PdfPage(PdfPageSize.A5); page2.getFont().setSize(20); page2.writeText("Hello again, world!", 25, 25); doc.add(page2); // Write text across page #1 and #2 doc.writeText("Page #<%PageNo%>", 250, 50, "1,2"); // PageNo is one of several built-in placeholders // you can use in text strings rendered on pages. // Placeholders are delimited by <% and %>. // Set document to be launched after it is saved doc.setOpenAfterSave(true); // Works only in Microsoft Windows // Save document to disc doc.save(args[1]); // Close I/O resources used for the document doc.close(); } catch (Exception e) { System.out.println("Sorry, an error occurred - " + e.getMessage()); } } }
See screenshot.
To edit, enhance, display or print a PDF document, you need load the document. After loading the document, you can use the content creation methods of this class. Alternatively, you can access individual pages and use methods of the PdfPage class.
package com.gnostice.pdfonej_examples; import java.awt.Color; import com.gnostice.pdfone.PDFOne; import com.gnostice.pdfone.PdfDocument; import com.gnostice.pdfone.PdfPage; import com.gnostice.pdfone.encodings.PdfEncodings; import com.gnostice.pdfone.fonts.PdfFont; public class PdfDocument_Editing { public static void main(String[] args) { PDFOne.activate("your-authorization-key", "your-product-key"); if (args.length < 3) { System.out.println("Sorry, 3 arguments are required: input file, font file, and output file"); System.exit(1); } PdfDocument doc = new PdfDocument(); try { // Load an existing PDF document doc.load(args[0]); // Detect number of pages in the document System.out.println("The loaded document has " + doc.getPageCount() + " pages."); if (doc.getPageCount() > 1) { // Write text using a TrueType font PdfFont fontTrueType = PdfFont.create(args[1], 15, PdfEncodings.WINANSI, PdfFont.EMBED_SUBSET); doc.writeText("This text uses subset-embedded " + fontTrueType.getBaseFontName(), fontTrueType, // font 100, // x-coordinate 10, // y-coordinate "1-2"); // page range // Create a standard Type 1 font, which requires // no font embedding PdfFont fontCourier = PdfFont.create("Courier", // Or Helvetica, Roman, Symbol, Zapf-Dingbats PdfFont.BOLD, 24, PdfEncodings.WINANSI); fontCourier.setColor(Color.LIGHT_GRAY); // Obtain page #2 PdfPage page2 = doc.getPage(2); // Write text on page #2 page2.writeText("This text uses standard Type 1 Courier", fontCourier, // Standard type 1 font 50.0, // x-coordinate 150, // y-coordinate 45); // angle of rotation } // Set document to be launched after it is saved doc.setOpenAfterSave(true); // Works only in Microsoft Windows // Save changes to a file doc.save(args[2]); // Close I/O resources used for the document doc.close(); } catch (Exception e) { System.out.println("Sorry, an error occurred:\n" + e.getMessage()); System.exit(1); } } }
See screenshot.
The PdfDocument
class offers numerous methods to
work with elements such as text, images, shapes, tables, form
fields, annotations, bookmarks, and pages in PDF documents.
When content is written to a new PdfDocument
object,
a default PdfPage
object is automatically created
and added to the PdfDocument
. This
PdfPage
also becomes PdfDocument
's
"current page." Whenever data is written to a document without
explicitly specifying a page range, the data is automatically
written to the PdfDocument
's current page. This
does not change even when new PdfPage
objects have
been added to the PdfDocument
object. To make a page
that is to be added set as the current page, the overloaded
add(PdfPage p, boolean setAsCurrentPage)
method should be
used. To write content to a specific page that is not necessarily
the current page, methods that have a page range argument should be
used.
While writing to a PdfDocument
object, the position
where the content should appear is very important. The coordinates
of the position is always made in reference to the top-left corner
the PdfDocument
's current page. Whenever
coordinates, position, or sizes are used, they are usually applied
in terms of the document's current measurement unit, which can be
pixels, twips, points, inches, or centimeters. However, in
situations where a measurement unit cannot be applied or
determined, the measurement unit will be by default points.
Every document has a default pen setting and a default brush setting. The pen for example is used to stroke the borders when a rectangle is drawn. In the same example, the brush would be used when the area bounded by the rectangle is filled.
PdfWriter
,
PdfReader
,
PdfPage
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
ALIGNMENT_CENTER
Constant for aligning form field text to the center.
|
static int |
ALIGNMENT_LEFT
Constant for aligning form field text to the left.
|
static int |
ALIGNMENT_RIGHT
Constant for aligning form field text to right.
|
static int |
MERGE_INCLUDE_ALL
Flag for inclusion of annotations, bookmarks, document-level
actions, page-level actions, and form fields when merging
documents.
|
static int |
MERGE_INCLUDE_ANNOTATIONS
Flag for inclusion of annotations when merging documents.
|
static int |
MERGE_INCLUDE_BOOKMARKS
Flag for inclusion of bookmarks when merging documents.
|
static int |
MERGE_INCLUDE_DOCUMENT_ACTIONS
Flag for inclusion of document-level actions when merging
documents.
|
static int |
MERGE_INCLUDE_FORMFIELDS
Flag for inclusion of form fields when merging documents.
|
static int |
MERGE_INCLUDE_PAGE_ACTIONS
Flag for inclusion of page-level actions when merging
documents.
|
static int |
TIFF_Compression_CCITT_RLE
Constant for using modified Huffman compression (1 bit per
component) when saving to a TIFF image.
|
static int |
TIFF_Compression_CCITT_T4
Constant for using CCITT T.4 bilevel encoding or Group 3
facsimile compression (1 bit per component) when saving to a
TIFF image.
|
static int |
TIFF_Compression_CCITT_T6
Constant for using CCITT T.6 bilevel encoding or Group 4 facsimile
compression (1 bit per component) when saving to a TIFF image.
|
static int |
TIFF_Compression_Deflate
Constant for using "Zip-in-TIFF" compression (8 bits per
component) when saving to a TIFF image.
|
static int |
TIFF_Compression_EXIF_JPEG
Constant for using EXIF-specific JPEG compression (8 bits per
component) when saving to a TIFF image.
|
static int |
TIFF_Compression_JPEG
Constant for using "'New' JPEG-in-TIFF" lossy compression (8
bits per component) when saving to a TIFF image.
|
static int |
TIFF_Compression_LZW
Constant for using LZW compression (8 bits per component) when
saving to a TIFF image.
|
static int |
TIFF_Compression_NONE
Constant for using no compression when saving to a TIFF image.
|
static int |
TIFF_Compression_PackBits
Constant for using "byte-oriented, run length compression" (8
bits per component) when saving to a TIFF image.
|
static int |
TIFF_Compression_ZLib
Constant for using "Deflate/Inflate compression" (8 bits per
component) when saving to a TIFF image.
|
static String |
VERSION_1_4
PDF version 1.4
|
static String |
VERSION_1_5
PDF version 1.5
|
static String |
VERSION_1_6
PDF version 1.6
|
static String |
VERSION_1_7
PDF version 1.7
|
INCHES_TO_POINTS, MM_TO_INCHES, MM_TO_POINTS, PDF_A, PDF_AA, PDF_AC, PDF_ACROFORM, PDF_ACTION, PDF_ALTERNATEPRESENTATIONS, PDF_ANNOT, PDF_ANNOT_DEFAULT_TITLE, PDF_ANNOT_NAME, PDF_ANNOT_SUBJECT, PDF_ANNOTS, PDF_AP, PDF_ARRAYEND, PDF_ARRAYSTART, PDF_ARTBOX, PDF_AS, PDF_ASCENT, PDF_ASCII85, PDF_ASCII85_NEW, PDF_ASCIIHEX, PDF_ASCIIHEX_NEW, PDF_AuthEvent, PDF_AUTHOR, PDF_AVGWIDTH, PDF_B, PDF_BASEFONT, PDF_BBOX, PDF_BC, PDF_BE, PDF_BEFOREFORMAT, PDF_BEGINTEXT, PDF_BG, PDF_BINARYDATA, PDF_BITS_PER_COMPONENT, PDF_BL, PDF_BLEEDBOX, PDF_BLINDS, PDF_BMC, PDF_BORDER, PDF_BOX, PDF_BS, PDF_BTN, PDF_BYTERANGE, PDF_C, PDF_CA, PDF_CA_SMALL, PDF_CAPHEIGHT, PDF_CARETANNOT, PDF_CARRIAGE, PDF_CATALOG, PDF_CENTER_WINDOW, PDF_CF, PDF_CFM, PDF_CH, PDF_CID_TO_GID_MAP, PDF_CIDFONT_TYPE0, PDF_CIDFONT_TYPE1, PDF_CIDFONT_TYPE2, PDF_CIDSYSTEM_INFO, PDF_CIRCLEANNOT, PDF_CL, PDF_CM, PDF_COLOMNS, PDF_COLOR, PDF_COLORSPACE, PDF_COLORSPACE_CALGRAY, PDF_COLORSPACE_CALRGB, PDF_COLORSPACE_DEVICEN, PDF_COLORSPACE_ICCBASED, PDF_COLORSPACE_LAB, PDF_COLORSPACE_SEPARATION, PDF_CONTACTINFO, PDF_CONTENTS, PDF_COUNT, PDF_COVER, PDF_CREATIONDATE, PDF_CREATOR, PDF_CROPBOX, PDF_CS, PDF_CSP, PDF_D, PDF_DA, PDF_DATE, PDF_DATE_FORMAT, PDF_DCTDECODE, PDF_DCTDECODE_NEW, PDF_DECODEPARMS, PDF_DESC, PDF_DESCENDANT, PDF_DESCENDANT_FONTS, PDF_DESCENDENTFONTS, PDF_DESCENT, PDF_DESTINATION, PDF_DESTS, PDF_DEVICE_CMYK, PDF_DEVICE_GRAY, PDF_DEVICE_RGB, PDF_DI, PDF_DICTEND, PDF_DICTSTART, PDF_DIFFERENCES, PDF_DIRECTION, PDF_DISPLAY_DOCTITLE, PDF_DISPLAY_DURATION, PDF_DISSOLVE, PDF_DM, PDF_DOC_SUBJECT, PDF_DOCMDP, PDF_DOS, PDF_DP, PDF_DR, PDF_DS, PDF_DV, PDF_DW, PDF_E, PDF_EF, PDF_EMBEDDEDFILE, PDF_EMBEDDEDFILES, PDF_EMC, PDF_ENCODING, PDF_ENCRYPT, PDF_ENCRYPTMETADATA, PDF_ENDOBJ, PDF_ENDPATH, PDF_ENDSTREAM, PDF_ENDTEXT, PDF_EOCLIP, PDF_EOF, PDF_EXTGSTATE, PDF_F, PDF_FADE, PDF_FALSE, PDF_FDESCRIPTOR, PDF_FIELD_FLAG, PDF_FIELDS, PDF_FILEATTACHMENTANNOT, PDF_FILESPEC, PDF_FILTER, PDF_FIRST, PDF_FIRST_PAGE, PDF_FIRSTCHAR, PDF_FIT, PDF_FIT_WINDOW, PDF_FITB, PDF_FITBH, PDF_FITBV, PDF_FITH, PDF_FITR, PDF_FITV, PDF_FIXEDPRINT, PDF_FLAGS, PDF_FLATE, PDF_FLATE_NEW, PDF_FLY, PDF_FO, PDF_FONT, PDF_FONTBBOX, PDF_FONTDESCRIPTOR, PDF_FONTFILE, PDF_FONTFILE_2, PDF_FontFile_3, PDF_FONTFILE2, PDF_FONTNAME, PDF_FONTNAMEPREFIX, PDF_FORM, PDF_FORMFEED, PDF_FORMFONTPREFIX, PDF_FREE_TEXT_CALLOUT, PDF_FREE_TEXT_TYPEWRITER, PDF_FREETEXTANNOT, PDF_FS, PDF_FT, PDF_FULLSCREEN, PDF_GLITTER, PDF_GOTO_ACTION, PDF_GROUP, PDF_GS, PDF_H, PDF_HEADER, PDF_HEIGHT, PDF_HEXSTRINGEND, PDF_HEXSTRINGSTART, PDF_HIDE_MENUBAR, PDF_HIDE_TOOLBAR, PDF_HIDE_WINDOWUI, PDF_HIGHLIGHT, PDF_HORIZ_STEM, PDF_HORIZONTAL, PDF_I, PDF_IC, PDF_ID, PDF_IDS, PDF_IF, PDF_IMAGE, PDF_IMAGEB, PDF_IMAGEC, PDF_IMAGEI, PDF_IMPORTDATA, PDF_INDEX, PDF_INDEXED, PDF_INFO, PDF_INK, PDF_INKLIST, PDF_INWARD, PDF_IT, PDF_ITALANGLE, PDF_IX, PDF_JAVASCRIPT, PDF_JAVASCRIPT_ACTION, PDF_JS, PDF_KEYSTROKE, PDF_KEYWORDS, PDF_KIDS, PDF_L, PDF_L2R, PDF_LANG, PDF_LAST, PDF_LAST_PAGE, PDF_LASTCHAR, PDF_LAUNCH_ACTION, PDF_LE, PDF_LEGAL, PDF_LENGTH, PDF_LENGTH_1, PDF_LENGTH_2, PDF_LENGTH_3, PDF_LF, PDF_LINEANNOT, PDF_LINKANNOT, PDF_LITERALSTRINGEND, PDF_LITERALSTRINGSTART, PDF_LOCATION, PDF_LZWDECODE, PDF_M, PDF_MAC, PDF_MARKINFO, PDF_MATRIX, PDF_MAXLEN, PDF_MAXWIDTH, PDF_MEDIABOX, PDF_METADATA, PDF_MISSINGWIDTH, PDF_MK, PDF_MODDATE, PDF_N, PDF_NAME, PDF_NAMED, PDF_NAMED_ACT_FIND, PDF_NAMED_ACT_OPEN, PDF_NAMED_ACT_PRINT, PDF_NAMED_ACT_SEARCH, PDF_NAMES, PDF_NAMESTART, PDF_NEEDAPPEARANCES, PDF_NEWLINE, PDF_NEWWINDOW, PDF_NEXT, PDF_NEXT_PAGE, PDF_NO_COMP_OBJ, PDF_NONFULLSCREEN_PAGEMODE, PDF_NULL, PDF_O, PDF_OBJ, PDF_OBJSTREAM, PDF_OCPROPERTIES, PDF_OFF, PDF_ONECOLUMN, PDF_OPEN, PDF_OPEN_ACTION, PDF_OPT, PDF_OUTLINES, PDF_OUTPUTINTENTS, PDF_OUTWARD, PDF_P, PDF_PAGE, PDF_PAGECLOSE, PDF_PAGEINVISIBLE, PDF_PAGELABELS, PDF_PAGELAYOUT, PDF_PAGEMODE, PDF_PAGEOPEN, PDF_PAGES, PDF_PAGEVISIBLE, PDF_PAINT_TYPE, PDF_PARAMS, PDF_PARENT, PDF_PATTERN, PDF_PATTERN_TYPE, PDF_PBD, PDF_PC, PDF_PDC, PDF_PDF, PDF_PERMS, PDF_PFD, PDF_PH, PDF_PIECEINFO, PDF_POLYGONANNOT, PDF_POLYLINEANNOT, PDF_POPUP, PDF_PREDICTOR, PDF_PREV, PDF_PREV_PAGE, PDF_PROCSET, PDF_PRODUCER, PDF_PROPERTIES, PDF_PUSH, PDF_PV, PDF_Q, PDF_QUADPOINTS, PDF_R, PDF_R2L, PDF_RC, PDF_RD, PDF_RE, PDF_REASON, PDF_RECALCULATE, PDF_RECT, PDF_REMOTEGOTO_ACTION, PDF_RENDITIONS, PDF_REPLACE, PDF_RESET_FORM, PDF_RESOURCES, PDF_RESTORE_GS, PDF_RI, PDF_ROOT, PDF_ROTATE, PDF_RUNLENGTH, PDF_RUNLENGTH_NEW, PDF_S, PDF_SCN, PDF_SHADING, PDF_SHOWIMG, PDF_SHOWTEXT, PDF_SHOWTEXT_TJ, PDF_SIG, PDF_SIG_FILTER_ADOBE_PPKLITE, PDF_SIG_FILTER_ADOBE_PPKMS, PDF_SIG_SUBFILTER_ADBE_PKCS7_DETACHED, PDF_SIG_SUBFILTER_ADBE_PKCS7_SHA1, PDF_SINGLE_QUOTES, PDF_SINGLEPAGE, PDF_SIZE, PDF_SP, PDF_SPIDERINFO, PDF_SPLIT, PDF_SQUAREANNOT, PDF_SQUIGGLY, PDF_SS, PDF_STAMPANNOT, PDF_STARTXREF, PDF_StmF, PDF_STORE_GS, PDF_STREAM, PDF_StrF, PDF_STRIKEOUT, PDF_STRUCT_TREE, PDF_SUBFILTER, PDF_SUBMIT_FORM, PDF_SUBTYPE, PDF_T, PDF_TAB, PDF_TEMPLATES, PDF_TEXT, PDF_TEXTANNOT, PDF_TEXTCHARSPACE, PDF_TEXTDIMENSION, PDF_TEXTFONT, PDF_TEXTHORIZONTALSCALE, PDF_TEXTLEAD, PDF_TEXTMATRIX, PDF_TEXTNEWLINESTART, PDF_TEXTRENDER, PDF_TEXTWORDSPACE, PDF_THREADS, PDF_THUMB, PDF_TILING_TYPE, PDF_TITLE, PDF_TJ_OPERAND_END, PDF_TJ_OPERAND_START, PDF_TM, PDF_TOUNICODE, PDF_TP, PDF_TRAILER, PDF_TRANSITION, PDF_TRIMBOX, PDF_TRUE, PDF_TRUETYPE, PDF_TU, PDF_TWOCOLUMN_LEFT, PDF_TWOCOLUMN_RIGHT, PDF_TWOPAGE_LEFT, PDF_TWOPAGE_RIGHT, PDF_TX, PDF_TYPE, PDF_TYPE0, PDF_TYPE1, PDF_U, PDF_UNCOVER, PDF_UNDERLINE, PDF_UNIX, PDF_URI_ACTION, PDF_URL, PDF_URLS, PDF_USEATTACHMENTS, PDF_USENONE, PDF_USEOC, PDF_USEOUTLINES, PDF_USETHUMBS, PDF_V, PDF_VALUECHANGE, PDF_VERSION, PDF_VERT_STEM, PDF_VERTICAL, PDF_VERTICES, PDF_VIEWER_PREFERENCES, PDF_W, PDF_WATERMARKANNOT, PDF_WIDGET, PDF_WIDTH, PDF_WIDTHS, PDF_WINANSIENCODING, PDF_WIPE, PDF_X, PDF_XML, PDF_XOBJECT, PDF_XREF, PDF_XREFSTMOFFSET, PDF_XREFSTREAM, PDF_XSTEP, PDF_XYZ, PDF_YES, PDF_YSTEP, PIXEL_PER_INCH, RUBICON_EMBEDDED, SITE, TEXT, TWIPS_TO_POINTS
Constructor and Description |
---|
PdfDocument()
Constructs a new instance of the class.
|
PdfDocument(PdfReader r)
Deprecated.
Constructs a new
PdfDocument with a
PdfReader object. The new PdfDocument
object is used to read/modify an existing file - reading mode. |
PdfDocument(PdfWriter w)
Deprecated.
Constructs a new
PdfDocument object with a
PdfWriter object. The new PdfDocument
object is used to create a new PDF file - creation mode. |
Modifier and Type | Method and Description |
---|---|
void |
add(PdfPage p)
Adds specified
PdfPage to this
PdfDocument . |
void |
add(PdfPage p,
boolean setAsCurrentPage)
Adds specified
PdfPage to this
PdfDocument and, if setAsCurrentPage
is true, sets the PdfPage as the
PdfDocument 's current page. |
void |
addAction(int namedAction)
Adds a
named
action that needs to be executed by
viewer
applications when they display the document.
|
void |
addAction(int actionType,
int pageNum)
Adds a
go-to
action to the document.
|
void |
addAction(int actionType,
int pageNum,
float x,
float y,
float zoomPercentage)
Adds a go-to action of specified type to specified page with destination set to specified
location and magnification.
|
void |
addAction(int event,
int actionType,
String javascript)
Adds a
Javascript action to specified document-level event.
|
void |
addAction(int actionType,
String javascriptOrURI)
Sets this document to execute action specified by
javascriptOrURI when the document is displayed. |
void |
addAction(int actionType,
String applicationToLaunch,
boolean isPrint,
String parameterToApplication)
Add a document-level action for launching a specified
application with specified parameters or open/print specified
document.
|
void |
addAction(PdfGotoAction gotoAction)
Adds specified document-level
go-to PDF
action to document.
|
void |
addAnnotation(PdfAnnot annotation,
int pageNo)
Adds specified annotation to specified page.
|
void |
addAnnotationList(List annotList,
int pageNo)
Adds a specified list of annotations to a specified page.
|
void |
addAnnotationList(List annotList,
int pageNo,
boolean removeExistingAnnots)
Adds a specified list of annotations to a specified page, and
removes or keeps existing annotations.
|
void |
addAnnotationList(List annotList,
String[] pageRanges,
boolean removeExistingAnnots,
int measurementUnit)
Adds specified list of annotations to specified pages at
locations in specified measurement unit, and also remove or
keep existing annotations in the document.
|
void |
addAnnotationList(List annotList,
String[] pageRanges,
int measurementUnit)
Adds specified list of annotations to specified pages at
locations in specified measurement unit.
|
PdfBookmark |
addBookmark(int namedAction,
String title,
PdfBookmark parent)
Returns a new child bookmark (added under
parent )
with specified title, and sets the bookmark to perform
specified named action. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo)
Returns a new child bookmark (added under
parent )
with specified title, and sets the bookmark to lead to
specified page. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo,
double left,
double top,
double zoom)
Returns a new child bookmark (added under
parent )
with specified title, and sets the bookmark to lead to
specified location on specified page with specified zoom. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo,
double x,
double y,
double width,
double height)
Returns a new child bookmark (added under
parent ),
and sets the bookmark's
destination
to a rectangular area with specified top-left corner
(x , y ), width and height. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo,
double pos,
int fit)
Returns a new child bookmark (added under
parent ),
and sets the bookmark's destination specified by
pageNo , pos and fit . |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo,
int fit)
Returns a new child bookmark (added under
parent )
with specified title, and sets the bookmark's destination
specified by pageNo and fit . |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo,
PdfRect rect)
Returns a new child bookmark (added under
parent )
with specified title and sets the bookmark to lead to specified
rectanglular area on specified page. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
int pageNo,
Rectangle rect)
Returns a new child bookmark (added under
parent )
with specified title, and sets the bookmark to lead to
specified rectangular area on specified page. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
String applicationToLaunch,
boolean print)
Adds a new child bookmark (under
parent ), and sets
it to launch a specified application or print a specified file. |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
String javascriptOrURI,
int actionType)
Adds a new child bookmark (under
parent ) and sets
it execute a Javascript script or resolve a URI (Uniform
Resource Identifier). |
PdfBookmark |
addBookmark(String title,
PdfBookmark parent,
String pdfFileName,
int pageNo,
boolean newWindow)
Returns a new child bookmark (added under
parent ),
and sets it to open a specified page on a specified PDF
document in the same window or a new window of the viewer. |
void |
addDefaultFormFont(PdfFont font) |
void |
addDefaultFormFontList(List fontList) |
void |
addFooterImage(PdfImage img,
int position,
boolean underlay,
String pageRange)
Adds
PdfImage object to footer of pages in
specified page range. |
void |
addFooterImage(String path,
int position,
boolean underlay,
String pageRange)
Adds image, specified by its pathname, to footer of pages in
specified page range.
|
void |
addFooterText(String text,
PdfFont font,
int position,
boolean underlay,
String pageRange)
Adds specified text to footer of pages in specified page range.
|
void |
addFooterText(String text,
PdfFont font,
PdfRect rect,
int alignment,
int firstLinePosition,
int position,
boolean underlay,
String pageRange)
Adds a text footer to a specfied page range with specified
font, first-line position, vertical/horizontal alignment, and
underlay settings.
|
void |
addFormField(PdfFormField formField,
int pageNo)
Add specified form field to specified page.
|
void |
addFormField(PdfFormField f,
String[] pageRanges)
Adds children of specified form field (radio button group or
check box group) to a specified page ranges.
|
void |
addFormFieldList(List formFieldList,
int pageNo)
Add a list of form field to a specified page.
|
void |
addHeaderImage(PdfImage img,
int position,
boolean underlay,
String pageRange)
Adds a
PdfImage object to header of pages in
specified page range. |
void |
addHeaderImage(String path,
int position,
boolean underlay,
String pageRange)
Adds image, specified by its pathname, to footer of pages in
specified page range.
|
void |
addHeaderText(String text,
PdfFont font,
int position,
boolean underlay,
String pageRange)
Adds specified text to header of pages in specified page range.
|
void |
addHeaderText(String text,
PdfFont font,
PdfRect rect,
int alignment,
int firstLinePosition,
int position,
boolean underlay,
String pageRange)
Adds specified text as a header on a specified rectangular area
in specified pages with specified font, alignment, first-line
position, vertical/horizontal position, and underlay settings.
|
void |
addPageBreak()
In document-creation mode, this method adds a new page and makes it the
current page for subsequent rendering operations; (in document
reading mode,) makes the next page as the current page for
subsequent rendering operations.
|
void |
addPdfDocumentChangeHandler(PdfDocumentChangeHandler pdfDocumentChangeHandler)
Ensures that the specified user class instance is notified when
the document object opens or closes a PDF document.
|
void |
addSignature(PdfSignature pdfSignature)
Adds specified digital signature to the document.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum)
Adds a hidden signature to the document using digital
certificate loaded from specified file.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
Date timeStamp)
Adds a hidden signature with specified timestamp to the
document using digital certificate loaded from specified file.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
Date timeStamp,
String fieldName,
PdfRect fieldRect)
Adds a signature form field at specified location and with
specified timestamp.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
Date timeStamp,
String fieldName,
PdfRect fieldRect,
Color backgroundColor,
PdfFont font)
Adds a signature form field with specified background color and
font.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
Date timeStamp,
String fieldName,
PdfRect fieldRect,
PdfAppearanceStream fieldAppearanceStream)
Adds a signature form field with specified background color,
font and appearance stream.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
String fieldName)
Adds a hidden signature on specified page with specified field
name, reason, location, and contact information.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
String fieldName,
PdfRect fieldRect)
Adds a signature form field at specified location.
|
void |
addSignature(String PFXFileName,
String PFXPassword,
String reason,
String location,
String contactInfo,
int pageNum,
String fieldName,
PdfRect fieldRect,
Color backgroundColor,
PdfFont font)
Adds a signature form field at specified location with
specified background color and font.
|
void |
addTable(PdfTable table,
double x,
double y,
int pageNo)
Renders a specified table at a specfied location on specified
page.
|
void |
addTable(PdfTable table,
double x,
double y,
int pageNo,
PdfFont f)
Renders a specified table at a specfied location on specified
page with specified font.
|
void |
addThumbnailImage(String path,
int pageNo)
Adds specified image as thumbnail for specified page.
|
void |
addToFiltersList(int filter)
Adds a filter to the list of filters used to encode stream
objects in this document.
|
void |
addWatermarkImage(PdfImage image,
int position,
boolean applyPageMargins,
double angle,
boolean underlay,
String pageRange)
Adds
PdfImage object as watermark with its exact
position determined by position and
applyPageMargins . |
void |
addWatermarkImage(PdfImage image,
int position,
double angle,
boolean underlay,
String pageRange)
Adds
PdfImage object as watermark on pages in
specified page range. |
void |
addWatermarkImage(String path,
int position,
boolean applyPageMargins,
double angle,
boolean underlay,
String pageRange)
Adds image, specified by its pathname, as watermark with its
exact position determined by
position and
applyPageMargins on pages in specified page range. |
void |
addWatermarkImage(String path,
int position,
double angle,
boolean underlay,
String pageRange)
Adds image, specified by its pathname, as watermark on pages in
specified page range.
|
void |
addWatermarkText(String text,
PdfFont font,
int position,
boolean applyPageMargins,
double angle,
boolean underlay,
String pageRange)
Adds specified text as watermark with its exact position
determined by
position and
applyPageMargins on pages in specified page range. |
void |
addWatermarkText(String text,
PdfFont font,
int position,
double angle,
boolean underlay,
String pageRange)
Adds specified text as watermark on pages in specified page
range.
|
void |
addWatermarkText(String text,
PdfFont font,
PdfRect rect,
int alignment,
int firstLinePosition,
int position,
double angle,
boolean underlay,
String pageRange)
Adds specified text as a watermark to a specified rectangular
area on a specified pages with specified font, alignment,
first-line position, position, rotation, and underlay settings.
|
void |
appendPagesFrom(PdfDocument d,
String pageRange)
Extracts specified pages from a specified document and then
appends them to this document.
|
void |
appendPagesFrom(String path,
String pageRange)
Extracts specified pages from a document (specified by its
pathname) and then appends them to this document.
|
void |
attachDocument(PdfFileAttachment fa)
Adds specified file attachment to the document.
|
void |
attachDocument(String fileName)
Adds specified file as a document-level attachment.
|
void |
attachDocument(String fileName,
boolean compressAttachmentStream)
Adds specified file as a document-level attachment and compresses it if
specified.
|
void |
attachDocument(String attachmentName,
byte[] bs)
Adds file in specified byte array as a document-level attachment.
|
void |
attachDocument(String attachmentName,
byte[] bs,
boolean compressAttachmentStream)
Adds file in specified byte array as a document-level attachment and
compress it if specified.
|
void |
close()
Closes loaded document and frees I/O resources associated with
it.
|
void |
deleteAnnotations()
Delete all annotations in this document.
|
void |
deleteAnnotations(int type)
Delete all annotations of specified type in the document.
|
void |
deleteAnnotationsOnPage(int pageNo)
Delete all annotations on specified page.
|
void |
deleteAnnotationsOnPage(int pageNo,
int type)
Deletes all annotations of specified in specified page.
|
void |
deleteFormFields()
Removes all form fields in the document.
|
void |
deleteFormFields(int type)
Removes all form fields of specified type in the document.
|
void |
deleteFormFields(String name)
Removes all form fields with specified name in the document.
|
void |
deleteFormFieldsOnPage(int pageNo)
Removes all form fields on specified page.
|
void |
deleteFormFieldsOnPage(int pageNo,
int type)
Removes all form fields of specified type on specified page.
|
void |
deleteFormFieldsOnPage(int pageNo,
String name)
Removes all form fields with specified name in specified page.
|
void |
deletePages(String pageRange)
Deletes pages in specified page range from this
PdfDocument . |
void |
disableAllMargins(String pageRange)
Disables all margins on pages in specified page range.
|
void |
drawArc(PdfRect rect,
double startAngle,
double arcAngle)
Draws an arc on the current page of this
PdfDocument . |
void |
drawArc(PdfRect rect,
double startAngle,
double arcAngle,
String pageRange)
Draws an arc on pages in specified page range.
|
void |
drawBezierCurve(double startX,
double startY,
double ctrlX,
double ctrlY,
double endX,
double endY,
boolean isFill,
boolean isStroke)
Draws a Bézier curve with a single control point on
current page of this
PdfDocument . |
void |
drawBezierCurve(double startX,
double startY,
double ctrlX,
double ctrlY,
double endX,
double endY,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a Bézier curve with a single control point on
pages in specified page range in this
PdfDocument . |
void |
drawBezierCurve(double startX,
double startY,
double ctrlX1,
double ctrlY1,
double ctrlX2,
double ctrlY2,
double endX,
double endY,
boolean isFill,
boolean isStroke)
Draws a Bézier curve with two control points on current
page of this
PdfDocument . |
void |
drawBezierCurve(double startX,
double startY,
double ctrlX1,
double ctrlY1,
double ctrlX2,
double ctrlY2,
double endX,
double endY,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a Bézier curve with two control points on pages in
specified page range on this
PdfDocument . |
void |
drawCircle(double x,
double y,
double radius,
boolean isFill,
boolean isStroke)
Draws a circle with specified radius on this
PdfDocument 's current page. |
void |
drawCircle(double x,
double y,
double radius,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a circle with specified radius on pages in specified page
range on this
PdfDocument . |
void |
drawEllipse(double x1,
double y1,
double x2,
double y2,
boolean isFill,
boolean isStroke)
Draws an ellipse on this
PdfDocument 's current
page. |
void |
drawEllipse(double x1,
double y1,
double x2,
double y2,
boolean isFill,
boolean isStroke,
String pageRange)
Draws an ellipse on pages in specified page range on this
PdfDocument 's current page. |
void |
drawImage(PdfImage img,
double x,
double y)
Draws specified image at position (
x ,
y ) on this PdfDocument 's current
page. |
void |
drawImage(PdfImage img,
double x,
double y,
boolean scaleToFit,
boolean stretch)
Renders specified image at position (
x ,
y ) with specified stretching and aspect ratio
settings on the document's current page. |
void |
drawImage(PdfImage img,
double x,
double y,
boolean scaleToFit,
boolean stretch,
String pageRange)
Renders specified image at position (
x ,
y ) with specified stretching and aspect ratio
settings on specified pages. |
void |
drawImage(PdfImage img,
double x,
double y,
double rotation)
Draws specified image rotated by
rotation degrees
at position (x , y ) on this
PdfDocument 's current page. |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height)
Draws specified image at position (
x ,
y ) with specified height and width on this
PdfDocument 's current page. |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
boolean preserveAspectRatio) |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
boolean preserveAspectRatio,
String pageRange)
Draws specified image at specified location on specified pages
with specified aspect ratio setting
|
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation)
Draws specified image rotated by
rotation degrees
at position (x , y ) with specified
height and width on this PdfDocument 's current
page. |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio)
Draw specified image at specified position with specified
dimensions rotation and aspect ratio setting on the current page
of the document.
|
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio,
String pageRange)
Draws PDF image at specified location on specified pages with
specified dimensions, rotation and apsect ratio setting.
|
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio,
String pageRange,
int positionOfRotation) |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
String pageRange)
Draws specified image rotated by
rotation degrees
at position (x , y ) with specified
height and width on pages in specified page range. |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
String pageRange,
int positionOfRotation) |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
String pageRange)
Draws specified image at position (
x ,
y ) with specified height and width on pages in
specified page range. |
void |
drawImage(PdfImage img,
double x,
double y,
double rotation,
String pageRange)
Draws specified image rotated by
rotation degrees at
position (x , y ) on pages in specified
page range. |
void |
drawImage(PdfImage img,
double x,
double y,
String pageRange)
Draws specified image at position (
x , y )
on pages in specified page range. |
void |
drawImage(PdfImage img,
PdfPoint pt)
Draws specified image at specified point on this
PdfDocument 's current page. |
void |
drawImage(PdfImage img,
PdfPoint pt,
double rotation)
Draws specified image rotated by
rotation degrees
at specified point on this PdfDocument 's current
page. |
void |
drawImage(PdfImage img,
PdfPoint pt,
double width,
double height)
Draws specified image at specified point with specified width
and height on this
PdfDocument 's current page. |
void |
drawImage(PdfImage img,
PdfPoint pt,
double width,
double height,
double rotation)
Draws specified image rotated by
rotation degrees
at specified point on this PdfDocument 's current
page. |
void |
drawImage(PdfImage img,
PdfPoint pt,
double width,
double height,
double rotation,
String pageRange)
Draws specified image rotated by
rotation degrees
at specified point with specified width and height on pages in
the specified page range. |
void |
drawImage(PdfImage img,
PdfPoint pt,
double width,
double height,
String pageRange)
Draws specified image at specified point with specified width
and height on pages in the specified page range.
|
void |
drawImage(PdfImage img,
PdfPoint pt,
double rotation,
String pageRange)
Draws specified image rotated by
rotation degrees
at specified point on pages in the specified page range. |
void |
drawImage(PdfImage img,
PdfPoint pt,
String pageRange)
Draws specified image at specified point on pages in specified
page range.
|
void |
drawImage(PdfImage img,
PdfRect rect)
Draws specified image inside specified rectangle on this
PdfDocument 's current page. |
void |
drawImage(PdfImage img,
PdfRect rect,
boolean preserveAspectRatio,
String pageRange)
Draw specified image on speciction region on specified pages with
specified aspect ratio setting.
|
void |
drawImage(PdfImage img,
PdfRect rect,
double rotation)
Draws specified image rotated by
rotation degrees
inside specified rectangle on this PdfDocument 's
current page. |
void |
drawImage(PdfImage img,
PdfRect rect,
double rotation,
boolean preserveAspectRatio)
Draw specified image in specified region with specified rotation
and aspect ratio control.
|
void |
drawImage(PdfImage img,
PdfRect rect,
double rotation,
boolean preserveAspectRatio,
String pageRange)
Draw specified image in specified region on specified pages with
specified rotation and aspect ratio control.
|
void |
drawImage(PdfImage img,
PdfRect rect,
double rotation,
String pageRange)
Draws specified image rotated by
rotation degrees
inside specified rectangle on pages in specified range. |
void |
drawImage(PdfImage img,
PdfRect rect,
String pageRange)
Draws specified image inside specified rectangle on pages in
specified page range.
|
void |
drawImage(String path,
double x,
double y)
Draws image specified by its pathname at position (
x , y ) on this
PdfDocument 's current page. |
void |
drawImage(String path,
double x,
double y,
double rotation)
Draws image specified by its pathname rotated at
rotation degrees at position (x ,
y ) on this PdfDocument 's current
page. |
void |
drawImage(String path,
double x,
double y,
double width,
double height)
Draws image specified by its pathname at position (x, y) with
specified width and height on this
PdfDocument 's
current page. |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
boolean preserveAspectRatio,
String pageRange)
Draw image with specified pathname at specified location on
specified pages with specified dimensions and aspect ratio
setting.
|
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation)
Draws image specified by its pathname rotated by
rotation degrees at position (x ,
y ) with specified width and height on this
PdfDocument 's current page. |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio,
String pageRange)
Draws image with specified pathname at specified location
on specified pages with specified dimensions and aspect ratio
setting
|
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio,
String pageRange,
int positionOfRotation) |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
String pageRange)
Draws image specified by its pathname rotated by
rotation degrees at position (x ,
y ) with specified width and height on pages in
specified page range. |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
String pageRange,
int positionOfRotation) |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
String pageRange)
Draws image specified by its pathname at position (
x , y )with specified width and height
on pages in specified page range. |
void |
drawImage(String path,
double x,
double y,
double rotation,
String pageRange)
Draws image specified by its pathname rotated by
rotation degrees at position (x ,
y )on pages in specified range. |
void |
drawImage(String path,
double x,
double y,
String pageRange)
Draws image specified by its pathname at position (
x , y ) on pages in specified page
range. |
void |
drawImage(String path,
PdfPoint pt)
Draws image specified by its pathname at specified point on
this
PdfDocument 's current page. |
void |
drawImage(String path,
PdfPoint pt,
double rotation)
Draws image specified by its pathname rotated by
rotation degrees at specified point on this
PdfDocument 's current page. |
void |
drawImage(String path,
PdfPoint pt,
double width,
double height)
Draws image specified by its pathname at specified point with
specified width and height on this
PdfDocument 's
current page. |
void |
drawImage(String path,
PdfPoint pt,
double width,
double height,
double rotation)
Draws image specified by its pathname rotated by
rotation degrees at specified point with specified
width and height on this PdfDocument 's current
page. |
void |
drawImage(String path,
PdfPoint pt,
double width,
double height,
double rotation,
String pageRange)
Draws image specified by its pathname rotated by
rotation degrees at specified position with
specified width and height on pages in specified page range. |
void |
drawImage(String path,
PdfPoint pt,
double width,
double height,
String pageRange)
Draws image specified by its pathname at specified position
with specified width and height on pages in specified range.
|
void |
drawImage(String path,
PdfPoint pt,
double rotation,
String pageRange)
Draws image specified by its pathname rotated by
rotation degrees at specified point on pages in
specified range. |
void |
drawImage(String path,
PdfPoint pt,
String pageRange)
Draws image specified by its pathname at specified point on
pages in specified page range.
|
void |
drawImage(String path,
PdfRect rect)
Draws image specified by its pathname inside specified
rectangle on this
PdfDocument 's current page. |
void |
drawImage(String path,
PdfRect rect,
double rotation)
Draws image specified by its pathname rotated by
rotation degrees inside specified rectangle on
this PdfDocument 's current page. |
void |
drawImage(String path,
PdfRect rect,
double rotation,
String pageRange)
Draws image specified by its pathname rotated by
rotation degrees inside specified rectangle on
pages in specified page range. |
void |
drawImage(String path,
PdfRect rect,
String pageRange)
Draws image specified by its pathname inside specified
rectangle on pages in specified page range.
|
void |
drawLine(double startx,
double starty,
double endx,
double endy)
Draws a line between position (
startx ,
starty ) and (endx , endy )
on this PdfDocument 's current page. |
void |
drawLine(double startx,
double starty,
double endx,
double endy,
String pageRange)
Draws a line between position (
startx ,
starty ) and (endx , endy )
on pages in specified page range. |
void |
drawLine(PdfPoint start,
PdfPoint end)
Draws a line from
start to end on
this PdfDocument 's current page. |
void |
drawLine(PdfPoint start,
PdfPoint end,
String pageRange)
Draws a line from
start to end on
pages in specified page range. |
void |
drawPie(double x,
double y,
double width,
double height,
double startAngle,
double arcAngle,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a pie segment on pages in specified page range.
|
void |
drawPie(int x,
int y,
int width,
int height,
double startAngle,
double arcAngle,
boolean isFill,
boolean isStroke)
Draws a pie segment on this
PdfDocument 's current
page. |
void |
drawPolygon(double[] xPoints,
double[] yPoints,
int nPoints,
boolean isFill,
boolean isStroke)
Draws a polygon on this
PdfDocument 's current
page. |
void |
drawPolygon(double[] xPoints,
double[] yPoints,
int nPoints,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a polygon on pages in specified page range.
|
void |
drawPolyline(double[] xPoints,
double[] yPoints,
int nPoints)
Draws a polyline on this
PdfDocument 's current
page. |
void |
drawPolyline(double[] xPoints,
double[] yPoints,
int nPoints,
String pageRange)
Draws a polyline on pages in specified page range.
|
void |
drawRect(double x,
double y,
double width,
double height)
Draws a rectangle at position (
x , y )
with specified width and height on
this PdfDocument 's current page. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean isFill,
boolean isStroke)
Draws a rectangle on this
PdfDocument 's current
page at position (x , y ) with
specified width , height , pen, and
brush settings. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a rectangle on pages in specified page range page at
position (
x , y ) with specified
width , height , brush, and pen
settings. |
void |
drawRect(double x,
double y,
double width,
double height,
String pageRange)
Draws a rectangle at position (
x , y )
with specified width and height on
pages in specified page range. |
void |
drawRect(PdfRect r)
Draws rectangle
r on this PdfDocument
's current page. |
void |
drawRect(PdfRect r,
String pageRange)
Draws specified
PdfRect object on pages in
specified page range. |
void |
drawRect(Rectangle r)
Draws specified
Rectangle object on this
PdfDocument 's current page. |
void |
drawRect(Rectangle r,
String pageRange)
Draws specified
Rectangle object on pages in
specified page range. |
void |
drawRoundRect(double x,
double y,
double width,
double height,
double arcWidth,
double arcHeight,
boolean isFill,
boolean isStroke)
Draws a rectangle with rounded corners on this
PdfDocument 's current page. |
void |
drawRoundRect(double x,
double y,
double width,
double height,
double arcWidth,
double arcHeight,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a rectangle with rounded corners on pages in specified
page range.
|
void |
drawSquare(double x,
double y,
double length)
Draws a square on this
PdfDocument 's current page. |
void |
drawSquare(double x,
double y,
double length,
boolean isFill,
boolean isStroke)
Draws a square with specified brush and pen settings on this
PdfDocument 's current page. |
void |
drawSquare(double x,
double y,
double length,
boolean isFill,
boolean isStroke,
String pageRange)
Draws a square with specified pen and brush settings on pages
in specified page range.
|
void |
drawSquare(double x,
double y,
double length,
String pageRange)
Draws a square on pages in specified page range.
|
void |
embedFont(PdfFont fontToBeEmbedded)
Embeds specified font in the document.
|
void |
embedFont(PdfFont fontToBeEmbedded,
String originalFont)
Embeds specified font in place of another font already existing
in the document.
|
void |
enableAllMargins(String pageRange)
Enables all margins on pages in specified page range.
|
void |
enumPageElements(int pageNum,
int elementTypes,
PdfEnumPageElementsHandler pdfEnumPageElementsHandler)
Parse contents of specified page and call
onEnumPageElements() event handler of specified user-class
instance whenever a page element of specified type is
encountered. |
void |
enumPageElements(String pageRange,
int elementTypes,
PdfEnumPageElementsHandler pdfEnumPageElementsHandler)
Parse contents of specified pages and call
onEnumPageElements() event handler of specified user-class
instance whenever a page element of specified type is
encountered. |
void |
exportToFDF(File fdfFile)
Writes interactive forms data of the PDF document to an FDF
(Forms Data Format) file.
|
void |
extractPagesTo(String path,
String pageRange)
Extracts pages in specified page range and places them in a
file specified by its pathname.
|
void |
extractPagesTo(String path,
String pageRange,
String extractAsVersion,
boolean openAfterExtraction)
Extracts pages in specified page range in specified PDF version
and places them in a new file specified by its pathname.
|
List |
extractText(int pageNum)
Returns a list containing lines of text extracted from
specified page.
|
List |
extractText(String pageRange,
boolean insertPageBreak)
Returns a list containing lines of text extracted from
specified pages.
|
PdfSearchElement |
findFirst(String searchString,
int searchMode,
int searchOptions,
int startPageNum,
boolean isSearchForward)
Returns first page element that is found for the search for specified
text.
|
PdfSearchElement |
findNext(PdfSearchElement currentSearchElement)
Returns page element found by the search operation immediately after
specified search element.
|
PdfSearchElement |
findPrevious(PdfSearchElement currentSearchElement)
Returns page element found by the search operation immediately prior to
specified search element.
|
void |
flattenFormFields()
Flattens all form fields in the document.
|
void |
flattenFormFields(boolean flattenWithNewValue)
Flattens all form fields with or without retaining new values.
|
void |
flattenFormFields(int type)
Flatens form fields of specified type.
|
void |
flattenFormFields(int type,
boolean flattenWithNewValue)
Flattens a form field of specified type with or without
retaining new values.
|
void |
flattenFormFields(String name)
Flattens form fields with specified name.
|
void |
flattenFormFields(String name,
boolean flattenWithNewValue)
Flattens form fields having specified name with or without
retaining new values.
|
void |
flattenFormFieldsOnPage(int pageNo)
Flattens all form fields on specified page.
|
void |
flattenFormFieldsOnPage(int pageNo,
boolean flattenWithNewValue)
Flatten form fields on specified page with or without retaining
new values.
|
void |
flattenFormFieldsOnPage(int pageNo,
int type)
Flatten form fields of specified type in specified page.
|
void |
flattenFormFieldsOnPage(int pageNo,
int type,
boolean flattenWithNewValue)
Flattens form fields of specified type on specified page with
or without retaining new values.
|
void |
flattenFormFieldsOnPage(int pageNo,
String name)
Flattens form fields with specified name on specified page.
|
void |
flattenFormFieldsOnPage(int pageNo,
String name,
boolean flattenWithNewValue)
Flattens all form fields with specified name on specified page
with or without applying new values.
|
List |
getAllAnnotations()
Returns a list of all annotations in the document.
|
List |
getAllAnnotations(int type)
Get all annotations of specified type.
|
void |
getAllAnnotations(int type,
List listToPopulate)
Populates a specified list with all annotations of specified
type in the document.
|
void |
getAllAnnotations(List listToPopulate)
Populates a specified list with all annotations in the
document.
|
List |
getAllAnnotationsOnPage(int pageNo)
Returns a list of all annotations in specified page.
|
List |
getAllAnnotationsOnPage(int pageNo,
int type)
Returns a list of annotations of specified type in specified
page.
|
void |
getAllAnnotationsOnPage(int pageNo,
int type,
List listToPopulate)
Populates a specified list with all annotations of specified
type in a specified page.
|
void |
getAllAnnotationsOnPage(int pageNo,
List listToPopulate)
Populates a specified list with all annotations in a specified
page.
|
List |
getAllEmbededFontNames()
Returns a list of names of all embedded fonts in the document.
|
List |
getAllFontBaseNames()
Returns a list of base names of all fonts used in the document.
|
List |
getAllFontBaseNames(String pageRange)
Returns a list of basenames of all fonts used in pages in the
specified page range.
|
List |
getAllFormFields()
Returns a list of all form fields in the document.
|
List |
getAllFormFields(int type)
Returns a list of all form fields of specified type.
|
List |
getAllFormFields(String name)
Returns a list of all form fields with specified name.
|
List |
getAllFormFieldsOnPage(int pageNo)
Returns a list of all form fields on specified page.
|
List |
getAllFormFieldsOnPage(int pageNo,
int type)
Returns a list of all form fields in specified page.
|
List |
getAllFormFieldsOnPage(int pageNo,
String name)
Populates a list of all form fields with specified name in
specified page.
|
ArrayList |
getAttachments()
Returns a list of file attachments in the document.
|
String |
getAuthor()
Returns "author" document property of this document.
|
PdfBookmark |
getBookmarkRoot()
Returns a
PdfBookmark object that points to the
root of the bookmark tree of this PdfDocument . |
Color |
getBrushColor()
Returns default fill color for content-rendering operations on
the document.
|
int |
getCompressionLevel()
Returns constant identifying compression level of this
Pdfdocument . |
Date |
getCreationDate()
Returns "creation date" document property for this property.
|
String |
getCreator()
Returns "creator" document information property of the
document.
|
int |
getDefaultFieldAlignment()
Returns default text alignment for form fields in the document.
|
Color |
getDefaultFormFontColor()
Returns default color for form field text in the document.
|
List |
getDefaultFormFontList() |
PdfEmailHandler |
getEmailHandler()
Returns user-class instance whose PdfEmailHandler events
are set to be called when this document is e-mailed.
|
PdfEmailSettings |
getEmailSettings()
Returns settings with which the document can be set to be
e-mailed after they are saved.
|
PdfEmailSettings |
getEmailSettings(int emailSettingsType)
Returns current settings (of specified type) for e-mailing the
document after changes are saved to it.
|
PdfEncryption |
getEncryptor()
Retrieves current encryption settings of this
PdfDocument . |
PdfBookmark |
getFirstBookmark()
Returns first bookmark in this
PdfDocument 's
document outline. |
PdfFont |
getFont()
Returns default font used to render text elements in the
document.
|
String |
getInputFileName()
Returns name of the file from which the document was loaded.
|
String |
getInputFilePath()
Returns parent directory path of the file from which this
document was loaded.
|
String |
getKeywords()
Returns "keywords" document property of the document.
|
int |
getMeasurementUnit()
Returns default measurement unit currently in use for this
PdfDocument . |
Date |
getModifiedDate()
Return "modified date" documentation property of this document.
|
PdfPage |
getPage(int pageNo)
Returns a
PdfPage object specified by page number
in this document. |
BufferedImage |
getPageAsBufferedImage(int pageNum)
Returns contents of specified page as an image.
|
BufferedImage |
getPageAsBufferedImage(int pageNum,
int scaleToResolution,
double zoomPercentage,
int rotationAngle)
Returns contents of specified page with specified magnification,
pixel density and rotation as an image.
|
BufferedImage |
getPageAsBufferedImage(int pageNum,
int width,
int height)
Returns a buffered image (with specified width and height) of
the contents of specfied page.
|
BufferedImage |
getPageAsBufferedImage(int pageNum,
int width,
int height,
int scaleToResolution)
Returns a buffered image (with specified width and height) of
the contents of specfied page scaled to a specified resolution.
|
BufferedImage |
getPageAsBufferedImage(int pageNum,
int width,
int height,
int scaleToResolution,
double zoom)
Returns contents of specified page (with specified dimensions,
pixel density and magnification) as an image.
|
BufferedImage |
getPageAsBufferedImage(int pageNum,
int width,
int height,
int bufferedImageType,
int scaleToResolution)
Returns a buffered image of specified type (with specified
width and height) of the contents of specfied page scaled to a
specified resolution.
|
BufferedImage |
getPageAsBufferedImage(int pageNum,
int width,
int height,
int bufferedImageType,
int scaleToResolution,
double zoom)
Returns contents of specified page (with specified dimensions, pixel
density and magnification) as an image of specified type.
|
int |
getPageCount()
Returns number of pages in this
PdfDocument . |
List |
getPageElements(int pageNum,
int elementTypes)
Returns a list of page elements of specified type in specified
page.
|
List |
getPageElements(String pageRange,
int elementTypes)
Returns list of all page elements of specified type in
specified page range.
|
int |
getPageLayout()
Returns constant identifying page layout used as default when
opening this document.
|
int |
getPageMode()
Returns constant identifying this
PdfDocument 's
default page mode. |
List |
getPdfFileAttachments()
Returns a list of file attachments in the document.
|
Color |
getPenColor()
Returns default stroking color for content-rendering operations
on the pages of the document.
|
String |
getProducer()
Returns "producer" document property of the document.
|
PdfReader |
getReader()
Deprecated.
No replacement
|
PdfRenderErrorHandler |
getRenderErrorHandler()
Returns current user-class instance whose
onRenderError() event handler has been set to be called by this document
object. |
PdfRenderingOptions |
getRenderingOptions()
Returns current rendering options of the document.
|
String |
getSubject()
Returns "subject" document property of the document.
|
String[] |
getSupportedCompressionTypes(String format)
Returns a list of compression methods used for specified image
format.
|
String |
getTitle()
Returns "title" document property of the document.
|
String |
getVersion()
Returns constant identifying this
PdfDocument 's
PDF version. |
int |
getViewerPreferences()
Returns viewer application preferences of this document.
|
PdfWriter |
getWriter()
Deprecated.
No replacement
|
File |
getWriterOutputFile()
Returns output file specified for this document.
|
String |
getXMLMetadata()
Returns XML metadata of this
PdfDocument . |
void |
importFromFDF(File fileName)
Save interactive forms data imported from a specified FDF
(Forms Data Format) file.
|
void |
insertPagesFrom(com.gnostice.pdfone.PdfStdDocument d,
String pageRange,
int insertAfterPage)
Insert specified pages from a specified document at specified
page position in this document.
|
void |
insertPagesFrom(String path,
String pageRange,
int insertAfterPage)
Insert specified pages from a document (specified by its
pathname) at specified page position in this document.
|
boolean |
isAutoAdjustFieldTextHeight()
Returns whether the size of text inside text box, list box
and combo box form fields will be adjusted by the viewer
application so that the text is fully accommodated inside the
fields without any cropping.
|
boolean |
isAutoPaginate()
Returns whether content-rendering operations are set to paginate
automatically.
|
boolean |
isEmailAfterSave()
Returns whether the document is set to be e-mail after it is
saved.
|
boolean |
isEncrypted()
Returns whether the document is encrypted.
|
boolean |
isImageFomatandCompressionLossless(String imageFormat,
String compressionType)
Returns whether specified compresion method for specified image
format is lossless.
|
boolean |
isLoaded()
Returns whether a document has been loaded.
|
boolean |
isOpenAfterSave()
Returns whether document is set to be executed after data is
saved to file.
|
boolean |
isOverrideFieldAppearanceStreams()
Returns whether text associated with all form fields in the
document are by default displayed by viewer applications.
|
boolean |
isPageEmpty(int pageNum)
Returns whether specfied page is empty.
|
boolean |
isPrintAfterSave()
Returns whether the print command of the OS shell handler for PDF
documents is set to be launched for this document after it is
saved.
|
boolean |
isXFA()
Returns whether the document is a dynamic XFA forms document.
|
void |
load(byte[] byteArray)
Loads a PDF document from a byte array.
|
void |
load(File inFile)
Loads PDF document specified by a java.io.File object.
|
void |
load(FileInputStream fileInputStream)
Loads PDF document specified by a java.io.FileInputStream
object.
|
void |
load(InputStream inputStream)
Loads a PDF document from specified stream.
|
void |
load(String strFilePath)
Loads PDF document in specified path.
|
void |
merge(List docList)
Merges this document with documents in specified list.
|
void |
merge(List docList,
int mergeOptions)
Merges this document with documents in specified list
using specified merging options.
|
void |
merge(PdfDocument d)
Merges this document with another document.
|
void |
merge(PdfDocument d,
int mergeOptions)
Merges this document with another document using
specified merging options.
|
void |
merge(String path)
Merges this document with a document specified by its
pathname.
|
void |
merge(String path,
int mergeOptions)
Merges this document with a document (specified by its
pathname) using specified merging options.
|
void |
redactRegion(String pageRange,
PdfRect boundingRect,
boolean includeIntersectingText,
boolean clipRegion,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redact all text within specified rectangle and if required
remove even characters that fall partially outside the
rectangle.
|
void |
redactRegion(String pageRange,
PdfRect boundingRect,
boolean clipRegion,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redacts all text in specified region in specified pages.
|
void |
redactText(int pageNum,
String searchString,
int searchMode,
int searchOptions)
Redacts all instances of specified text in specified page.
|
void |
redactText(int pageNum,
String searchString,
int searchMode,
int searchOptions,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redacts all instances of specified text in specified page and
fills/strokes the redacted region if specified.
|
void |
redactText(int pageNum,
String searchString,
int searchMode,
int searchOptions,
String replaceString,
PdfFont font,
boolean fontSizeAuto)
Redacts all instances of specified text in specified page and
replace the region with specified replacement text.
|
void |
redactText(int pageNum,
String searchString,
int searchMode,
int searchOptions,
String replaceString,
PdfFont font,
boolean fontSizeAuto,
boolean removeAssociatedAnnotations) |
void |
redactText(String pageRange,
List searchStringList,
int searchMode,
int searchOptions,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redacts all instances of specified text in specified page and
fills/strokes the redacted region if specified.
|
void |
redactText(String pageRange,
List searchStringList,
int searchMode,
int searchOptions,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill,
boolean removeAssociatedAnnotations) |
void |
redactText(String pageRange,
String searchString,
int searchMode,
int searchOptions)
Redacts all instances of specified text in specified pages.
|
void |
redactText(String pageRange,
String searchString,
int searchMode,
int searchOptions,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redacts all instances of specified text in specified pages
and fills/strokes the region if specified.
|
void |
redactText(String pageRange,
String searchString,
int searchMode,
int searchOptions,
PdfPen pen,
PdfBrush brush,
String replaceString,
PdfFont font,
boolean fontSizeAuto,
boolean removeAssociatedAnnotations) |
void |
redactText(String pageRange,
String searchString,
int searchMode,
int searchOptions,
String replaceString,
PdfFont font,
boolean fontSizeAuto)
Redacts all instances of specified text in specified pages and
replace the region with specified replacement text.
|
void |
redactText(String pageRange,
String searchString,
int searchMode,
int searchOptions,
String replaceString,
PdfFont font,
boolean fontSizeAuto,
boolean removeAssociatedAnnotations) |
void |
removeAllAttachments()
Deletes all attachments in the document.
|
void |
removeAllAttachments(String attachmentName)
Deletes all attachments with specified name in the document.
|
void |
removeAllSignaures()
Remove all signatures from the document.
|
void |
removeBookmarkRoot()
Removes all bookmarks existing in the document.
|
void |
removePageLabelsRoot()
Removes all page labels from the document.
|
boolean |
removePdfDocumentChangeHandler(PdfDocumentChangeHandler pdfDocumentChangeHandler)
|
void |
removeThumbnailImage(String pageRange)
Removes thumbnail image for specified pages.
|
void |
renderOnGraphics(int pageNum,
Graphics g)
Renders contents of specified page on specified graphics
object.
|
void |
renderOnGraphics(int pageNum,
Graphics g,
double x,
double y,
double width,
double height)
Renders contents of specified page on a rectangular area
(specified by coordinates of its top left corner, its height
and its width) inside a specified graphics item.
|
void |
renderOnGraphics(int pageNum,
Graphics g,
Point2D position,
double zoom)
Renders contents of specified page at a particular position on
a specified graphics item with specified magnification of the
page contents.
|
void |
renderOnGraphics(int pageNum,
Graphics g,
Point2D position,
double xZoom,
double yZoom)
Renders contents of specified page at specified position on
specified graphics item with specified magnification of height
and width of the page contents.
|
void |
renderOnGraphics(int pageNum,
Graphics g,
Point2D position,
double xZoom,
double yZoom,
double rotation,
double pointOfRotationAboutWidth,
double pointOfRotationAboutHeight)
Renders contents of specified page at specified position on
specified graphics item with specified resolution, and
magnification of width and height of the page contents.
|
void |
renderOnGraphics(int pageNum,
Graphics g,
Point2D position,
double xZoom,
double yZoom,
int scaleToResolution)
Renders contents of specified page at specified position on
specified graphics item with specified resolution, and
magnification of width and height of the page contents.
|
void |
renderOnGraphics(int pageNum,
Graphics g,
Rectangle2D rect)
Renders contents of specified page on a specified rectangular
area on a specified graphics item.
|
void |
replaceAllEmbeddedFonts(PdfFont replaceWithFont)
Replaces all embedded fonts with specified font.
|
void |
replaceEmbeddedFont(String embeddedFontBaseName,
PdfFont replaceWithFont)
Replace specified embedded font with another specified font.
|
long |
save(File outFile)
Save loaded document to specified file object.
|
long |
save(OutputStream outputStream)
Save
loaded document to specified output
stream object. |
long |
save(String outFilePath)
Save loaded document with specified pathname.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
float compressionQuality,
String outputPath)
Saves an image of specified pages in specified format with
specified pathname, and compression quality.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
float compressionQuality,
String outputPath,
int scaleToResolution)
Saves an image of specified pages in specified format with
specified pathname, compression quality and resolution.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
float compressionQuality,
String outputPath,
int scaleToResolution,
double zoom) |
void |
saveAsImage(String format,
String pageRange,
String imageName,
float compressionQuality,
String compressionType,
String outputPath,
int scaleToResolution,
double zoom)
Export specified pages to specified format with specified settings.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
int imageWidth,
int imageHeight,
float compressionQuality,
String outputPath)
Saves image of specified pages in specified format with
specified pathname, width, height, compression type and
compression quality.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
int imageWidth,
int imageHeight,
float compressionQuality,
String outputPath,
int scaleToResolution)
Saves image of specified pages in specified format with
specified pathname, width, height, compression type,
compression quality, and DPI.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
int imageWidth,
int imageHeight,
float compressionQuality,
String compressionType,
String outputPath,
int scaleToResolution)
Export specified pages to specified image format with specified settings.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
String outputPath)
Saves rasterized image of specified pages in specified format
with specified pathname.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
String outputPath,
int scaleToResolution)
Saves rasterized image of specified pages in specified format
with specified pathname and resolution.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
String imageWidth,
String imageHeight,
float compressionQuality,
String outputPath)
Saves image of specified pages in specified format with
specified pathname, width, height, and compression level.
|
void |
saveAsImage(String format,
String pageRange,
String imageName,
String imageWidth,
String imageHeight,
float compressionQuality,
String outputPath,
int scaleToResolution)
Saves image of specified pages in specified format with
specified pathname, width, height, compression level, and
resolution.
|
void |
saveAsText(int pageNum,
Writer writer)
Exports all text of specified page and saves it to specified
writer instance.
|
void |
saveAsText(int pageNum,
Writer writer,
boolean ignoreExtraNewLines)
Exports all text (after ignoring extra blank lines) of
specified page and saves it to specified writer instance.
|
void |
saveAsText(String pageRange,
Writer writer,
boolean insertPageBreak)
Exports all text of specified pages and saves it to specified
writer instance (after ignoring extra blank lines).
|
void |
saveAsText(String pageRange,
Writer writer,
boolean insertPageBreak,
boolean ignoreExtraNewLines)
Exports all text from specified pages (excluding consecutive
blank lines and including a new line for each new page) and
writes to the specified text writer object.
|
void |
saveDocAsTiffImage(String filePath)
Exports the document as a multi-page TIFF image with specified
pathname.
|
void |
saveDocAsTiffImage(String filePath,
int scaleToResolution)
Exports the document as a multi-page TIFF image with specified
pathname and resolution.
|
void |
saveDocAsTiffImage(String filePath,
int tiffCompressionType,
float tiffCompressionQuality)
Exports the document as a multi-page TIFF image with specified
pathname, compression type, and compression quality.
|
void |
saveDocAsTiffImage(String filePath,
int tiffCompressionType,
float tiffCompressionQuality,
int scaleToResolution)
Exports the document as a multi-page TIFF image with specified
pathname, compression type, compression quality, and
resolution.
|
void |
saveDocAsTiffImage(String pageRange,
String filePath)
Exports specified pages as a multi-page TIFF image with
specified pathname.
|
void |
saveDocAsTiffImage(String pageRange,
String filePath,
int scaleToResolution)
Exports specified pages as a multi-page TIFF image with
specified pathname and resolution.
|
void |
saveDocAsTiffImage(String filePath,
String pageRange,
int tiffCompressionType,
float tiffCompressionQuality)
Exports specified pages as a multi-page TIFF image with
specified pathname, compression type, and compression quality.
|
void |
saveDocAsTiffImage(String filePath,
String pageRange,
int tiffCompressionType,
float tiffCompressionQuality,
int scaleToResolution)
Exports specified pages as a multi-page TIFF image with
specified pathname, compression type, compression quality and
resolution.
|
void |
saveDocAsTiffImage(String filePath,
String pageRange,
int tiffCompressionType,
float tiffCompressionQuality,
int scaleToResolution,
double zoom)
Exports specified pages as a multi-page TIFF image with
specified pathname, compression type, compression quality,
scaling, and magnification.
|
void |
saveDocAsTiffImage(String filePath,
String pageRange,
int width,
int height,
int tiffCompressionType,
float tiffCompressionQuality,
int scaleToResolution)
Exports specified pages as a multi-page TIFF image with
specified pathname, widht, height, compression type,
compression quality, scaling.
|
List |
search(int startPageNum,
String searchString,
int searchMode,
int searchOptions)
Returns a list of all lines of text that contain specified search text
string (in and after specified page).
|
List |
search(List searchStringList,
int pageNum,
int searchMode,
int searchOptions)
Returns a list of list of all lines for specified list of
search strings in specified page.
|
List |
search(List searchStringList,
String pageRange,
int searchMode,
int searchOptions)
Returns a list of list of all lines for specified list of
search strings in specified pages.
|
List |
search(String searchString,
int pageNum,
int searchMode,
int searchOptions)
Returns all lines of text that contains specified search string in
specified page.
|
void |
search(String searchString,
int searchMode,
int searchOptions,
PdfSearchHandler pdfSearchHandler,
int startPageNum)
Searches specified search string in specified page and calls
onSearchElement() event handler when a match is found. |
void |
search(String searchString,
int searchMode,
int searchOptions,
PdfSearchHandler pdfSearchHandler,
String pageRange)
Searches specified search string in specified pages and calls
onSearchElement() event handler when a match is found. |
List |
search(String searchString,
String pageRange,
int searchMode,
int searchOptions)
Returns all lines of text that contains specified search string
in specified pages.
|
void |
setAuthor(String s)
Specifies "author" document property for this document.
|
void |
setAutoAdjustFieldTextHeight(boolean autoAdjustFieldTextHeight)
Specifies whether the size of text inside text box, list box
and combo box form fields needs to be adjusted by the viewer
application so that the text is fully accommodated inside the
fields without any cropping.
|
void |
setAutoPageCreationHandler(PdfAutoPageCreationHandler autoPageCreationHandler)
Ensures that the
onAutoPageCreation() event handler of specified user-class
instance is called when a new page is automatically created to
accommodate a content-rendering operation. |
void |
setAutoPaginate(boolean autoPaginate)
Specifies whether content-rendering operations need to paginate
automatically.
|
void |
setBrushColor(Color c)
Specifies default color for this
PdfDocument 's
brush. |
void |
setCompressionLevel(int compressionLevel)
Specifies compression level for this
PdfDocument . |
void |
setCph(PdfCustomPlaceholderHandler cph)
Ensures that the
onCustomPlaceHolder() event handler is called for the
specified user-class instance when a custom placeholder is
encountered in a text-rendering operation. |
void |
setCreationDate(Date date)
Sets "creation date" document information property.
|
void |
setCreator(String s)
Set specified "creator" document information property for this
document.
|
void |
setCropBox(double cropLeft,
double cropTop,
double cropRight,
double cropBottom,
int unit,
String pageRange)
Sets crop
box of specified pages in specified measurement unit.
|
void |
setCropBox(double cropLeft,
double cropTop,
double cropRight,
double cropBottom,
String pageRange)
Sets crop
box of specified pages.
|
void |
setCropBox(PdfRect rect,
int unit,
String pageRange)
Set specified rectangular area in specified measurement unit as
the crop
box for specified pages.
|
void |
setCropBox(PdfRect rect,
String pageRange)
Sets specified rectangular area as the
crop
box for specified pages.
|
void |
setDefaultFieldAlignment(int defualtFieldAlignment)
Specifies default text alignment for form fields in the
document.
|
void |
setDefaultFormFontColor(Color defaultFormFontColor)
Specifies default color for form field text in the document.
|
void |
setDefaultFormFontIndex(int defaultFormFontIndex) |
void |
setDefaultFormFontList(List fontList) |
void |
setEmailAfterSave(boolean emailAfterSave)
Set this document to be e-mailed aftr it is saved.
|
void |
setEmailHandler(PdfEmailHandler pdfEmailHandler)
Sets specified user-class instance whose
PdfEmailHandler
events need to be called when this document is e-mailed. |
void |
setEncryptor(PdfEncryption encrypto)
Specify encryption settings for this
PdfDocument . |
void |
setFont(PdfFont defaultFont)
Specifies default font that needs to be used to render text
elements in the document.
|
void |
setKeywords(String s)
Specifies "keywords" document property for this document.
|
void |
setMeasurementUnit(int measurementUnit)
Specifies default measurement unit to be used for this
PdfDocument . |
void |
setModifiedDate(Date date)
Set "modified date" document information property.
|
void |
setOnBookmarkMerge(PdfBookmarkMergeHandler onBookmarkMerge)
Ensures that the
onBookmarkMerge() event handler of specified user-class
instance is called when the bookmark tree of another document
is merged with that of this document. |
void |
setOnNeedFileName(PdfNeedFileNameHandler pnfnh)
Ensures that the
onNeedFileName() event handler of specified user-class
instance is called when this document is being split and a
splinter document is created. |
void |
setOnPageReadHandler(PdfPageReadHandler onPageReadHandler)
Ensures that the
onPageRead() event handler of specified user-class instance is
called when a new page is read from the document. |
void |
setOnPasswordHandler(PdfPasswordHandler onPasswordHandler)
Ensures that
onPassword() event handler of specified user-class instance is
called when a password is required to read a document. |
void |
setOnRenameField(PdfFormFieldRenameHandler pfrh)
Ensures that the
onRenameField() event handler of specified user-class instance
is called when a duplicate field is encountered in a
document-merge operation. |
void |
setOpenAfterSave(boolean openAfterSave)
Specifies whether document needs to be launched by the
Operating System (OS) shell program (such as explorer.exe in
Windows
™ ) after it is saved to a file. |
void |
setOverrideFieldAppearanceStreams(boolean overrideAppearanceStreams)
Specifies whether text associated with all form fields in the
document need to be displayed by default.
|
void |
setPageLayout(int value)
Specifies default page layout to be used when opening this
document.
|
void |
setPageMode(int value)
Specifies default page mode with which this document needs to be
opened in a viewer application.
|
void |
setPdfObjectWriteListener(PdfObjectWriteListener pdfObjectWriteListener,
int pdfObjectTypes)
Sets up event(s) of specified user-class instance to be called
when a PDF object is written to a document.
|
void |
setPenCapStyle(int capStyle)
Specifies default shape of endpoints of paths in this
PdfDocument . |
void |
setPenColor(Color color)
Specifies default color for this
PdfDocument 's
pen. |
void |
setPenDashGap(double gap)
Specifies length of gaps in default
dash pattern of this
PdfDocument 's pen. |
void |
setPenDashLength(double length)
Specifies length of dashes in default
dash pattern of this
PdfDocument 's pen. |
void |
setPenDashPhase(double phase)
|
void |
setPenJoinStyle(int joinStyle)
Specifies default shape of joints of
paths that
connect at an angle for this
PdfDocument 's pen. |
void |
setPenMiterLimit(int limit)
Specifies default miter limit for this
PdfDocument
's pen. |
void |
setPenWidth(double width)
Specifies default width for this
PdfDocument 's
pen. |
void |
setPrintAfterSave(boolean printAfterSave)
Specifies whether the document needs to be sent to a printer
for printing after it is saved to a file.
|
void |
setProducer(String s)
Deprecated.
No replacement
|
void |
setReader(PdfReader r)
Deprecated.
No replacement
|
void |
setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
Ensures that the
onRenderError() event handler of specified user-class instance is called
whenever a rendering error occurs. |
void |
setRenderingOptions(PdfRenderingOptions renderingOptions)
Set specified rendering options for the document.
|
void |
setSaveAsImageHandler(PdfSaveAsImageHandler saveAsImageHandler)
Ensures that the
onSaveAsImage() event handler of specified user-class instance is
called whenever a page is exported as an image. |
void |
setSubject(String s)
Specifies "subject" document property for this document.
|
void |
setTitle(String s)
Specifies "title" document property for this document.
|
void |
setVersion(String version)
Specifies PDF version of this
PdfDocument . |
void |
setViewerPreferences(int value)
Specifies viewer application preferences for this document.
|
void |
setWriter(PdfWriter w)
Deprecated.
No replacement
|
void |
split(int pages)
Extract specified number of consecutive pages from the PDF
document and place them in new PDF documents.
|
void |
split(String pageRange)
Extracts all pages in the specified page range to a new
document.
|
void |
stitch(int stitchToPageNo,
int stitchFromPageNo,
double offsetX,
double offsetY)
Overlays all content from a specified page to another page with
specified ofsets.
|
void |
stitch(int stitchToPageNo,
int stitchFromPageNo,
double offsetX,
double offsetY,
PdfRect clipRegionInSourcePage) |
void |
substituteFont(String replaceFontWithBaseName,
PdfFont substituteWithFont)
Replaces a font in the document with another font.
|
long |
write()
Deprecated.
Use one of the
save()
overloaded methods instead. |
void |
writeText(String str)
Writes specified text at current position on this
PdfDocument 's current page. |
void |
writeText(String str,
boolean wrap)
Writes specified text with specified wrap setting at current
position on this
PdfDocument 's current page. |
void |
writeText(String str,
boolean wrap,
String pageRange)
Writes specified text with specified wrap setting at current
position on pages in specified page range.
|
void |
writeText(String str,
double x,
double y)
Writes specified text at position (
x ,
y ) on this PdfDocument 's current
page. |
void |
writeText(String str,
double x,
double y,
boolean wrap)
Writes specified text with specified wrap setting at position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
double x,
double y,
boolean wrap,
String pageRange)
Writes specified text with specified wrap setting at position (
x , y ) on pages in specified page
range. |
void |
writeText(String str,
double x,
double y,
double rotation)
Writes specified text rotated by
rotation degrees
at position (x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
double x,
double y,
double rotation,
String pageRange)
Writes specified text rotated by
rotation degrees
at position (x , y ) on pages in
specified page range. |
void |
writeText(String str,
double x,
double y,
int alignment)
Writes specified text with specified alignment at position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
double x,
double y,
int alignment,
boolean wrap)
Writes specified text with specified alignment and wrap setting
at position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
double x,
double y,
int alignment,
boolean wrap,
String pageRange)
Writes specified text with specified alignment and wrap setting
at position (
x , y ) on pages in
specified page range. |
void |
writeText(String str,
double x,
double y,
int alignment,
String pageRange)
Writes specified text with specified alignment at position (
x , y ) on pages in specified range. |
void |
writeText(String str,
double x,
double y,
String pageRange)
Writes specified text at position (
x ,
y ) on pages in specified page range. |
void |
writeText(String str,
int alignment)
Writes specified text with specified alignment at current
position on this
PdfDocument 's current page. |
void |
writeText(String str,
int alignment,
boolean wrap)
Writes specified text with specified alignment and specified
wrap setting at current position on this
PdfDocument 's current page. |
void |
writeText(String str,
int alignment,
boolean wrap,
String pageRange)
Writes specified text with specified alignment and wrap setting
at current position on pages in specified page range.
|
void |
writeText(String str,
int alignment,
String pageRange)
Writes specified text with specified alignment at current
position on pages in specified page range.
|
void |
writeText(String str,
PdfFont f)
Writes specified text with specified font on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
boolean wrap)
Writes specified text with specified wrap setting and font on
this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
boolean wrap,
String pageRange)
Writes specified text with specified font and wrap setting on
pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
double x,
double y)
Writes specified text with specified font at position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
boolean wrap)
Writes specified text with specified font and wrap setting at
position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
boolean wrap,
String pageRange)
Writes specified text with specified font and wrap setting at
position (
x , y ) on pages in specified
page range. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
double rotation)
Writes specified text rotated by
rotation degrees
with specified font at position (x , y
) on this PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
double rotation,
String pageRange)
Writes specified text rotated by
rotation degrees
with specified font at position (x , y
) on pages in specified page range. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
double rotation,
String pageRange,
int positionOfRotation) |
void |
writeText(String str,
PdfFont f,
double x,
double y,
String pageRange)
Writes specified text with specified font at position (
x , y ) on pages in specified page
range. |
void |
writeText(String str,
PdfFont f,
int alignment)
Writes specified text with specified font and alignment on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
int alignment,
boolean wrap)
Writes specified text with specified font, alignment, and wrap
setting on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
int alignment,
boolean wrap,
String pageRange)
Writes specified text with specified font, alignment and wrap
setting on pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
int alignment,
double x,
double y)
Writes specified text with specified font and alignment at
position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
int alignment,
double x,
double y,
boolean wrap)
Writes specified text with specified font, alignment, and
wrapping at position (
x , y ) on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
int alignment,
double x,
double y,
boolean wrap,
String pageRange)
Writes specified text with specified font, alignment, and
wrapping at position (
x , y ) on pages
in specified page range. |
void |
writeText(String str,
PdfFont f,
int alignment,
double x,
double y,
String pageRange)
Writes specified text with specified font and alignment at
position (
x , y ) on pages in specified
page range. |
void |
writeText(String str,
PdfFont f,
int alignment,
PdfPoint pt)
Writes specified text with specified font and alignment at
specified point on this
PdfDocument 's current
page. |
void |
writeText(String str,
PdfFont f,
int alignment,
PdfPoint pt,
boolean wrap)
Writes specified text with specified font, alignment, and wrap
setting at specified point on this
PdfDocument 's
current page. |
void |
writeText(String str,
PdfFont f,
int alignment,
PdfPoint pt,
boolean wrap,
String pageRange)
Writes specified text with specified font, alignment, and wrap
setting at specified point on pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
int alignment,
PdfPoint pt,
String pageRange)
Writes specified text with specified font and alignment at
specified point on pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
int alignment,
String pageRange)
Writes specified text with specified font and alignment on
pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
PdfPoint pt)
Writes specified text with specified font at specified point on
this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
PdfPoint pt,
boolean wrap)
Writes text
str with specified font and wrap
setting at specified point on this PdfDocument 's
current page. |
void |
writeText(String str,
PdfFont f,
PdfPoint pt,
boolean wrap,
String pageRange)
Writes text
str with specified font and wrap
setting at specified point on pages in specified page range. |
void |
writeText(String str,
PdfFont f,
PdfPoint pt,
double rotation)
Writes text
str rotated by rotation
degrees with specified font at specified point on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
PdfPoint pt,
double rotation,
String pageRange)
Writes text
str rotated by rotation
degrees with specified font at specified point on pages in
specified page range. |
void |
writeText(String str,
PdfFont f,
PdfPoint pt,
String pageRange)
Writes specified text with specified font at specified point on
pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
PdfRect rectangle)
Writes specified text with specified font inside specified
rectangle on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
double rotation,
double firstLinePosition)
Writes specified text rotated by
rotation degrees
with specified font and first-line position inside specified
rectangle on this PdfDocument 's current page. |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
double rotation,
double firstLinePosition,
String pageRange)
Writes specified text rotated by
rotation degrees
with specified font and first-line position inside specified
rectangle on pages in specified page range. |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
double rotation,
double firstLinePosition,
String pageRange,
int positionOfRotation) |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
int alignment)
Writes specified text with specified alignment and font inside
specified rectangle on this
PdfDocument 's current
page. |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
int alignment,
double rotation,
double firstLinePosition)
Writes specified text rotated by
rotation degrees
with specified alignment, first-line position, and font inside
specified rectangle on this PdfDocument 's current
page. |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
int alignment,
double rotation,
double firstLinePosition,
String pageRange)
Writes specified text rotated by
rotation degrees
with specified alignment, first-line position, and font inside
specified rectangle on pages in specified page range. |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
int alignment,
double rotation,
double firstLinePosition,
String pageRange,
int positionOfRotation) |
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
int alignment,
String pageRange)
Writes specified text with specified font and alignment inside
specified rectangle on pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
PdfRect rectangle,
String pageRange)
Writes specified text with specified font inside specified
rectangle on pages in specified page range.
|
void |
writeText(String str,
PdfFont f,
String pageRange)
Writes specified text with specified font on pages in specified
page range.
|
void |
writeText(String str,
PdfPoint pt)
Writes specified text at specified point on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfPoint pt,
boolean wrap)
Writes text
str with specified wrap setting at
point pt on this PdfDocument 's
current page. |
void |
writeText(String str,
PdfPoint pt,
boolean wrap,
String pageRange)
Writes text
str with specified wrap setting at
point pt on pages in specified page range. |
void |
writeText(String str,
PdfPoint pt,
double rotation)
Writes text
str , rotated by rotation
degrees, at point pt on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfPoint pt,
double rotation,
String pageRange)
Writes text
str , rotated rotation
degrees, at point pt on pages in specified page
range. |
void |
writeText(String str,
PdfPoint pt,
int alignment,
boolean wrap)
Writes text
str with specified alignment and wrap
setting at point pt on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfPoint pt,
int alignment,
boolean wrap,
String pageRange)
Writes text
str with specified alignment and wrap
setting at point pt on pages in specified page
range. |
void |
writeText(String str,
PdfPoint pt,
String pageRange)
Writes specified text at specified point on pages in specified
page range.
|
void |
writeText(String str,
PdfRect rectangle)
Writes specified text inside specified rectangle on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfRect rectangle,
double rotation,
double firstLinePosition)
Writes specified text rotated by
rotation degrees
with specified first-line position inside specified rectangle
on this PdfDocument 's current page. |
void |
writeText(String str,
PdfRect rectangle,
double rotation,
double firstLinePosition,
String pageRange)
Writes specified text rotated by
rotation degrees
with specified first-line position inside specified rectangle
on pages in specified page range. |
void |
writeText(String str,
PdfRect rectangle,
int alignment)
Writes specified text with specfied text alignment on this
PdfDocument 's current page. |
void |
writeText(String str,
PdfRect rectangle,
int alignment,
double rotation,
double firstLinePosition)
Writes specified text rotated by
rotation degrees
with specified first-line position inside specified rectangle
on this PdfDocument 's current page. |
void |
writeText(String str,
PdfRect rectangle,
int alignment,
double rotation,
double firstLinePosition,
String pageRange)
Writes specified text rotated by
rotation degrees
with specified alignment and first-line position inside
specified rectangle on pages in specified page range. |
void |
writeText(String str,
PdfRect rectangle,
int alignment,
String pageRange)
Writes specified text with specified alignment inside specified
rectangle on pages in specified page range.
|
void |
writeText(String str,
PdfRect rectangle,
String pageRange)
Writes specified text inside specified rectangle on pages in
specified page range.
|
void |
writeText(String str,
Point pt,
int alignment)
Writes specified text at position
pt on current
page with specified text alignment. |
void |
writeText(String str,
Point pt,
int alignment,
String pageRange)
Writes specified text at position
pt with
specified text alignment on all pages of a specified page
range. |
void |
writeText(String str,
String pageRange)
Writes specified text at current position on pages in specified
page range.
|
public static final int ALIGNMENT_LEFT
public static final int ALIGNMENT_CENTER
public static final int ALIGNMENT_RIGHT
public static final int TIFF_Compression_NONE
public static final int TIFF_Compression_CCITT_RLE
public static final int TIFF_Compression_CCITT_T4
public static final int TIFF_Compression_CCITT_T6
public static final int TIFF_Compression_LZW
public static final int TIFF_Compression_JPEG
public static final int TIFF_Compression_ZLib
public static final int TIFF_Compression_PackBits
public static final int TIFF_Compression_Deflate
public static final int TIFF_Compression_EXIF_JPEG
public static final String VERSION_1_4
public static final String VERSION_1_5
public static final String VERSION_1_6
public static final String VERSION_1_7
public static final int MERGE_INCLUDE_ANNOTATIONS
merge(String)
,
Constant Field Valuespublic static final int MERGE_INCLUDE_BOOKMARKS
merge(String)
,
Constant Field Valuespublic static final int MERGE_INCLUDE_DOCUMENT_ACTIONS
merge(String)
,
Constant Field Valuespublic static final int MERGE_INCLUDE_PAGE_ACTIONS
merge(String)
,
Constant Field Valuespublic static final int MERGE_INCLUDE_FORMFIELDS
merge(String)
,
Constant Field Valuespublic static final int MERGE_INCLUDE_ALL
merge(String)
,
Constant Field Valuespublic PdfDocument()
public PdfDocument(PdfWriter w) throws PdfException
PdfDocument
object with a
PdfWriter
object. The new PdfDocument
object is used to create a new PDF file - creation mode.w
- PdfWriter
with which the
PdfProDocument
object needs to be
createdPdfException
- if an illegal argument is supplied.public PdfDocument(PdfReader r) throws IOException, PdfException
PdfDocument
with a
PdfReader
object. The new PdfDocument
object is used to read/modify an existing file - reading mode.r
- PdfReader
with which the
PdfProDocument
object needs to be
createdIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setAutoPaginate(boolean autoPaginate)
autoPaginate
- true if document auto-paginates; false if otherwisepublic boolean isAutoPaginate()
setAutoPaginate(boolean)
public boolean isOverrideFieldAppearanceStreams()
setOverrideFieldAppearanceStreams(boolean)
public void setOverrideFieldAppearanceStreams(boolean overrideAppearanceStreams)
false
, then form fields may display the text
only when they receive user input focus.overrideAppearanceStreams
- whether text associated with all form fields in the
document need to be displayed by defaultisOverrideFieldAppearanceStreams()
public void setAuthor(String s)
s
- "author" document property for this documentgetAuthor()
public String getAuthor()
setAuthor(String)
public void setCreator(String s)
s
- name of the application that needs to be set as the
creator of this documentgetCreator()
public String getCreator()
setCreator(String)
public void setKeywords(String s)
s
- "keywords" document property for this documentpublic String getKeywords()
setKeywords(String)
public void setSubject(String s)
s
- "subject" document property for this documentpublic String getSubject()
setSubject(String)
public void setTitle(String s)
s
- "title" document property for this documentpublic String getTitle()
setTitle(String)
public void setOpenAfterSave(boolean openAfterSave)
™
) after it is saved to a file.
This method is currently supported only in Windows OSs.openAfterSave
- whether document needs to be executed after data is
saved to fileisOpenAfterSave()
,
setPrintAfterSave(boolean)
public boolean isOpenAfterSave()
setOpenAfterSave(boolean)
public void setPrintAfterSave(boolean printAfterSave)
™
Operating Systems.printAfterSave
- whether the document needs to be printed after it is
saved to a filesetOpenAfterSave(boolean)
public boolean isPrintAfterSave()
public void setBrushColor(Color c)
PdfDocument
's
brush.c
- default color for the PdfDocument
's
brushgetBrushColor()
,
setPenColor(Color)
public Color getBrushColor()
setBrushColor(Color)
,
getPenColor()
public void setMeasurementUnit(int measurementUnit)
PdfDocument
.measurementUnit
- constant specifying the new default measurement unitgetMeasurementUnit()
,
PdfMeasurement
public int getMeasurementUnit()
PdfDocument
.setMeasurementUnit(int)
,
PdfMeasurement
public void setPageLayout(int value)
value
- constant specifying the page layoutgetPageLayout()
,
PdfPageLayout
public int getPageLayout()
setPageLayout(int)
,
PdfPageLayout
public void setPageMode(int value)
value
- constant specifying page modegetPageMode()
,
PdfPageMode
public int getPageMode()
PdfDocument
's
default page mode. This page mode is applied by default when
the document is opened in a viewer application.setPageMode(int)
,
PdfPageMode
public void setPenColor(Color color)
PdfDocument
's
pen.color
- default color for the PdfDocument
's pengetPenColor()
,
setBrushColor(Color)
public Color getPenColor()
getBrushColor()
,
setPenColor(Color)
public void setVersion(String version)
PdfDocument
.version
- constant specifying PDF versionpublic String getVersion()
PdfDocument
's
PDF version.public int getViewerPreferences()
PdfPreferences
,
setViewerPreferences(int)
public void setViewerPreferences(int value)
value
- constants specifying viewer application preferencesPdfPreferences
,
getViewerPreferences()
public void addTable(PdfTable table, double x, double y, int pageNo) throws PdfException, IOException
table
- table that needs to be renderedx
- x-coordinate of the location on the page where
top-left corner of the table needs to bey
- y-coordinate of the location on the page where
top-left corner of the table needs to bepageNo
- page where the table needs to be renderedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addTable(PdfTable table, double x, double y, int pageNo, PdfFont f) throws PdfException, IOException
table
- table that needs to be renderedx
- x-coordinate of the location on the page where
top-left corner of the table needs to bey
- y-coordinate of the location on the page where
top-left corner of the table needs to bepageNo
- page where the table needs to be renderedf
- font with which the table needs to be renderedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void stitch(int stitchToPageNo, int stitchFromPageNo, double offsetX, double offsetY) throws PdfException, IOException
stitchToPageNo
- number of the page on which contents from the page
stitchFromPageNo
need to be overlaidstitchFromPageNo
- number of the page whose contents should be overlaid
on page specified by stitchToPageNo
offsetX
- x-coordinate of the position on page
stitchToPageNo
where the top-left
corner of the contents of page
stitchFromPageNo
should be overlaidoffsetY
- y-coordinate of the position on page
stitchToPageNo
where the top-left
corner of the contents of page
stitchFromPageNo
should be overlaidPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void stitch(int stitchToPageNo, int stitchFromPageNo, double offsetX, double offsetY, PdfRect clipRegionInSourcePage) throws PdfException, IOException
PdfException
IOException
public void attachDocument(String fileName) throws IOException, PdfException
fileName
- pathname of the fileIOException
PdfException
getAttachments()
public void attachDocument(String fileName, boolean compressAttachmentStream) throws IOException, PdfException
fileName
- pathname of the filecompressAttachmentStream
- whether to store the file in compressed formIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void attachDocument(PdfFileAttachment fa)
fa
- file attachment that needs to be added to the documentpublic void attachDocument(String attachmentName, byte[] bs) throws IOException, PdfException
attachmentName
- name of the attachment in the documentbs
- byte array containing the fileIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void attachDocument(String attachmentName, byte[] bs, boolean compressAttachmentStream) throws IOException, PdfException
attachmentName
- name of the attachment in the documentbs
- byte array containing the filecompressAttachmentStream
- whether to store the file in compressed formIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void removeAllAttachments()
public void removeAllAttachments(String attachmentName) throws IOException, PdfException
attachmentName
- name of the attachments in the documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void embedFont(PdfFont fontToBeEmbedded) throws PdfException, IOException
PdfFont
object is created using the PdfFont.EMBED_FULL
setting.fontToBeEmbedded
- font that needs to be embeddedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.PdfFont.create(String, int, int, byte)
,
PdfFont.create(String, int, int, int, byte)
public void embedFont(PdfFont fontToBeEmbedded, String originalFont) throws IOException, PdfException
PdfFont.EMBED_FULL
setting. Specify the original font
by its base name.fontToBeEmbedded
- font that needs to be embedded in the documentoriginalFont
- base name of the font that needs to be replacedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.PdfFont.create(String, int, int, byte)
,
PdfFont.create(String, int, int, int, byte)
,
getAllFontBaseNames()
,
getAllFontBaseNames(String)
public void replaceAllEmbeddedFonts(PdfFont replaceWithFont) throws PdfException, IOException
replaceWithFont
- font with which embedded fonts need to be replacedPdfException
- if an I/O error occurs.IOException
- if an illegal argument is supplied.public void replaceEmbeddedFont(String embeddedFontBaseName, PdfFont replaceWithFont) throws PdfException, IOException
embeddedFontBaseName
- font that needs to be replacedreplaceWithFont
- font with which the embedded fonts needs to be
replaced.PdfException
- if an I/O error occurs.IOException
- if an illegal argument is supplied.public void substituteFont(String replaceFontWithBaseName, PdfFont substituteWithFont) throws PdfException, IOException
replaceFontWithBaseName
- base name of the font that needs to be replacedsubstituteWithFont
- font that will be replace the existing fontPdfException
- if called in writing mode
or if
an illegal argument is calledIOException
- if an I/O error occurs.public List getAllEmbededFontNames() throws IOException, PdfException
IOException
- if I/O exception is raised.PdfException
- if called in creation mode.public ArrayList getAttachments() throws IOException, PdfException
ByteBuffer
objects representing file attachmentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.attachDocument(String)
public List getPdfFileAttachments() throws PdfException, IOException
PdfException
- if called in creation mode.IOException
- if an I/O error occurs.PdfFileAttachment
public void addThumbnailImage(String path, int pageNo) throws IOException, PdfException
path
- pathname of the thumbnail imagepageNo
- number of the page in the documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.removeThumbnailImage(String)
public void removeThumbnailImage(String pageRange) throws PdfException
pageRange
- pages for which there ought to be no thumbnailsPdfException
- if an illegal argument is supplied.addThumbnailImage(String, int)
public void addAnnotation(PdfAnnot annotation, int pageNo) throws PdfException, IOException
annotation
- new annotation that needs to be addedpageNo
- number of the page to which the annotation needs to
be addedPdfException
- if an illegal argument is supplied.IOException
public void addAnnotationList(List annotList, int pageNo) throws PdfException, IOException
annotList
- list of new annotations that need to be addedpageNo
- number of the page to which the annotations need to
be addedPdfException
- if an illegal argument is supplied.IOException
public void addAnnotationList(List annotList, int pageNo, boolean removeExistingAnnots) throws PdfException, IOException
annotList
- list of new annotations that need to be addedpageNo
- number of the page to which the annotations need to
be addedremoveExistingAnnots
- whether to remove or keep existing annotations in
the pagePdfException
- if an illegal argument is supplied.IOException
public void addAnnotationList(List annotList, String[] pageRanges, boolean removeExistingAnnots, int measurementUnit) throws PdfException
annotList
- list of new annotations that need to be addedpageRanges
- page range in whose pages the annotations need to be
addedremoveExistingAnnots
- whether to remove or keep existing annotations in
the pagemeasurementUnit
- constant specifying the measurement unit that needs
to be applied for the annotationsPdfException
- if an illegal argument is supplied.PdfMeasurement
public void addAnnotationList(List annotList, String[] pageRanges, int measurementUnit) throws PdfException
annotList
- list of new annotations that need to be addedpageRanges
- pages where the annotations need to be addedmeasurementUnit
- constant specifying the measurement unit that needs
to be applied for the annotationsPdfException
- if an illegal argument is supplied.public void addDefaultFormFont(PdfFont font)
public void addDefaultFormFontList(List fontList)
public void addFormField(PdfFormField formField, int pageNo) throws PdfException, IOException
formField
- form field that needs to be addedpageNo
- number of the page to which the form field needs to
be addedPdfException
- if an illegal argument is supplied.IOException
public void addFormField(PdfFormField f, String[] pageRanges) throws PdfException
f
- form field (radio button group or check box group)
whose children need to be addedpageRanges
- page ranges to which children form fields need to be
addedPdfException
- if an illegal argument is supplied.public void addFormFieldList(List formFieldList, int pageNo) throws PdfException, IOException
formFieldList
- list of form fields that need to be added to the
pagepageNo
- number of the page to which the form fields need to
be addedPdfException
- if an illegal argument is supplied.IOException
public void deleteFormFields() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteFormFields(int type) throws IOException, PdfException
type
- constant specifying the form field typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteFormFields(String name) throws IOException, PdfException
name
- name of the form fieldsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteFormFieldsOnPage(int pageNo) throws IOException, PdfException
pageNo
- number of the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteFormFieldsOnPage(int pageNo, int type) throws IOException, PdfException
pageNo
- number of the pagetype
- form field typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteFormFieldsOnPage(int pageNo, String name) throws IOException, PdfException
pageNo
- number of the pagename
- name of the form fieldsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void exportToFDF(File fdfFile) throws IOException, PdfException
fdfFile
- FDF file to which interactive forms data needs to be
writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.importFromFDF(File)
public void flattenFormFields() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFields(boolean flattenWithNewValue) throws IOException, PdfException
flattenWithNewValue
- whether to retain new values. If false
,
form fields will be flattened with their original
values.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFields(int type) throws IOException, PdfException
type
- constant specifying form field typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormField
public void flattenFormFields(int type, boolean flattenWithNewValue) throws IOException, PdfException
type
- constant specifying form field typeflattenWithNewValue
- whether to retain new values. If false
,
form fields will be flattened with their original
values.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormField
public void flattenFormFields(String name) throws IOException, PdfException
name
- name of the form fieldsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFields(String name, boolean flattenWithNewValue) throws IOException, PdfException
name
- name of the form fieldsflattenWithNewValue
- whether to retain new values. If false
,
form fields will be flattened with their original
values.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFieldsOnPage(int pageNo) throws IOException, PdfException
pageNo
- number of the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFieldsOnPage(int pageNo, boolean flattenWithNewValue) throws IOException, PdfException
pageNo
- number of the pageflattenWithNewValue
- whether to retain new values. If false
,
form fields will be flattened with their original
values.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFieldsOnPage(int pageNo, int type) throws IOException, PdfException
pageNo
- number of the pagetype
- constant specifying form field typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormField
public void flattenFormFieldsOnPage(int pageNo, int type, boolean flattenWithNewValue) throws IOException, PdfException
pageNo
- number of the pagetype
- constant specifying form field typeflattenWithNewValue
- whether to retain new values. If false
,
form fields will be flattened with their original
values.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormField
public void flattenFormFieldsOnPage(int pageNo, String name) throws IOException, PdfException
pageNo
- number of the pagename
- name of the form fieldsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFieldsOnPage(int pageNo, String name, boolean flattenWithNewValue) throws IOException, PdfException
pageNo
- number of the pagename
- name of the form fieldsflattenWithNewValue
- whether to retain new values. If false
,
form fields will be flattened with their original
values.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public List getAllAnnotations() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public List getAllAnnotations(int type) throws IOException, PdfException
type
- constant specifying annotation typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfAnnot
public void getAllAnnotations(int type, List listToPopulate) throws IOException, PdfException
type
- constant specifying the type of annotationslistToPopulate
- list that needs to be populatedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void getAllAnnotations(List listToPopulate) throws IOException, PdfException
listToPopulate
- list that needs to be populatedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public List getAllAnnotationsOnPage(int pageNo) throws PdfException, IOException
pageNo
- number of the pagePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List getAllAnnotationsOnPage(int pageNo, int type) throws PdfException, IOException
pageNo
- number of the pagetype
- constant specifying annotation typePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.PdfAnnot
public void getAllAnnotationsOnPage(int pageNo, int type, List listToPopulate) throws PdfException, IOException
pageNo
- number of the pagetype
- constant specifying annotation typelistToPopulate
- list that needs to be populatedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.PdfAnnot
public void getAllAnnotationsOnPage(int pageNo, List listToPopulate) throws IOException, PdfException
pageNo
- number of the pagelistToPopulate
- list that needs to be populatedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public List getAllFormFields() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public List getAllFormFields(int type) throws IOException, PdfException
type
- constant specifying form field typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormField
public List getAllFormFields(String name) throws IOException, PdfException
name
- name specified for the form fields in the documentIOException
- if an illegal argument is supplied.PdfException
- if an I/O error occurs.public List getAllFormFieldsOnPage(int pageNo) throws IOException, PdfException
pageNo
- number of the pageIOException
- if an illegal argument is supplied.PdfException
- if an I/O error occurs.public List getAllFormFieldsOnPage(int pageNo, int type) throws IOException, PdfException
pageNo
- number of the pagetype
- constant specifying form field typeIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormField
public List getAllFormFieldsOnPage(int pageNo, String name) throws IOException, PdfException
pageNo
- number of the pagename
- name of the form fieldIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public List getAllFontBaseNames() throws PdfException, IOException
embedding a font
in place
of another font already existing in the document.PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.embedFont(PdfFont, String)
public List getAllFontBaseNames(String pageRange) throws PdfException, IOException
embedding a font
in place
of another font already existing in the document.pageRange
- page range from which fonts are identifiedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.embedFont(PdfFont, String)
public int getDefaultFieldAlignment()
setDefaultFieldAlignment(int)
public Color getDefaultFormFontColor()
setDefaultFormFontColor(Color)
public List getDefaultFormFontList()
public void importFromFDF(File fileName) throws IOException, PdfException
fileName
- FDF file from which interactive forms data needs to
be importedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public boolean isAutoAdjustFieldTextHeight()
setAutoAdjustFieldTextHeight(boolean)
public void setAutoAdjustFieldTextHeight(boolean autoAdjustFieldTextHeight)
autoAdjustFieldTextHeight
- whether the size of text inside text box, list box
and combo box form fields needs to be adjustedisAutoAdjustFieldTextHeight()
,
PdfFormTextField.setAutoAdjustTextHeight(boolean)
,
PdfFormListBox
,
PdfFormComboBox
public void setDefaultFieldAlignment(int defualtFieldAlignment)
defualtFieldAlignment
- constant specifying default text alignment for form
fieldsgetDefaultFieldAlignment()
public void setDefaultFormFontColor(Color defaultFormFontColor)
defaultFormFontColor
- default color for form field text in the documentgetDefaultFormFontColor()
public void setDefaultFormFontIndex(int defaultFormFontIndex)
defaultFormFontIndex
- public void setDefaultFormFontList(List fontList)
public void deleteAnnotations() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteAnnotations(int type) throws IOException, PdfException
type
- constant specifying annotation type
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteAnnotationsOnPage(int pageNo) throws IOException, PdfException
pageNo
- number of the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteAnnotationsOnPage(int pageNo, int type) throws IOException, PdfException
pageNo
- number of the pagetype
- constant specifying annotation type
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g, Rectangle2D rect) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedrect
- rectangular area on the graphics item where the page
needs to be renderedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g, double x, double y, double width, double height) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedx
- x-coordinate of the top-left coordinate of the
rectangular areay
- y-coordinate of the top-left coordinate of the
rectangular areawidth
- width of the rectangular areaheight
- height of the rectangular areaIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g, Point2D position, double zoom) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedposition
- position where the graphics item needs to be
renderedzoom
- factor by which the graphics item needs to be
magnifiedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g, Point2D position, double xZoom, double yZoom) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedposition
- position where the graphics item needs to be
renderedxZoom
- factor by which the width of the page contents needs
to be magnifiedyZoom
- factor by which the height of the page contents
needs to be magnifiedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g, Point2D position, double xZoom, double yZoom, double rotation, double pointOfRotationAboutWidth, double pointOfRotationAboutHeight) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedposition
- position where the graphics item needs to be
renderedxZoom
- factor by which the width of the page contents needs
to be magnifiedyZoom
- factor by which the height of the page contents
needs to be magnifiedrotation
- angle of rotation with which the contents need to be
renderedpointOfRotationAboutWidth
- pointOfRotationAboutHeight
- IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void renderOnGraphics(int pageNum, Graphics g, Point2D position, double xZoom, double yZoom, int scaleToResolution) throws IOException, PdfException
pageNum
- number of the pageg
- graphics item on which the page contents needs to be
renderedposition
- position where the graphics item needs to be
renderedxZoom
- factor by which the width of the page contents needs
to be magnifiedyZoom
- factor by which the height of the page contents
needs to be magnifiedscaleToResolution
- resolution of the rendered imageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public BufferedImage getPageAsBufferedImage(int pageNum) throws IOException, PdfException
pageNum
- number of the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public BufferedImage getPageAsBufferedImage(int pageNum, int width, int height) throws IOException, PdfException
pageNum
- number of the pagewidth
- width of the imageheight
- height of the imageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public BufferedImage getPageAsBufferedImage(int pageNum, int width, int height, int scaleToResolution) throws IOException, PdfException
pageNum
- number of the pagewidth
- width of the imageheight
- height of the imagescaleToResolution
- DPI to which the page needs to be scaled before it
is exported as an imageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public BufferedImage getPageAsBufferedImage(int pageNum, int width, int height, int scaleToResolution, double zoom) throws IOException, PdfException
pageNum
- number of the pagewidth
- width of the imageheight
- height of the imagescaleToResolution
- pixel density of the imagezoom
- percentage to which page contents need to be magnifiedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public BufferedImage getPageAsBufferedImage(int pageNum, int scaleToResolution, double zoomPercentage, int rotationAngle) throws IOException, PdfException
pageNum
- number of the pagescaleToResolution
- pixel density of the imagezoomPercentage
- level of magnification to which the page contents need
to be magnifiedrotationAngle
- angle to which the page contents need to be rotatedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public BufferedImage getPageAsBufferedImage(int pageNum, int width, int height, int bufferedImageType, int scaleToResolution) throws PdfException, IOException
pageNum
- number of the pagewidth
- width of the imageheight
- height of the imagebufferedImageType
- constant
specifying type of the buffered imagescaleToResolution
- DPI to which the page needs to be scaled before it
is exported as an imagePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public BufferedImage getPageAsBufferedImage(int pageNum, int width, int height, int bufferedImageType, int scaleToResolution, double zoom) throws PdfException, IOException
pageNum
- number of the pagewidth
- width of the imageheight
- height of the imagebufferedImageType
- constant
specifying type of the buffered imagescaleToResolution
- pixel density of theimagezoom
- magnification percentage to which the page contents need to
be magnifiedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void saveDocAsTiffImage(String filePath) throws IOException, PdfException
filePath
- pathname of the directory where the image need to be
createdIOException
- if an I/O error occurs.PdfException
- if Java Advanced Imaging API is not available; if
called in PDF creation mode
; if
an illegal argument is supplied.public void saveDocAsTiffImage(String filePath, int scaleToResolution) throws IOException, PdfException
filePath
- pathname of the directory where the image need to be
createdscaleToResolution
- resolution to which pages should be scaled before
their contents are exportedIOException
- if an I/O error occurs.PdfException
- if a resolution value from 11 to 4799 is not
supplied; if Java Advanced Imaging API is not
available; if a resolution value from 11 to 4799 is
not supplied; if called in
PDF creation mode
.public void saveDocAsTiffImage(String pageRange, String filePath) throws IOException, PdfException
pageRange
- pages that need to be exportedfilePath
- pathname of the directory where the image need to be
createdIOException
- if an I/O error occurs.PdfException
- if Java Advanced Imaging API is not available; if
called in PDF creation mode
; if
an invalid page range is supplied; if an invalid
argument is supplied.public void saveDocAsTiffImage(String pageRange, String filePath, int scaleToResolution) throws IOException, PdfException
pageRange
- pages that need to be exportedfilePath
- pathname of the directory where the image need to be
createdscaleToResolution
- IOException
- if an I/O error occurs.PdfException
- if a resolution value from 11 to 4799 is not
supplied; if Java Advanced Imaging API is not
available; if called in
PDF creation mode
; if an invalid
page range is supplied; if an invalid argument is
supplied.public void saveDocAsTiffImage(String filePath, int tiffCompressionType, float tiffCompressionQuality) throws PdfException, IOException
filePath
- pathname of the directory where the image need to be
createdtiffCompressionType
- constant specifying the compression typetiffCompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantPdfException
- if Java Advanced Imaging API is not available; if
called in PDF creation mode
; if
an invalid argument is supplied.IOException
- if an I/O error occurspublic void saveDocAsTiffImage(String filePath, int tiffCompressionType, float tiffCompressionQuality, int scaleToResolution) throws PdfException, IOException
filePath
- pathname of the directory where the image need to be
createdtiffCompressionType
- constant specifying the compression typetiffCompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantscaleToResolution
- resolution to which pages should be scaled before
their contents are exportedPdfException
- if an I/O error occurs.IOException
- if a resolution value from 11 to 4799 is not
supplied; if Java Advanced Imaging API is not
available; if called in
PDF creation mode
; if an invalid
argument is supplied.public void saveDocAsTiffImage(String filePath, String pageRange, int tiffCompressionType, float tiffCompressionQuality, int scaleToResolution, double zoom) throws PdfException, IOException
filePath
- pathname of the directory where the image need to be
createdpageRange
- pages that need to be convertedtiffCompressionType
- constant specifying the compression typetiffCompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantscaleToResolution
- resolution to which pages should be scaled before
their contents are exportedzoom
- percentage factor by which page contents need to be
zoomedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void saveDocAsTiffImage(String filePath, String pageRange, int tiffCompressionType, float tiffCompressionQuality) throws PdfException, IOException
filePath
- pathname of the directory where the image need to be
createdpageRange
- pages that need to be exportedtiffCompressionType
- constant specifying the compression typetiffCompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantPdfException
- if Java Advanced Imaging API is not available; if
called in PDF creation mode
; if
an invalid page range is supplied; if an invalid
argument is supplied.IOException
- if an I/O error occurs.public void saveDocAsTiffImage(String filePath, String pageRange, int width, int height, int tiffCompressionType, float tiffCompressionQuality, int scaleToResolution) throws PdfException, IOException
filePath
- pathname of the directory where the image need to be
createdpageRange
- pages whose contents need to be exported as TIFFwidth
- width of the imagesheight
- height of the imagestiffCompressionType
- constant specifying the compression typetiffCompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantscaleToResolution
- resolution to which the page should be scaled before
its contents are saved as an imagePdfException
- if Java Advanced Imaging API is not available; if
called in PDF creation mode; if an invalid page
range is supplied; if an invalid argument is
supplied.IOException
- if an I/O error occurs.public void saveDocAsTiffImage(String filePath, String pageRange, int tiffCompressionType, float tiffCompressionQuality, int scaleToResolution) throws PdfException, IOException
filePath
- pathname of the directory where the image need to be
createdpageRange
- pages that need to be exportedtiffCompressionType
- constant specifying the compression typetiffCompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantscaleToResolution
- resolution to which the page should be scaled before
its contents are saved as an imagePdfException
- if a resolution value from 11 to 4799 is not
supplied; if an invalid page range is supplied; if
Java Advanced Imaging API is not available; if
called in PDF creation mode
; if
an invalid argument is supplied.IOException
- if an I/O error occurs.public void saveAsImage(String format, String pageRange, String imageName, String outputPath) throws IOException, PdfException
<document name>_page<page number>.<format>
.
If the document has been loaded from a stream, then the image
file name will be constructed using a random number in the
format:
image_<5-digit random number>_page<page number>.<format>
.
The file name can also contain custom placeholders whose values
can be provided in the implementation of the interface method
PdfCustomPlaceholderHandler.onCustomPlaceHolder()
.
(Placeholders need to be delimited by <%
and %>
. Some placeholders have been
pre-defined and values they provide are listed below:
pageNo
- number of the current pagepageNum
- number of the current pagepageCount
- total number of pagespageWidth
- width of the current page pageHeight
- height of the current pageAuthor
- "Author" document propertyFilename
- file name of the documentPath
- location of the documentFilePath
- location of the documentInputFileName
- filename of the input
documentInputFilePath
- path of the input documentOutputFileName
- filename of the output
documentOutputFilePath
- path of the output
documentPdfSaveAsImageHandler.onSaveAsImage()
interface method is implemented, then the file name and path
can also be changed just before the image is saved.format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix applied to file names of output imagesoutputPath
- directory where images needs to be savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfSaveAsImageHandler
,
saveAsImage(String, String, String, String, String, float, String)
public void saveAsImage(String format, String pageRange, String imageName, String outputPath, int scaleToResolution) throws IOException, PdfException
<document name>_page<page number>.<format>
.
If the document has been loaded from a stream, then the image
file name will be constructed using a random number in the
format:
image_<5-digit random number>_page<page number>.<format>
.
The file name can also contain custom placeholders whose values
can be provided in the implementation of the interface method
PdfCustomPlaceholderHandler.onCustomPlaceHolder()
.
(Placeholders need to be delimited by <%
and %>
. Some placeholders have been
pre-defined and values they provide are listed below:
pageNo
- number of the current pagepageNum
- number of the current pagepageCount
- total number of pagespageWidth
- width of the current page pageHeight
- height of the current pageAuthor
- "Author" document propertyFilename
- file name of the documentPath
- location of the documentFilePath
- location of the documentInputFileName
- filename of the input
documentInputFilePath
- path of the input documentOutputFileName
- filename of the output
documentOutputFilePath
- path of the output
documentPdfSaveAsImageHandler.onSaveAsImage()
interface method is implemented, then the file name and path
can also be changed just before the image is saved.format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix applied to file names of output imagesoutputPath
- directory where images needs to be savedscaleToResolution
- resolution to which the page should be scaled before
its contents are saved as an imageIOException
- if an I/O error occurs.PdfException
- if a resolution value from 11 to 4799 is not supplied.public void saveAsImage(String format, String pageRange, String imageName, float compressionQuality, String outputPath) throws IOException, PdfException
format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix applied to file names of output imagescompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantoutputPath
- directory where images needs to be savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfSaveAsImageHandler
,
saveAsImage(String, String, String, String, String,
float, String)
public void saveAsImage(String format, String pageRange, String imageName, float compressionQuality, String outputPath, int scaleToResolution) throws IOException, PdfException
format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix applied to file names of output imagescompressionQuality
- a number from 0.0 to 1.0 where 0.0 signifies that
high compression is important while 1.0 signifies
high image quality is importantoutputPath
- directory where images needs to be savedscaleToResolution
- resolution to which the page should be scaled before its contents are saved as an imageIOException
- if an I/O error occurs.PdfException
- if a resolution value from 11 to 4799 is not supplied.public void saveAsImage(String format, String pageRange, String imageName, int imageWidth, int imageHeight, float compressionQuality, String outputPath) throws IOException, PdfException
format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix applied to file names of output imagesimageWidth
- width of output imagesimageHeight
- height of output imagescompressionQuality
- a number from 0.0 to 1.0 where 0 signifies that high
compression is important and 1.0 signifies that high
image quality is importantoutputPath
- directory where images needs to be savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfSaveAsImageHandler
,
saveAsImage(String, String, String, String, String,
float, String)
public void saveAsImage(String format, String pageRange, String imageName, int imageWidth, int imageHeight, float compressionQuality, String outputPath, int scaleToResolution) throws IOException, PdfException
format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix applied to file names of output imagesimageWidth
- width of output imagesimageHeight
- height of output imagescompressionQuality
- a number from 0.0 to 1.0 where 0 signifies that high
compression is important and 1.0 signifies that high
image quality is importantoutputPath
- directory where images needs to be savedscaleToResolution
- resolution to which the page should be scaled before
its contents are saved as an imageIOException
- if an I/O error occurs.PdfException
- if a resolution value from 11 to 4799 is not supplied.public void saveAsImage(String format, String pageRange, String imageName, int imageWidth, int imageHeight, float compressionQuality, String compressionType, String outputPath, int scaleToResolution) throws IOException, PdfException
format
- file extension of the image formatpageRange
- pages whose contents need to be convertedimageName
- prefix for the image filesimageWidth
- width of the imagesimageHeight
- height of the imagescompressionQuality
- a value from 0.0 to 1.0 representing the compression qualitycompressionType
- compression type
outputPath
- directory where the images need to be savedscaleToResolution
- resolution of the imageIOException
PdfException
- PdfDocument doc = new PdfDocument(); try { String[] lst = doc.getSupportedCompressionTypes("tiff"); if (lst != null) { for (int i =0; i < lst.length; i++) { System.out.println(Integer.toString(i) + ". " + lst[i]); } doc.load("input.pdf"); doc.saveAsImage("tiff", "1-2", // pages 1 and 2 "pdf-to-image", // image prefix 1.0f, doc.getSupportedCompressionTypes("tiff")[0], ".", // current directory 96, 1); } doc.close(); } catch (IOException | PdfException e) { e.printStackTrace(); }
public void saveAsImage(String format, String pageRange, String imageName, String imageWidth, String imageHeight, float compressionQuality, String outputPath) throws IOException, PdfException
format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix of file names of output imagesimageWidth
- placeholder with the width of output imagesimageHeight
- height of output imagescompressionQuality
- a number from 0.0 to 1.0 where 0 signifies that high
compression is important and 1.0 signifies that high
image quality is importantoutputPath
- directory where images needs to be savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfSaveAsImageHandler
,
saveAsImage(String, String, String, String, String,
float, String)
public void saveAsImage(String format, String pageRange, String imageName, String imageWidth, String imageHeight, float compressionQuality, String outputPath, int scaleToResolution) throws IOException, PdfException
format
- file name suffix of the image formatpageRange
- pages whose images needs to createdimageName
- prefix of file names of output imagesimageWidth
- placeholder with the width of output imagesimageHeight
- height of output imagescompressionQuality
- a number from 0.0 to 1.0 where 0 signifies that high
compression is important and 1.0 signifies that high
image quality is importantoutputPath
- directory where images needs to be savedscaleToResolution
- resolution to which the page should be scaled before
its contents are saved as an imageIOException
- if an I/O error occurs.PdfException
- if a resolution value from 11 to 4799 is not
supplied.public void saveAsImage(String format, String pageRange, String imageName, float compressionQuality, String outputPath, int scaleToResolution, double zoom) throws PdfException, IOException
PdfException
IOException
public void saveAsImage(String format, String pageRange, String imageName, float compressionQuality, String compressionType, String outputPath, int scaleToResolution, double zoom) throws PdfException, IOException
format
- pageRange
- imageName
- compressionQuality
- compressionType
- outputPath
- scaleToResolution
- zoom
- PdfException
IOException
public String[] getSupportedCompressionTypes(String format) throws PdfException
format
- image format
PdfException
- if an illegal argument is supplied.public boolean isImageFomatandCompressionLossless(String imageFormat, String compressionType) throws PdfException
imageFormat
- image format
compressionType
- compression method
PdfException
- if an illegal argument is supplied.public List getPageElements(int pageNum, int elementTypes) throws PdfException, IOException
pageNum
- number of pageelementTypes
- constant or a
combination of constants
specifying the type of the
page elementspage elements
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List getPageElements(String pageRange, int elementTypes) throws PdfException, IOException
pageRange
- pages whose page elements need to be retrievedelementTypes
- constant or a
combination of constants
specifying the type of the
page elementspage elements
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void enumPageElements(int pageNum, int elementTypes, PdfEnumPageElementsHandler pdfEnumPageElementsHandler) throws PdfException, IOException
onEnumPageElements()
event handler of specified user-class
instance whenever a page element of specified type is
encountered.pageNum
- number of the page whose page elements need to be
parsedelementTypes
- types of page elements that need to be foundpdfEnumPageElementsHandler
- user-class instance whose
onEnumPageElements()
event handler
needs to be calledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void enumPageElements(String pageRange, int elementTypes, PdfEnumPageElementsHandler pdfEnumPageElementsHandler) throws PdfException, IOException
onEnumPageElements()
event handler of specified user-class
instance whenever a page element of specified type is
encountered.pageRange
- pages whose contents need to be parsedelementTypes
- types of page elements that need to be foundpdfEnumPageElementsHandler
- user-class instance whose
onEnumPageElements()
event handler
needs to be calledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactRegion(String pageRange, PdfRect boundingRect, boolean clipRegion, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
pageRange
- pages where the specified region needs to be
redactedboundingRect
- clipRegion
- pen
- pen
with which the region needs to be
strokedbrush
- brush
which which the region needs
to be filledisStroke
- whether the region needs to be strokedisFill
- whether the region needs to be filledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactRegion(String pageRange, PdfRect boundingRect, boolean includeIntersectingText, boolean clipRegion, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
pageRange
- pages where the specified region needs to be
redactedboundingRect
- area where text needs to be redactedincludeIntersectingText
- whether characters that fall only partially within
rectangle also need to be redactedclipRegion
- pen
- pen
with which the region needs to be
strokedbrush
- brush
which which the region needs
to be filledisStroke
- whether the region needs to be strokedisFill
- whether the region needs to be filledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(int pageNum, String searchString, int searchMode, int searchOptions) throws PdfException, IOException
pageNum
- number of the pagesearchString
- strings whose instances in the page need to be redactedsearchMode
- PdfSearchMode
constant
specifying whether the search string is a simple text string
or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionsPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(String pageRange, List searchStringList, int searchMode, int searchOptions, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
searchMode
- PdfSearchMode
constant
specifying whether the search string is a simple
text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionspen
- pen
with which the region needs to be
strokedbrush
- brush
which which the region needs
to be filledisStroke
- whether the redacted region needs to be strokedisFill
- whether the redacted region needs to be filledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(String pageRange, List searchStringList, int searchMode, int searchOptions, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill, boolean removeAssociatedAnnotations) throws PdfException, IOException
PdfException
IOException
public void redactText(int pageNum, String searchString, int searchMode, int searchOptions, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
pageNum
- number of the pagesearchString
- strings whose instances in the page need to be
redactedsearchMode
- PdfSearchMode
constant
specifying whether the search string is a simple
text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionspen
- pen
with which the region needs to be
strokedbrush
- brush
which which the region needs
to be filledisStroke
- whether the redacted region needs to be strokedisFill
- whether the redacted region needs to be filledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(String pageRange, String searchString, int searchMode, int searchOptions) throws PdfException, IOException
pageRange
- pages where the text needs to be redactedsearchString
- strings whose instances in the page need to be redactedsearchMode
- PdfSearchMode
constant
specifying whether the search string is a simple text string
or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionsPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(String pageRange, String searchString, int searchMode, int searchOptions, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
pageRange
- pages where the text needs to be redactedsearchString
- strings whose instances in the page need to be
redactedsearchMode
- PdfSearchMode
constant
specifying whether the search string is a simple
text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionspen
- pen
with which the region needs to be
strokedbrush
- brush
which which the region needs
to be filledisStroke
- whether the redacted region needs to be strokedisFill
- whether the redacted region needs to be filledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(int pageNum, String searchString, int searchMode, int searchOptions, String replaceString, PdfFont font, boolean fontSizeAuto) throws PdfException, IOException
pageNum
- number of the pagesearchString
- text that needs to be redactedsearchMode
- PdfSearchMode
constant
specifying whether the search string is a simple
text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionsreplaceString
- text that needs to be rendered in the region where
the text needs to be redactedfont
- font with which the replacement text needs be
renderedfontSizeAuto
- whether the font size of the replacement text needs
to be automatically resized to fit redacted regionPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(int pageNum, String searchString, int searchMode, int searchOptions, String replaceString, PdfFont font, boolean fontSizeAuto, boolean removeAssociatedAnnotations) throws PdfException, IOException
PdfException
IOException
public void redactText(String pageRange, String searchString, int searchMode, int searchOptions, String replaceString, PdfFont font, boolean fontSizeAuto) throws PdfException, IOException
pageRange
- pages where the text needs to be redactedsearchString
- text that needs to be redactedsearchMode
- PdfSearchMode
constant
specifying whether the search string is a simple
text string or a regular expressionsearchOptions
- text that needs to be rendered in the region where
the text needs to be redactedreplaceString
- text that needs to be rendered in the region where
the text needs to be redactedfont
- font with which the replacement text needs be
renderedfontSizeAuto
- whether the font size of the replacement text needs
to be automatically resized to fit redacted regionPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(String pageRange, String searchString, int searchMode, int searchOptions, String replaceString, PdfFont font, boolean fontSizeAuto, boolean removeAssociatedAnnotations) throws PdfException, IOException
PdfException
IOException
public void redactText(String pageRange, String searchString, int searchMode, int searchOptions, PdfPen pen, PdfBrush brush, String replaceString, PdfFont font, boolean fontSizeAuto, boolean removeAssociatedAnnotations) throws PdfException, IOException
PdfException
IOException
public void setSaveAsImageHandler(PdfSaveAsImageHandler saveAsImageHandler)
onSaveAsImage()
event handler of specified user-class instance is
called whenever a page is exported as an image.saveAsImageHandler
- user-class instance whose onSaveAsImage() event handler needs
to be calledsaveAsImage(String, String, String, float, String, String, int, double)
public void setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
onRenderError()
event handler of specified user-class instance is called
whenever a rendering error occurs.pdfRenderErrorHandler
- user-class instance whose onRenderError() event handler needs
to be calledgetRenderErrorHandler()
public PdfRenderErrorHandler getRenderErrorHandler()
onRenderError()
event handler has been set to be called by this document
object.public void close() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.load(String)
,
save(String)
public PdfRenderingOptions getRenderingOptions()
public void setRenderingOptions(PdfRenderingOptions renderingOptions)
renderingOptions
- rendering options that need to be set for the documentpublic List search(String searchString, int pageNum, int searchMode, int searchOptions) throws PdfException, IOException
searchString
- text that needs to be searched forpageNum
- number of the page where the search needs to be performedsearchMode
- PdfSearchMode
constant specifying whether the search
string is a simple text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionssearch results
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List search(String searchString, String pageRange, int searchMode, int searchOptions) throws PdfException, IOException
searchString
- text that needs to be searched forpageRange
- pages where the search needs to be performedsearchMode
- PdfSearchMode
constant specifying whether
the search string is a simple text string or a
regular expressionsearchOptions
- PdfSearchOptions
constant specify search
optionssearch results
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List search(int startPageNum, String searchString, int searchMode, int searchOptions) throws PdfException, IOException
startPageNum
- number of the page from which the search should beginsearchString
- text that needs to be searched forsearchMode
- PdfSearchMode
constant specifying whether the search
string is a simple text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionssearch results
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void search(String searchString, int searchMode, int searchOptions, PdfSearchHandler pdfSearchHandler, int startPageNum) throws PdfException, IOException
onSearchElement()
event handler when a match is found.searchString
- text that needs to be searched forsearchMode
- PdfSearchMode
constant specifying whether the search
string is a simple text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specifying search optionspdfSearchHandler
- user-class instance whose
onSearchElement()
needs to be calledstartPageNum
- number of the page from which the search should beginPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void search(String searchString, int searchMode, int searchOptions, PdfSearchHandler pdfSearchHandler, String pageRange) throws PdfException, IOException
onSearchElement()
event handler when a match is found.searchString
- text that needs to be searched forsearchMode
- PdfSearchMode
constant specifying whether
the search string is a simple text string or a
regular expressionsearchOptions
- PdfSearchOptions
constant specifying search
optionspdfSearchHandler
- user-class instance whose
onSearchElement()
needs to be calledpageRange
- pages in which the search needs to be performedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List search(List searchStringList, int pageNum, int searchMode, int searchOptions) throws PdfException, IOException
searchStringList
- list contain search stringspageNum
- number of the page where the search needs to be
performedsearchMode
- PdfSearchMode
constant specifying whether
the search string is a simple text string or a
regular expressionsearchOptions
- PdfSearchOptions
constant specify search
optionsPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List search(List searchStringList, String pageRange, int searchMode, int searchOptions) throws PdfException, IOException
searchStringList
- list contain search stringspageRange
- pages where the search needs to be performedsearchMode
- PdfSearchMode
constant specifying whether
the search string is a simple text string or a
regular expressionsearchOptions
- PdfSearchOptions
constant specify search
optionsPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public PdfSearchElement findFirst(String searchString, int searchMode, int searchOptions, int startPageNum, boolean isSearchForward) throws PdfException, IOException
searchString
- text that needs to be searched forsearchMode
- PdfSearchMode
constant specifying whether the search
string is a simple text string or a regular expressionsearchOptions
- PdfSearchOptions
constant specify search optionsstartPageNum
- number of the page from which the search should beginisSearchForward
- whether search should move towards the end of the documentPdfException
- if an I/O error occurs.IOException
- if an illegal argument is supplied.public PdfSearchElement findNext(PdfSearchElement currentSearchElement) throws PdfException, IOException
currentSearchElement
- page element search result whose successor needs to be foundPdfException
- if an I/O error occurs.IOException
- if an illegal argument is supplied.public PdfSearchElement findPrevious(PdfSearchElement currentSearchElement) throws PdfException, IOException
currentSearchElement
- page element search result whose predecessor needs to be foundPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List extractText(int pageNum) throws PdfException, IOException
pageNum
- number of the pagePdfException
- if an I/O error occurs.IOException
- if an illegal argument is supplied.public List extractText(String pageRange, boolean insertPageBreak) throws PdfException, IOException
pageRange
- pages whose text need to be extractedinsertPageBreak
- whether a new line need to be inserted when the text
extraction operation moves to a new pagePdfException
- if an I/O error occurs.IOException
- if an illegal argument is supplied.public void saveAsText(int pageNum, Writer writer) throws PdfException, IOException
pageNum
- number of the pagewriter
- character stream writer instance to which the text needs to be
savedPdfException
- if an I/O error occurs.IOException
- if an I/O error occurs.public void saveAsText(int pageNum, Writer writer, boolean ignoreExtraNewLines) throws PdfException, IOException
pageNum
- number of the pagewriter
- character stream writer instance to which the text needs to be
savedignoreExtraNewLines
- whether consecutive blank lines need to be exportedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void saveAsText(String pageRange, Writer writer, boolean insertPageBreak, boolean ignoreExtraNewLines) throws PdfException, IOException
pageRange
- pages from which text needs to be exportedwriter
- character stream writer instance to which the text needs to be
savedinsertPageBreak
- whether form feed character (12 or 0xC) needs to be
inserted for each new pageignoreExtraNewLines
- whether consecutive blank lines need to be exportedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void saveAsText(String pageRange, Writer writer, boolean insertPageBreak) throws PdfException, IOException
pageRange
- pages from which the text needs to be exportedwriter
- character stream writer instance to which the text needs to be
savedinsertPageBreak
- whether form feed character (12 or 0xC) needs to be
inserted for each new pagePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be identified as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, Date timeStamp) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be assigned as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedtimeStamp
- time stamp that needs to be set for the signaturePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, String fieldName) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be identified as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedfieldName
- name that needs to be set for the signature form
field in the documentPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, String fieldName, PdfRect fieldRect) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be identified as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedfieldName
- time stamp that needs to be set for the signaturefieldRect
- name that needs to be set for the signature form
field in the documentPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, String fieldName, PdfRect fieldRect, Color backgroundColor, PdfFont font) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be identified as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedfieldName
- name that needs to be set for the signature form
field in the documentfieldRect
- location on the page where the signature form field
needs to be addedbackgroundColor
- background color of the signature form fieldfont
- font with which the signature needs to be displayedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, Date timeStamp, String fieldName, PdfRect fieldRect) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be assigned as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedtimeStamp
- time stamp that needs to be set for the signaturefieldName
- name that needs to be set for the signature form
field in the documentfieldRect
- location on the page where the signature form field
needs to be addedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, Date timeStamp, String fieldName, PdfRect fieldRect, Color backgroundColor, PdfFont font) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be identified as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedtimeStamp
- time stamp that needs to be set for the signaturefieldName
- name that needs to be set for the signature form
field in the documentfieldRect
- location on the page where the signature form field
needs to be addedbackgroundColor
- background color of the signature form fieldfont
- font with which the signature needs to be displayedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(String PFXFileName, String PFXPassword, String reason, String location, String contactInfo, int pageNum, Date timeStamp, String fieldName, PdfRect fieldRect, PdfAppearanceStream fieldAppearanceStream) throws PdfException, IOException
PFXFileName
- PFX file from which the digital certificate needs to
be loadedPFXPassword
- password with which the certificate needs to be readreason
- text that needs to be assigned as the "reason" for
the signaturelocation
- text that needs to be assigned as the "location" for
the signaturecontactInfo
- text that needs to be assigned as the
"contact information" for the signaturepageNum
- number of the page where the signature needs to be
addedtimeStamp
- time stamp that needs to be set for the signaturefieldName
- name that needs to be set for the signature form
field in the documentfieldRect
- location on the page where the signature form field
needs to be addedfieldAppearanceStream
- custom appearance stream for the form fieldPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addSignature(PdfSignature pdfSignature) throws PdfException, IOException
pdfSignature
- digital signature that needs to be addedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void removeAllSignaures() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public boolean isPageEmpty(int pageNum) throws PdfException, IOException
pageNum
- number of the pagePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.doc.load("two-page.pdf"); System.out.println(doc.isPageEmpty(1)?"Page 1 is empty.":"Page 1 is not empty"); System.out.println(doc.isPageEmpty(1)?"Page 2 is empty.":"Page 2 is not empty"); doc.close();See screenshot
public boolean isXFA() throws IOException, PdfException
true
if the document is a dynamic forms document; false
if otherwise.IOException
- if an illegal argument is supplied.PdfException
- if an illegal argument is supplied.doc.load("forms.pdf"); if (doc.isXFA()) { System.out.println("This is a dynamic XFA forms document."); } else { System.out.println("This may be an AcroForms or a regular non-interactive flat PDF document."); } doc.close();
public void load(String strFilePath) throws IOException, PdfException
strFilePath
- pathname of the PDF documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.save(String)
,
close()
public void load(File inFile) throws IOException, PdfException
inFile
- PDF document that needs to be loadedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.save(String)
,
close()
public void load(FileInputStream fileInputStream) throws IOException, PdfException
fileInputStream
- PDF document that needs to be loadedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.save(String)
,
close()
public void load(InputStream inputStream) throws IOException, PdfException
inputStream
- stream from which the document needs to be loadedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void load(byte[] byteArray) throws IOException, PdfException
byteArray
- PDF document that needs to be loaded.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.save(String)
,
close()
public void setOnPasswordHandler(PdfPasswordHandler onPasswordHandler)
onPassword()
event handler of specified user-class instance is
called when a password is required to read a document. Use the
event handler to provide the password.onPasswordHandler
- user-class instance whose onPassword() needs to be
calledpublic void setOnPageReadHandler(PdfPageReadHandler onPageReadHandler)
onPageRead()
event handler of specified user-class instance is
called when a new page is read from the document. Use the event
handler to specify margins for content-rendering operations on
the loaded document.onPageReadHandler
- user-class instance whose onPageRead() event handler
needs to be calledpublic void addPdfDocumentChangeHandler(PdfDocumentChangeHandler pdfDocumentChangeHandler)
PdfDocumentChangeHandler
event handler methods.
When the document object opens or closes a document, it calls
the event handlers for all user class instances on that list.pdfDocumentChangeHandler
- user class instance whose event handlers need to be
calledremovePdfDocumentChangeHandler(PdfDocumentChangeHandler)
public boolean removePdfDocumentChangeHandler(PdfDocumentChangeHandler pdfDocumentChangeHandler)
onLoad()
and onClose()
event handlers of specified user-class instance are
no longer.pdfDocumentChangeHandler
- user-class instance whose onLoad()} and onClose()}
event handlers are not required to be calledtrue
if successful; false
if
otherwise or the event handlers were not currently set
up to be calledaddPdfDocumentChangeHandler(PdfDocumentChangeHandler)
public PdfEncryption getEncryptor()
PdfDocument
.PdfEncryption
object identifying the
current encryption settings of the documentsetEncryptor(PdfEncryption)
public void setEncryptor(PdfEncryption encrypto) throws PdfException
PdfDocument
.encrypto
- PdfEncryption
specifying the encryption
settings for the documentPdfException
- if an illegal argument is supplied.getEncryptor()
public boolean isEncrypted()
public void addAction(int actionType, String applicationToLaunch, boolean isPrint, String parameterToApplication) throws IOException, PdfException
actionType
- always PdfAction.LAUNCH
applicationToLaunch
- pathname of the application or the documentisPrint
- whether the document needs to be printed instead of
being openedparameterToApplication
- arguments with which the application needs to be
launchedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addAction(int actionType, String javascriptOrURI) throws IOException, PdfException
javascriptOrURI
when the document is displayed.actionType
- constant specifying the type of action that needs to
be executedjavascriptOrURI
- Javascript statement or Uniform Resource Indicator
(URI) that needs to be executedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfAction.JAVASCRIPT
,
PdfAction.URI
public void addAction(int event, int actionType, String javascript) throws IOException, PdfException
event
- constant specifying the eventactionType
- constant identifying the action as a Javascript
action, that is, PdfAction.JAVASCRIPT
.javascript
- JavaScript script that needs to be executed by the
actionIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfAction.PdfEvent
public void addAction(int namedAction)
namedAction |
Viewer Effect |
---|---|
PdfAction.NAMED_FIRSTPAGE |
Navigates to the first page |
PdfAction.NAMED_LASTPAGE |
Navigates to the last page |
PdfAction.NAMED_NEXTPAGE |
Navigates to the next page |
PdfAction.NAMED_PREVPAGE |
Navigates to the previous page |
namedAction
- constant specifying named actionPdfAction
public void addAction(int actionType, int pageNum) throws IOException, PdfException
actionType
- constant that identifies the action as a go-to
action, that is, PdfAction.GOTO
.pageNum
- number of the page to which the viewer should
navigate when the document is openedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfAction
public void addAction(int actionType, int pageNum, float x, float y, float zoomPercentage) throws IOException, PdfException
actionType
- always PdfAction.GOTO
pageNum
- number of the page where the destination is locatedx
- x-coordinate of the destinationy
- y-coordinate of the destinationzoomPercentage
- magnification with which the destination needs to be
displayedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addAction(PdfGotoAction gotoAction) throws IOException, PdfException
gotoAction
- go-to PDF action that needs to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setProducer(String s)
public String getProducer()
setProducer(String)
public Date getCreationDate()
public void setCreationDate(Date date)
date
- date that needs to be set as the "creation date"
document information propertygetCreationDate()
,
setModifiedDate(Date)
public Date getModifiedDate()
public void setModifiedDate(Date date)
date
- date that needs to be set as the "modified date"
document information propertygetModifiedDate()
,
setCreationDate(Date)
public long save(String outFilePath) throws IOException, PdfException
outFilePath
- pathname to which the document needs to be savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.load(String)
,
close()
public long save(File outFile) throws IOException, PdfException
outFile
- file object to which the document needs to be savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.load(File)
,
close()
public long save(OutputStream outputStream) throws IOException, PdfException
loaded document
to specified output
stream object.outputStream
- output stream to which the document needs to be
savedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.load(FileInputStream)
,
close()
public long write() throws IOException, PdfException
save()
overloaded methods instead.PdfDocument
to the
PdfDocument
's output stream or file and returns
number of bytes that was saved.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setCropBox(double cropLeft, double cropTop, double cropRight, double cropBottom, String pageRange) throws PdfException, IOException
cropLeft
- distance between the left edge of the crop box and
the left edge of the pagecropTop
- distance between the top edge of the crop box and
the top edge of the pagecropRight
- distance between the right edge of the crop box and
the right edge of the pagecropBottom
- distance between the bottom edge of the crop box and
the bottom edge of the pagepageRange
- pages whose crop box need to be setPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void setCropBox(double cropLeft, double cropTop, double cropRight, double cropBottom, int unit, String pageRange) throws PdfException, IOException
cropLeft
- distance between the left edge of the crop box and
the left edge of the pagecropTop
- distance between the top edge of the crop box and
the top edge of the pagecropRight
- distance between the right edge of the crop box and
the right edge of the pagecropBottom
- distance between the bottom edge of the crop box and
the bottom edge of the pageunit
- measurement unit with which the position of the
edges of the crop box are specifiedpageRange
- pages whose crop box need to be setPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void setCropBox(PdfRect rect, String pageRange) throws PdfException, IOException
rect
- rectangular area that needs to be set as the crop
boxpageRange
- pages whose crop box need to be setPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void setCropBox(PdfRect rect, int unit, String pageRange) throws PdfException, IOException
rect
- rectangular area that needs to be set as the crop
boxunit
- measurement unit in which the rectangulare area is
specifiedpageRange
- pages whose crop box need to be setPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public int getCompressionLevel()
Pdfdocument
.setCompressionLevel(int)
,
PdfFlateFilter
public void setCompressionLevel(int compressionLevel)
PdfDocument
.compressionLevel
- constant specifying the compression levelgetCompressionLevel()
,
PdfFlateFilter
public void setWriter(PdfWriter w) throws PdfException
PdfException
public void setReader(PdfReader r) throws IOException, PdfException
IOException
PdfException
public PdfReader getReader()
public PdfWriter getWriter()
public File getWriterOutputFile()
public PdfPage getPage(int pageNo) throws PdfException, IOException
PdfPage
object specified by page number
in this document.pageNo
- page number in the documentPdfPage
objectIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public int getPageCount()
PdfDocument
.public void setPenWidth(double width)
PdfDocument
's
pen.width
- default width for the PdfDocument
's penpublic void setPenDashLength(double length)
PdfDocument
's pen.length
- length of dashes in the default dash patternsetPenDashGap(double)
,
setPenDashPhase(double)
public void setPenDashGap(double gap)
PdfDocument
's pen.gap
- length of gaps in the default dash patternsetPenDashLength(double)
,
setPenDashPhase(double)
public void setPenDashPhase(double phase)
phase
- length of phase of the default dash patternsetPenDashGap(double)
,
setPenDashLength(double)
public void setPenCapStyle(int capStyle)
PdfDocument
.capStyle
- constant specifying the default shapePdfPen
,
setPenJoinStyle(int)
public void setPenJoinStyle(int joinStyle)
PdfDocument
's pen.joinStyle
- constant specifying the default shapePdfPen
,
setPenCapStyle(int)
public void setPenMiterLimit(int limit)
PdfDocument
's pen.limit
- default miter limit for the PdfDocument
's penPdfPen
public String getXMLMetadata() throws IOException, PdfException
PdfDocument
.IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void disableAllMargins(String pageRange) throws PdfException
pageRange
- page range on whose pages margins need to disabledPdfException
- if an illegal argument is supplied.enableAllMargins(String)
public void enableAllMargins(String pageRange) throws PdfException
pageRange
- page range on whose pages margins need to enabledPdfException
- if an illegal argument is supplied.enableAllMargins(String)
public boolean isEmailAfterSave()
setEmailAfterSave(boolean)
public void setEmailAfterSave(boolean emailAfterSave)
emailAfterSave
- true if document needs to be e-mailed; false if
otherwisesetEmailHandler(PdfEmailHandler)
,
getEmailSettings()
,
isEmailAfterSave()
public PdfEmailSettings getEmailSettings() throws PdfEmailException
PdfEmailException
- if an error occurs when mailing the documentsetEmailAfterSave(boolean)
public PdfEmailSettings getEmailSettings(int emailSettingsType) throws PdfEmailException
emailSettingsType
- type of e-mail settingsPdfEmailException
- when an error (related to e-mail settings) occurspublic void setEmailHandler(PdfEmailHandler pdfEmailHandler)
PdfEmailHandler
events need to be called when this document is e-mailed.pdfEmailHandler
- user-class instance implementing PdfEmailHandler
public PdfEmailHandler getEmailHandler()
public void addToFiltersList(int filter)
Multiple filters can be added to the list of filters for a single document. Filters will be applied in the order they were added.
filter
- filter to be addedPdfFilter
public void appendPagesFrom(PdfDocument d, String pageRange) throws IOException, PdfException
d
- document from which pages need to be appendedpageRange
- pages that need to be appendedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void appendPagesFrom(String path, String pageRange) throws IOException, PdfException
path
- document from which pages need to be appendedpageRange
- pages that need to be appendedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void insertPagesFrom(com.gnostice.pdfone.PdfStdDocument d, String pageRange, int insertAfterPage) throws IOException, PdfException
d
- document from which pages need to be insertedpageRange
- pages that need to be inserted from the documentinsertAfterPage
- page position in this document where pages
from the other document needs to be insertedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void insertPagesFrom(String path, String pageRange, int insertAfterPage) throws IOException, PdfException
path
- pathname of the document from which pages need to be
insertedpageRange
- pages that need to be inserted from the documentinsertAfterPage
- page position in this document where pages
from the other document needs to be insertedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void merge(List docList) throws IOException, PdfException
PdfDocument
objects or
pathnames of the documents.docList
- list containing documents that need to be merged
with this documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void merge(List docList, int mergeOptions) throws IOException, PdfException
PdfDocument
objects or pathnames of the documents.docList
- list containing documents that need to be merged
with this documentmergeOptions
- combination of flags (constants) used for merging
documentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void merge(PdfDocument d) throws IOException, PdfException
d
- document that needs to be merged with this
documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void merge(PdfDocument d, int mergeOptions) throws IOException, PdfException
d
- document that needs to be merged with this
documentmergeOptions
- combination of flags (constants) used for merging
documentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void merge(String path) throws IOException, PdfException
path
- pathname of the other document that needs to be
merged with this documentIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void merge(String path, int mergeOptions) throws IOException, PdfException
path
- pathname of the other document that needs to be
merged with this documentmergeOptions
- combination of flags (constants) used for merging
documentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void setOnBookmarkMerge(PdfBookmarkMergeHandler onBookmarkMerge)
onBookmarkMerge()
event handler of specified user-class
instance is called when the bookmark tree of another document
is merged with that of this document. When another document is
merged with this document, bookmarks from the other document
are also merged with the bookmark tree of this document. Handle
this event to place the bookmarks of the other document under a
newly created bookmark.onBookmarkMerge
- user-class instance whose onBookmarkMerge() needs to
be calledpublic void setOnRenameField(PdfFormFieldRenameHandler pfrh)
onRenameField()
event handler of specified user-class instance
is called when a duplicate field is encountered in a
document-merge operation. Use the event handler to provide a
different name for the duplicate field.pfrh
- user-class instance whose onRenameField() needs to
be calledpublic void deletePages(String pageRange) throws PdfException
PdfDocument
.pageRange
- page range from which pages need to be deletedPdfException
- if an illegal argument is supplied.public void extractPagesTo(String path, String pageRange) throws IOException, PdfException
path
- pathname of the file to which the pages are to be
addedpageRange
- page range whose pages are to be extractedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void extractPagesTo(String path, String pageRange, String extractAsVersion, boolean openAfterExtraction) throws IOException, PdfException
path
- pathname of the file to which the pages are to be
addedpageRange
- page range whose pages are to be extractedextractAsVersion
- PDF version in which pages are extracted and saved
to the new fileopenAfterExtraction
- whether the output file is to be opened after it is
written toIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfFormFieldRenameHandler
,
setOnRenameField(PdfFormFieldRenameHandler)
public void split(String pageRange) throws IOException, PdfException
Specifying pageRange
as "1-10" on a 12-page
document will create a new document 1-10.pdf containing
all pages from 1 to 10.
The name of the new document can be obtained and changed at run
time using the
onNeedFileName()
event.
pageRange
- pages that need to be extractedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.setOnNeedFileName(PdfNeedFileNameHandler)
public void split(int pages) throws IOException, PdfException
Calling split(5)
on a 12-page document will create
three new PDF documents, named 1-5.pdf, 6-10.pdf,
and 11-13.pdf. The file 1-5.pdf will contain
pages 1 to 5 of the original document. The file 6-10.pdf
will contain pages 6 to 10 of the original document. The file
11-12.pdf will contain pages 11 to 12 of the original
document.
Names for the new documents can be obtained and changed at run
time using the
onNeedFileName()
event.
pages
- number of consecutive pages that need to be
extracted for each new documentIOException
- if an I/O error occursPdfException
- if an illegal argument is supplied.setOnNeedFileName(PdfNeedFileNameHandler)
public void setOnNeedFileName(PdfNeedFileNameHandler pnfnh)
onNeedFileName()
event handler of specified user-class
instance is called when this document is being split and a
splinter document is created. Use the event handler to specify
a name for the splinter file.pnfnh
- user-class instance whose onNeedFileName() needs to
be calledsplit(int)
,
split(String)
public void addWatermarkImage(PdfImage image, int position, boolean applyPageMargins, double angle, boolean underlay, String pageRange) throws IOException, PdfException
PdfImage
object as watermark with its exact
position determined by position
and
applyPageMargins
.
Constants defined in PdfPage
can be used to align the
image inside the watermark.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
image
- PdfImage
object that needs to be used
as the watermark imageposition
- constant specifying the combination of vertical and
horizontal alignment of the imageapplyPageMargins
- whether page margins need to be considered when
positioning the imageangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxunderlay
- whether the image needs to be placed underneath
other page contentspageRange
- page range on whose pages the image needs to be
applied as the watermarkIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(PdfImage image, int position, double angle, boolean underlay, String pageRange) throws IOException, PdfException
PdfImage
object as watermark on pages in
specified page range.
Constants defined in PdfPage
can be used to align the
image inside the watermark.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
image
- PdfImage
object that needs to be used
as the watermark imageposition
- constant specifying the combination of vertical and
horizontal alignment of the imageangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxunderlay
- whether the image needs to be placed underneath
other page contentspageRange
- page range on whose pages the image needs to be
applied as the watermarkIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(String path, int position, boolean applyPageMargins, double angle, boolean underlay, String pageRange) throws IOException, PdfException
position
and
applyPageMargins
on pages in specified page range.
Constants defined in PdfPage
can be used to align the
image inside the watermark.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
path
- pathname of the watermark imageposition
- constant specifying the combination of vertical and
horizontal alignment of the imageapplyPageMargins
- whether page margins need to be considered when
positioning the imageangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxunderlay
- whether the image needs to be placed underneath
other page contentspageRange
- page range on whose pages the image needs to be
applied as the watermarkIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(String path, int position, double angle, boolean underlay, String pageRange) throws IOException, PdfException
Constants defined in PdfPage
can be used to align the
image inside the watermark.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
path
- pathname of the watermark imageposition
- constant specifying the combination of vertical and
horizontal alignment of the imageangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxunderlay
- whether the image needs to be placed underneath
other page contentspageRange
- page range on whose pages the image needs to be
applied as the watermarkIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkText(String text, PdfFont font, int position, boolean applyPageMargins, double angle, boolean underlay, String pageRange) throws IOException, PdfException
position
and
applyPageMargins
on pages in specified page range.
Constants defined in PdfPage
can be used to align the
text inside the watermark.
The text is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
text
- text that needs to be added as the watermarkfont
- font with which the watermark needs to be writtenposition
- constant specifying the combination of vertical and
horizontal alignment of the textapplyPageMargins
- whether page margins need to be considered when
positioning the textangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxunderlay
- whether the text needs to be placed underneath other
page contentspageRange
- page range on whose pages the text needs to be
applied as the watermarkIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkText(String text, PdfFont font, int position, double angle, boolean underlay, String pageRange) throws IOException, PdfException
Constants defined in PdfPage
can be used to align the
text inside the watermark.
The text is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
text
- text to be displayed as watermarkfont
- font with which the watermark needs to be writtenposition
- constant specifying the combination of vertical and
horizontal alignment of the textangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxunderlay
- whether the text needs to be placed underneath other
page contentspageRange
- page range on whose pages the text needs to be
applied as the watermarkIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkText(String text, PdfFont font, PdfRect rect, int alignment, int firstLinePosition, int position, double angle, boolean underlay, String pageRange) throws IOException, PdfException
text
- text that needs to be used as watermarkfont
- font with which the watermark text needs to be
renderedrect
- rectangular area inside which the watermark needs to
be renderedalignment
- constant
specifying text
alignmentfirstLinePosition
- starting position of the first line of the watermark
textposition
- constant specifying the combination of vertical and
horizontal alignment of the textangle
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxunderlay
- whether the text needs to be placed underneath other
page contentspageRange
- pages where the watermark need to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(int namedAction, String title, PdfBookmark parent) throws IOException, PdfException
parent
)
with specified title, and sets the bookmark to perform
specified named action.namedAction
- action to be be performed when bookmark is selectedtitle
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo) throws PdfException, IOException
parent
)
with specified title, and sets the bookmark to lead to
specified page.title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that is to be displayed when
bookmark is selectedparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo, double left, double top, double zoom) throws PdfException, IOException
parent
)
with specified title, and sets the bookmark to lead to
specified location on specified page with specified zoom.title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that is to be displayed when
bookmark is selectedleft
- offset of the position from (0, top) (expressed in
points)top
- offset of the position from (left, 0) (expressed in
points)zoom
- zoom factor to be applied when displaying the pageparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo, double x, double y, double width, double height) throws PdfException, IOException
parent
),
and sets the bookmark's
destination
to a rectangular area with specified top-left corner
(x
, y
), width and height.title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that needs to be displayed when
bookmark is selected by the userx
- x-coordinate of the top-left corner of the
rectangular areay
- y-coordinate of the top-left corner of the
rectangular areawidth
- width of the rectangular areaheight
- height of the rectangular areaparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo, double pos, int fit) throws PdfException, IOException
parent
),
and sets the bookmark's destination specified by
pageNo
, pos
and fit
.
fit |
pos |
Page Display |
---|---|---|
PdfBookmark.FITH |
vertical coordinate of destination |
|
PdfBookmark.FITBH |
vertical coordinate of destination |
|
PdfBookmark.FITBV |
horizontal coordinate of destination |
|
PdfBookmark.FITV |
horizontal coordinate of destination |
|
title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that is to be displayed when
bookmark is selectedpos
- horizontal or vertical coordinate of the bookmark's
destinationfit
- constant determining how page is displayed inside
windowparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo, int fit) throws PdfException, IOException
parent
)
with specified title, and sets the bookmark's destination
specified by pageNo
and fit
.title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that is to be displayed when
bookmark is selectedfit
- constant determining how page is displayed inside
window (Always is PdfBookmark.FITB
)parent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo, PdfRect rect) throws PdfException, IOException
parent
)
with specified title and sets the bookmark to lead to specified
rectanglular area on specified page.title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that is to be displayed when
bookmark is selectedrect
- rectangle on the specified pageparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, int pageNo, Rectangle rect) throws PdfException, IOException
parent
)
with specified title, and sets the bookmark to lead to
specified rectangular area on specified page.title
- text that needs to be used to display the bookmarkparent
- bookmark under which the new bookmark is to be
createdpageNo
- number of the page that is to be displayed when
bookmark is selectedrect
- rectangular area on the specified pageparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, String applicationToLaunch, boolean print) throws PdfException, IOException
parent
), and sets
it to launch a specified application or print a specified file.
If print
is true
, then the file
applicationToLaunch
will be printed by the viewer
using the file type's default application. If
print
is false
, then file
applicationToLaunch
will be considered as an
aplication and launched by the viewer using the Operating
Sytem's (OS') default shell program.title
- text that needs to be used to display the bookmarkparent
- bookmark below which the new bookmark needs to be
createdapplicationToLaunch
- application that needs to be launched (if
print
were false) or the file that
needs to be printed (if print
was true)print
- whether the file applicationToLaunch
needs to be printedparent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, String javascriptOrURI, int actionType) throws PdfException, IOException
parent
) and sets
it execute a Javascript script or resolve a URI (Uniform
Resource Identifier).title
- text that needs to be used to display the bookmarkparent
- bookmark below which the new bookmark needs to be
createdjavascriptOrURI
- Javascript script that needs to be executed or the
URI that needs to be resolvedactionType
- constant identifying the action as a Javascript
action (PdfAction.JAVASCRIPT
) or a URI
action (PdfAction.URI
)parent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark addBookmark(String title, PdfBookmark parent, String pdfFileName, int pageNo, boolean newWindow) throws PdfException, IOException
parent
),
and sets it to open a specified page on a specified PDF
document in the same window or a new window of the viewer.title
- text that needs to be used to display the bookmarkparent
- bookmark below which the new bookmark needs to be
createdpdfFileName
- pathname of the PDF document that needs to be openedpageNo
- number of the page in the PDF documentnewWindow
- whether to open the PDF document in a new window. If
set to false
, the document is opened in
the same window.parent
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public PdfBookmark getBookmarkRoot() throws IOException, PdfException
PdfBookmark
object that points to the
root of the bookmark tree of this PdfDocument
.
Should be used only if the PdfDocument
was
created with a PdfWriter
object.
The root is at the top of the hierarchy that contains bookmarks
displayed in the document outline. The
PdfBookmark.getFirstChild()
method can be used on the
PdfBookmark
returned by
getBookmarkRoot()
to navigate to the first
bookmark in the document outline.
PdfBookmark
object that points to the root
of the bookmark treePdfException
- An illegal argument was suppliedIOException
getFirstBookmark()
,
removeBookmarkRoot()
public void removeBookmarkRoot()
getBookmarkRoot()
,
getFirstBookmark()
public PdfBookmark getFirstBookmark() throws IOException, PdfException
PdfDocument
's
document outline. Should be used only if the
PdfDocument
was created with a
PdfReader
object.PdfBookmark
object of the first bookmark
in the document outlinePdfException
- if an illegal argument is supplied.IOException
getBookmarkRoot()
,
removeBookmarkRoot()
public void add(PdfPage p) throws PdfException
PdfPage
to this
PdfDocument
.
It is not recommended that a PdfPage
object is
added to the same document or to multiple documents more than
once. If at all necessary, it is better to clone the
PdfPage
object as many times.
p
- PdfPage
to be addedPdfException
- if an illegal argument is supplied.public void add(PdfPage p, boolean setAsCurrentPage) throws PdfException
PdfPage
to this
PdfDocument
and, if setAsCurrentPage
is true, sets the PdfPage
as the
PdfDocument
's current page.
By default, the first page that is added to a
PdfDocument
is the default current page. If some
content has been written directly to a PdfDocument
that is without first adding a page, then a default page is
automatically added to it and becomes its current page.
p
- PdfPage
to be addedsetAsCurrentPage
- whether the PdfPage
should be set as
the current pagePdfException
- if an illegal argument is supplied.public void addFooterImage(PdfImage img, int position, boolean underlay, String pageRange) throws IOException, PdfException
PdfImage
object to footer of pages in
specified page range.
Constants defined in PdfPage
can be used to align the
image inside the footer.
img
- PdfImage
object to be used in the
footerposition
- constant specifying combination of vertical and
horizontal alignment of the image within the footerunderlay
- whether the image needs to be placed underneath
other page elementspageRange
- page range on whose pages the image is to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addFooterImage(String path, int position, boolean underlay, String pageRange) throws IOException, PdfException
Constants defined in PdfPage
can be used to align the
image inside the footer.
path
- pathname of the imageposition
- constant specifying combination of vertical and
horizontal alignment of the image within the footerunderlay
- whether the image needs to be placed underneath
other content in the footerpageRange
- page range on whose pages the image is to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addFooterText(String text, PdfFont font, int position, boolean underlay, String pageRange) throws IOException, PdfException
Constants defined in PdfPage
can be used to align the
text inside the footer.
text
- text to be added to the footerfont
- font with which the text next needs to be writtenposition
- constant specifying the combination of vertical and
horizontal alignment of the text within the footerunderlay
- whether the text needs to be placed underneath other
content in the footerpageRange
- page range on whose pages the text is to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addFooterText(String text, PdfFont font, PdfRect rect, int alignment, int firstLinePosition, int position, boolean underlay, String pageRange) throws IOException, PdfException
text
- text that needs to be added as the footerfont
- font with which the text next needs to be writtenrect
- rectangular area where the footer needs to be
renderedalignment
- constant
specifying text
alignmentfirstLinePosition
- starting position of the first line of the header
textposition
- constant
specifying the combination
of vertical and horizontal alignment of the textunderlay
- whether the footer needs to be placed underneath
other page elementspageRange
- pages on which the header needs to be renderedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderImage(PdfImage img, int position, boolean underlay, String pageRange) throws IOException, PdfException
PdfImage
object to header of pages in
specified page range.
Constants defined in PdfPage
can be used to align the
image inside the header.
img
- PdfImage
object that needs to be added
to the headerposition
- constant specifying the combination of vertical and
horizontal alignment of the image within the headerunderlay
- whether the image needs to be placed underneath
other content in the headerpageRange
- page range on whose pages the image is to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderImage(String path, int position, boolean underlay, String pageRange) throws IOException, PdfException
Constants defined in PdfPage
can be used to align the
image inside the header.
path
- pathname of the imageposition
- constant specifying combination of vertical and
horizontal alignment of the image within the headerunderlay
- whether the image needs to be placed underneath
other content in the headerpageRange
- page range on whose pages the image is to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderText(String text, PdfFont font, int position, boolean underlay, String pageRange) throws IOException, PdfException
Constants defined in PdfPage
can be used to align the
text inside the watermark.
text
- text to be added to headerfont
- font with which the text next needs to be writtenposition
- combination of vertical and horizontal alignmentunderlay
- whether the text needs to be placed underneath other
content in the headerpageRange
- page range on whose pages the text is to be addedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderText(String text, PdfFont font, PdfRect rect, int alignment, int firstLinePosition, int position, boolean underlay, String pageRange) throws IOException, PdfException
text
- text that needs to be used as a headerfont
- font with which the header text is renderedrect
- rectangular area inside which the header needs to be
renderedalignment
- constant
specifying text
alignmentfirstLinePosition
- starting position of the first line of the header
textposition
- constant
specifying the combination
of vertical and horizontal alignment of the textunderlay
- whether the header needs to be placed underneath
other page elementspageRange
- pages on which the header needs to be renderedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawArc(PdfRect rect, double startAngle, double arcAngle) throws IOException, PdfException
PdfDocument
. Rectangle rect
represents bounding box of an imaginary circle that completes
the arc. The arc begins at startAngle
degrees and
spans for arcAngle
degrees.
startAngle
is measured in anti-clockwise
direction.rect
- bounding box of the imaginary circle that completes
the arcstartAngle
- (measured in anti-clockwise direction and expressed
in degrees) angle from which the arc needs to beginarcAngle
- (expressed in degrees) angle for which the arc needs
to spanIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawArc(PdfRect rect, double startAngle, double arcAngle, String pageRange) throws IOException, PdfException
rect
represents bounding box of an imaginary
circle that completes the arc. The arc begins at
startAngle
degrees and spans for
arcAngle
degrees. startAngle
is
measured in anti-clockwise direction.rect
- bounding box of the imaginary circle that completes
the arcstartAngle
- (measured in anti-clockwise direction and expressed
in degrees) angle from which the arc needs to beginarcAngle
- (expressed in degrees) angle for which the arc needs
to spanpageRange
- page page range on whose pages the arc needs to be
drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawBezierCurve(double startX, double startY, double ctrlX, double ctrlY, double endX, double endY, boolean isFill, boolean isStroke) throws IOException, PdfException
PdfDocument
. The curves
starts at (startX
, startY
) and ends
at (endX
, endY
with its control point
being at (ctrlX
, ctrlY
).startX
- x-coordinate of starting point of the curvestartY
- y-coordinate of starting point of the curvectrlX
- x-coordinate of control point of the curvectrlY
- y-coordinate of control point of the curveendX
- x-coordinate of end point of the curveendY
- y-coordinate of end point of the curveisFill
- whether the curve needs to be filledisStroke
- whether the curve needs to be strokedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawBezierCurve(double startX, double startY, double ctrlX, double ctrlY, double endX, double endY, boolean isFill, boolean isStroke, String pageRange) throws IOException, PdfException
PdfDocument
.
The curves starts at (startX
, startY
)
and ends at (endX
, endY
with its
control point being at (ctrlX
, ctrlY
).startX
- x-coordinate of starting point of the curvestartY
- y-coordinate of starting point of the curvectrlX
- x-coordinate of control point of the curvectrlY
- y-coordinate of control point of the curveendX
- x-coordinate of end point of the curveendY
- y-coordinate of end point of the B?zier curveisFill
- whether the curve needs to be filledisStroke
- whether the curve needs to be strokedpageRange
- page range on whose pages the curve needs to be
drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawBezierCurve(double startX, double startY, double ctrlX1, double ctrlY1, double ctrlX2, double ctrlY2, double endX, double endY, boolean isFill, boolean isStroke) throws IOException, PdfException
PdfDocument
. The curve starts at (
startX
, startY
) and ends at (
endX
, endY
. Its first control point
is at (ctrlX1
, ctrlY1
). Its second
control point is at (ctrlX2
, ctrlY2
).startX
- x-coordinate of starting point of the curvestartY
- y-coordinate of starting point of the curvectrlX1
- x-coordinate of first control point of the curvectrlY1
- y-coordinate of first control point of the curvectrlX2
- x-coordinate of second control point of the curvectrlY2
- y-coordinate of second control point of the curveendX
- x-coordinate of end point of the curveendY
- y-coordinate of end point of the curveisFill
- whether the curve needs to be filledisStroke
- whether the curve needs to be strokedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawBezierCurve(double startX, double startY, double ctrlX1, double ctrlY1, double ctrlX2, double ctrlY2, double endX, double endY, boolean isFill, boolean isStroke, String pageRange) throws IOException, PdfException
PdfDocument
. The
curve starts at (startX
, startY
) and
ends at (endX
, endY
. Its first
control point is at (ctrlX1
, ctrlY1
).
Its second control point is at (ctrlX2
,
ctrlY2
).startX
- x-coordinate of starting point of the curvestartY
- y-coordinate of starting point of the curvectrlX1
- x-coordinate of first control point of the curvectrlY1
- y-coordinate of first control point of the curvectrlX2
- x-coordinate of second control point of the curvectrlY2
- y-coordinate of second control point of the curveendX
- x-coordinate of end point of the curveendY
- y-coordinate of end point of the curveisFill
- whether the curve needs to be filledisStroke
- whether the curve needs to be strokedpageRange
- page range on whose pages the curve needs to be
drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawCircle(double x, double y, double radius, boolean isFill, boolean isStroke) throws IOException, PdfException
PdfDocument
's current page. The circle's center is
positioned at (x
, y
).x
- x-coordinate of the center of the circley
- y-coordinate of the center of the circleradius
- radius of the circleisFill
- whether the circle needs to be filledisStroke
- whether the circle needs to be strokedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawCircle(double x, double y, double radius, boolean isFill, boolean isStroke, String pageRange) throws IOException, PdfException
PdfDocument
. The circle's center is
positioned at (x
, y
).x
- x-coordinate of the center of the circley
- y-coordinate of the center of the circleradius
- radius of the circleisFill
- whether the circle needs to be filledisStroke
- whether the circle needs to be strokedpageRange
- pages on which the circle needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawEllipse(double x1, double y1, double x2, double y2, boolean isFill, boolean isStroke) throws IOException, PdfException
PdfDocument
's current
page. Top-left corner of ellipse's bounding box is specified by
(x1
, y1
). Bottom-right corner of
ellipse's bounding box is specified by (x2
,
y2
).x1
- x-coordinate of the top-left corner of the ellipse's
bounding boxy1
- y-coordinate of the top-left corner of the ellipse's
bounding boxx2
- x-coordinate of the bottom-right corner of the
ellipse's bounding boxy2
- y-coordinate of the bottom-right corner of the
ellipse's bounding boxisFill
- whether the ellipse needs to be filledisStroke
- whether the ellipse needs to be strokedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawEllipse(double x1, double y1, double x2, double y2, boolean isFill, boolean isStroke, String pageRange) throws IOException, PdfException
PdfDocument
's current page. Top-left corner of
ellipse's bounding box is specified by (x1
,
y1
). Bottom-right corner of ellipse's bounding box
is specified by (x2
, y2
).x1
- x-coordinate of the top-left corner of the ellipse's
bounding boxy1
- y-coordinate of the top-left corner of the ellipse's
bounding boxx2
- x-coordinate of the bottom-right corner of the
ellipse's bounding boxy2
- y-coordinate of the bottom-right corner of the
ellipse's bounding boxisFill
- whether the ellipse needs to be filledisStroke
- whether the ellipse needs to be strokedpageRange
- pages on which the ellipse needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y) throws IOException, PdfException
x
,
y
) on this PdfDocument
's current
page.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, boolean scaleToFit, boolean stretch) throws IOException, PdfException
x
,
y
) with specified stretching and aspect ratio
settings on the document's current page. The scaleToFit and
stretch arguments are useful when the full size of the image
cannot be fit within the page at the specified location. If
scaleToFit and stretch are false, then the part of the image
that cannot be displayed within the page will be clipped out.
If scaleToFit is true and stretch is false, then width or
height (whichever is lower) of the image will be scaled to meet
the right or bottom edge of the page. If scaleToFit is true and
stretch is true, then both width and height of the image will
be scaled to meet the image meet the the right and bottom edges
of the page. stretch will be considered only if scaleToFit is
true.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagescaleToFit
- whether image needs to be scaled (horizontally,
vertically, or both) to fit within the the area
available in the pagestretch
- whether both width and height of the image should be
stretched to fit the area available in the pageIOException
- if I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, boolean scaleToFit, boolean stretch, String pageRange) throws IOException, PdfException
x
,
y
) with specified stretching and aspect ratio
settings on specified pages. The scaleToFit and stretch
arguments are useful when the full size of the image cannot be
fit within the page at the specified location. If scaleToFit
and stretch are false, then the part of the image that cannot
be displayed within the page will be clipped out. If scaleToFit
is true and stretch is false, then width or height (whichever
is lower) of the image will be scaled to meet the right or
bottom edge of the page. If scaleToFit is true and stretch is
true, then both width and height of the image will be scaled to
meet the image meet the the right and bottom edges of the page.
stretch will be considered only if scaleToFit is true.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagescaleToFit
- whether image needs to be scaled (horizontally,
vertically, or both) to fit within the the area
available in the pagestretch
- whether both width and height of the image should be
stretched to fit the area available in the pagepageRange
- pages on which the image needs to be drawnIOException
- if I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double rotation) throws IOException, PdfException
rotation
degrees
at position (x
, y
) on this
PdfDocument
's current page.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagerotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height) throws IOException, PdfException
x
,
y
) with specified height and width on this
PdfDocument
's current page.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the imageheight
- height of the imageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation) throws IOException, PdfException
rotation
degrees
at position (x
, y
) with specified
height and width on this PdfDocument
's current
page.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the imageheight
- height of the imagerotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio) throws IOException, PdfException
img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the image on the pageheight
- height of the image on the pagerotation
- degrees of rotation of the image (in anti-clockwise
direction)preserveAspectRatio
- whether aspect ratio needs to be maintained when the
image is rendered inside the specified regionIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, String pageRange) throws IOException, PdfException
rotation
degrees
at position (x
, y
) with specified
height and width on pages in specified page range.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the imageheight
- height of the imagerotation
- degrees of rotation of the image (in anti-clockwise direction)pageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, String pageRange, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio, String pageRange) throws IOException, PdfException
img
- PDF image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the imageheight
- height of the imagerotation
- degrees of rotation of the image (in anti-clockwise direction)preserveAspectRatio
- whether aspect ratio needs to be maintained when the
image is rendered inside the specified regionpageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio, String pageRange, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y, double width, double height, String pageRange) throws IOException, PdfException
x
,
y
) with specified height and width on pages in
specified page range.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the imageheight
- height of the imagepageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double width, double height, boolean preserveAspectRatio, String pageRange) throws IOException, PdfException
img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagewidth
- width of the imageheight
- height of the imagepreserveAspectRatio
- whether aspect ratio needs to be maintained when the
image is rendered inside the specified regionpageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double rotation, String pageRange) throws IOException, PdfException
rotation
degrees at
position (x
, y
) on pages in specified
page range.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagerotation
- degrees of rotation of the image (in anti-clockwise direction)pageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, String pageRange) throws IOException, PdfException
x
, y
)
on pages in specified page range.img
- image that needs to be drawnx
- x-coordinate of the image on the pagey
- y-coordinate of the image on the pagepageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt) throws IOException, PdfException
PdfDocument
's current page.img
- image that needs to be drawnpt
- point where the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, double rotation) throws IOException, PdfException
rotation
degrees
at specified point on this PdfDocument
's current
page.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
img
- image that needs to be drawnpt
- point where the image needs to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, double width, double height) throws IOException, PdfException
PdfDocument
's current page.img
- image that needs to be drawnpt
- point where the image needs to be drawnwidth
- width of the imageheight
- height of the imageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, double width, double height, double rotation) throws IOException, PdfException
rotation
degrees
at specified point on this PdfDocument
's current
page.img
- image that needs to be drawnpt
- point where the image needs to be drawnwidth
- width of the imageheight
- height of the imagerotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, double width, double height, double rotation, String pageRange) throws IOException, PdfException
rotation
degrees
at specified point with specified width and height on pages in
the specified page range.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
img
- image that needs to be drawnpt
- point where the image needs to be drawnwidth
- width of the imageheight
- height of the imagerotation
- degrees of rotation of the image (in anti-clockwise direction)pageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, double width, double height, String pageRange) throws IOException, PdfException
img
- image that needs to be drawnpt
- point where the image needs to be drawnwidth
- width of the imageheight
- width of the imagepageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, double rotation, String pageRange) throws IOException, PdfException
rotation
degrees
at specified point on pages in the specified page range.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
img
- image that needs to be drawnpt
- point where the image needs to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)pageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint pt, String pageRange) throws IOException, PdfException
img
- image that needs to be drawnpt
- point where the image needs to be drawnpageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect) throws IOException, PdfException
PdfDocument
's current page.img
- image that needs to be drawnrect
- PdfRectangle
object inside which the
image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect, double rotation) throws IOException, PdfException
rotation
degrees
inside specified rectangle on this PdfDocument
's
current page.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
img
- image that needs to be drawnrect
- rectangle on which the image needs to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect, double rotation, boolean preserveAspectRatio) throws IOException, PdfException
img
- image that needs to be drawrect
- page region on which the image needs to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)preserveAspectRatio
- specifies whether aspect ratio needs to be maintained
when the image needs is rendered on the specified regionIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect, double rotation, String pageRange) throws IOException, PdfException
rotation
degrees
inside specified rectangle on pages in specified range.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
img
- image that needs to be drawnrect
- PdfRect
object of the rectangle inside
which the image is to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)pageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect, double rotation, boolean preserveAspectRatio, String pageRange) throws IOException, PdfException
img
- image that needs to be drawnrect
- page region on which the image needs to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)preserveAspectRatio
- specifies whether aspect ratio needs to be maintained
when the image needs is rendered on the specified regionpageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect, String pageRange) throws IOException, PdfException
img
- image that needs to be drawnrect
- rectangle on which the image needs to be drawnpageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfRect rect, boolean preserveAspectRatio, String pageRange) throws IOException, PdfException
img
- image that needs to be drawnrect
- rectangle on which the image needs to be drawnpreserveAspectRatio
- specifies whether aspect ratio needs to be maintained
when the image needs is rendered on the specified regionpageRange
- pages on which the image needs to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, double x, double y) throws IOException, PdfException
x
, y
) on this
PdfDocument
's current page.path
- pathname of the image filex
- x-coordinate of the image on the pagey
- y-coordinate of the position where the image needs
to be drawnIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, double x, double y, double rotation) throws IOException, PdfException
rotation
degrees at position (x
,
y
) on this PdfDocument
's current
page.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
path
- pathname of the image filex
- x-coordinate of the image on the pagey
- y-coordinate of the position where the image needs
to be drawnrotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, double x, double y, double width, double height) throws IOException, PdfException
PdfDocument
's
current page.path
- pathname of the image filex
- x-coordinate of the image on the pagey
- y-coordinate of the position where the image needs
to be drawnwidth
- width of the imageheight
- height of the imageIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, double x, double y, double width, double height, double rotation) throws IOException, PdfException
rotation
degrees at position (x
,
y
) with specified width and height on this
PdfDocument
's current page.
The image is rotated on center of its bounding box by
angle
degrees in anti-clockwise direction.
path
- pathname of the image filex
- x-coordinate of the image on the pagey
- y-coordinate of the position where the image needs
to be drawnwidth
- width of the imageheight
- height of the imagerotation
- degrees of rotation of the image (in anti-clockwise direction)IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.