public final class PdfPage extends Object
PdfPage
offers
numerous methods to work with elements such as text, shapes,
images, annotations, and bookmarks.
After content is written to a page, it is usually added to a
PdfDocument
object using the
PdfDocument.add(PdfPage)
method. A
PdfPage
object can be cloned using the
clone()
method and then added to a
PdfDocument
one more time. However, the
same PdfPage
object can be added to multiple
PdfDocument
object without cloning.
// Creates several PdfDocument objects PdfDocument doc1 = ... PdfDocument doc2 = ... PdfDocument doc1 = ... ... PdfDocument docn = ... // Creates a PdfPage object PdfPage page = new PdfPage(); // Performs operations with the above PdfPage object ... // Adds the same PdfPage object to the PdfDocument objects // created above doc1.add(page); doc2.add(page); doc3.add(page); ... docn.add(page); ...
While writing to a page, 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 page. Whenever coordinates, position, or sizes are used, they are usually applied in terms of the page's current measurement unit, which can be centimeters, inches, pixels, points, and twips. However, in situations where a measurement unit cannot be applied or determined, the measurement unit will be by default points.
Every page 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.
Modifier and Type | Field and Description |
---|---|
static int |
COLORSPACE_CMYK
Constant specifying CMYK (Cyan-Magenta-Yellow-blacK)
colorspace.
|
static int |
COLORSPACE_RGB
Constant specifing RGB (Red-Green-Blue) colorspace.
|
static int |
HP_LEFT
Constant to specify horizontal alignment to the left (inside
header, footer and watermarks)
|
static int |
HP_MIDDLE
Constant to specify horizontal alignment to the middle (inside
header, footer and watermarks)
|
static int |
HP_RIGHT
Constant to specify horizontal alignment to the right (inside
header, footer and watermarks)
|
static boolean |
OVERLAY
Constant to specify z-order overlay
|
static boolean |
UNDERLAY
Constant to specify z-order underlay
|
static int |
VP_BOTTOM
Constant to specify vertical alignment to the bottom (inside
header, footer and watermarks)
|
static int |
VP_CENTRE
Constant to specify vertical alignment to the center (inside
header, footer and watermarks)
|
static int |
VP_TOP
Constant to specify vertical alignment to the top (inside
header, footer and watermarks)
|
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 |
---|
PdfPage()
Zero-argument default constructor.
|
PdfPage(double width,
double height)
Constructs a page with specified width and height.
|
PdfPage(double width,
double height,
double pageHeaderHeight,
double pageFooterHeight,
double pageLeftMargin,
double pageTopMargin,
double pageRightMargin,
double pageBottomMargin,
int measurementUnit)
Constructs a page with its width, height, header height, footer
height, and margins specified in specified
unit.
|
PdfPage(double width,
double height,
double pageLeftMargin,
double pageTopMargin,
double pageRightMargin,
double pageBottomMargin,
int measurementUnit)
Constructs a page with specified width, height, and margins (in
specified measurement unit).
|
PdfPage(double width,
double height,
int measurementUnit)
Constructs a page with specified width and height (in specified
measurement unit).
|
PdfPage(int pageSize)
Constructs a page with specified size.
|
PdfPage(int pageSize,
double pageHeaderHeight,
double pageFooterHeight,
double pageLeftMargin,
double pageTopMargin,
double pageRightMargin,
double pageBottomMargin,
int measurementUnit)
Constructs a page with specified size, header height, footer height,
and margins (in specified measurement unit).
|
PdfPage(int pageSize,
double pageLeftMargin,
double pageTopMargin,
double pageRightMargin,
double pageBottomMargin,
int measurementUnit)
Constructs a page with specified size and margins (in specified
measurement unit).
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(int event,
int namedAction)
Adds specified
named action for
specified trigger event.
|
void |
addAction(int event,
int actionType,
String javascriptOrURI)
Adds action of resolving specified Uniform Resource Identifier
URI) or executing a JavaScript script for the specified event.
|
void |
addAction(int event,
int actionType,
String applicationToLaunch,
boolean isPrint)
Adds action of launching specified application, or displaying
or printing specified file for the specified event.
|
void |
addAnnotation(PdfAnnot annotation)
Adds specified annotation to this
PdfPage . |
void |
addAnnotationList(List annotList)
Adds specified annotations to the page.
|
void |
addAnnotationList(List annotList,
boolean removeExistingAnnots)
Adds specified annotations to the page and removes existing
annotation if specified.
|
void |
addFooterImage(PdfImage img,
int position,
boolean underlay)
Adds
PdfImage object to footer. |
void |
addFooterImage(PdfImage img,
int position,
boolean underlay,
boolean scaleToFit,
boolean stretch) |
void |
addFooterImage(String path,
int position,
boolean underlay)
Adds image, specified by its pathname, to footer.
|
void |
addFooterImage(String path,
int position,
boolean underlay,
boolean scaleToFit,
boolean stretch) |
void |
addFooterText(String text,
PdfFont font,
int position,
boolean underlay)
Adds specified text to footer.
|
void |
addFooterText(String text,
PdfFont font,
PdfRect rect,
int alignment,
int firstLinePosition,
int position,
boolean underlay)
Adds specified text to footer.
|
void |
addFormField(PdfFormField f)
Adds specified form field to page.
|
void |
addFormFieldList(List formFieldList)
Adds specified form fields to the page.
|
void |
addHeaderImage(PdfImage img,
int position,
boolean underlay)
Adds
PdfImage object to the header. |
void |
addHeaderImage(PdfImage img,
int position,
boolean underlay,
boolean scaleToFit,
boolean stretch) |
void |
addHeaderImage(String path,
int position,
boolean underlay)
Adds image, specified by its pathname, to header.
|
void |
addHeaderImage(String path,
int position,
boolean underlay,
boolean scaleToFit,
boolean stretch) |
void |
addHeaderText(String text,
PdfFont font,
int position,
boolean underlay)
Adds specified text to header.
|
void |
addHeaderText(String text,
PdfFont font,
PdfRect rect,
int alignment,
int firstLinePosition,
int position,
boolean underlay)
Adds specified text to footer.
|
void |
addTable(PdfTable table,
double x,
double y)
Adds specified table at position (
x ,
y ) on the page. |
void |
addTable(PdfTable table,
PdfFont f,
double x,
double y)
Renders specified table with specified font at position (
x ,
y ) on the page. |
void |
addThumbnailImage(String path)
Adds image with specified pathname as the thumbnail for the
page.
|
void |
addWatermarkImage(PdfImage image,
int position,
boolean applyMargins,
double angle,
boolean underlay)
Adds
PdfImage object as watermark image with its
exact position determined by position and
applyMargins . |
void |
addWatermarkImage(PdfImage image,
int position,
double angle,
boolean underlay)
Adds
PdfImage object as watermark image. |
void |
addWatermarkImage(String path,
int position,
boolean applyMargins,
double angle,
boolean underlay)
Adds image, specified by its pathname, as watermark image with
its exact position determined by
position and
applyMargins . |
void |
addWatermarkImage(String path,
int position,
double angle,
boolean underlay)
Adds image, specified by its pathname, as watermark image.
|
void |
addWatermarkText(String text,
PdfFont font,
int position,
boolean applyMargins,
double angle,
boolean underlay)
Adds specified text as watermark with its exact position
determined by
position and
applyMargins . |
void |
addWatermarkText(String text,
PdfFont font,
int position,
double angle,
boolean underlay)
Adds specified text as watermark.
|
void |
addWatermarkText(String text,
PdfFont font,
PdfRect rect,
int alignment,
int firstLinePosition,
int position,
double angle,
boolean underlay)
Adds specified text as a watermark to a specified rectangular
area with specified font, alignment, first-line position,
position, rotation, and underlay settings.
|
Object |
clone() |
void |
deleteAnnotations()
Delete all annotations in the page.
|
void |
deleteAnnotations(int type)
Delete all annotations of the specified type in the page.
|
void |
deleteFormFields()
Removes all form fields in the page.
|
void |
deleteFormFields(int type)
Removes all form fields of specified type in the page.
|
void |
deleteFormFields(String name)
Removes form fields with specified name in the page.
|
void |
disableAllMargins()
Disables all margins on this
PdfPage . |
void |
drawArc(PdfRect rect,
double startAngle,
double sweepAngle)
Draws an arc.
|
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 control point specified by (
ctrlX , ctrlY ). |
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 control points at (
ctrlX1 , ctrlY1 ) and (
ctrlX2 , ctrlY2 ). |
void |
drawBezierCurve(PdfPoint start,
PdfPoint control,
PdfPoint end,
boolean isFill,
boolean isStroke)
Draws a Bézier curve with a single control point.
|
void |
drawBezierCurve(PdfPoint start,
PdfPoint controlPoint1,
PdfPoint controlPoint2,
PdfPoint end,
boolean isFill,
boolean isStroke)
Draws a Bézier curve with two control points.
|
void |
drawCircle(double x,
double y,
double radius,
boolean isFill,
boolean isStroke)
Draws a circle with its center at position (
x ,
y ). |
void |
drawCircle(PdfPoint center,
double radius,
boolean isFill,
boolean isStroke)
Draws a circle with its center at the specified point.
|
void |
drawEllipse(double x1,
double y1,
double x2,
double y2,
boolean isFill,
boolean isStroke)
Draws an ellipse whose bounding box has its top-left corner at
(
x1 , y1 ) and its bottom-right corner
at (x2 , y2 ). |
void |
drawEllipse(PdfPoint p1,
PdfPoint p2,
boolean isFill,
boolean isStroke)
Draws an ellipse whose bounding box has its top-left corner at
point1 and its bottom-right corner at
point2 . |
void |
drawImage(PdfImage img,
double x,
double y)
Draws specified image at position (
x ,
y ). |
void |
drawImage(PdfImage img,
double x,
double y,
boolean scaleToFit,
boolean stretch)
Draws an image at specified location with specified stretching
and aspect ratio settings.
|
void |
drawImage(PdfImage img,
double x,
double y,
double rotation)
Draws specified image, rotated by
rotation
degrees, at position (x , y ). |
void |
drawImage(PdfImage img,
double x,
double y,
double rotation,
boolean scaleToFit,
boolean stretch)
Draws an image at specified location with specified rotation,
stretching and aspect ratio settings.
|
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height)
Draws specified image at position (
x ,
y ) with specified width and height. |
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,
double rotation)
Draw specified image, rotated by
rotation degrees,
at position (x , y ) with specified
height and width. |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio) |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio,
int positionOfRotation) |
void |
drawImage(PdfImage img,
double x,
double y,
double width,
double height,
double rotation,
int positionOfRotation) |
void |
drawImage(PdfImage img,
PdfPoint p)
Draws specified image at specified point.
|
void |
drawImage(PdfImage img,
PdfPoint p,
double rotation)
Draws specified image, rotated by
rotation
degrees, at point p . |
void |
drawImage(PdfImage img,
PdfPoint p,
double width,
double height)
Draws specified image at point
p with specified
width and height. |
void |
drawImage(PdfImage img,
PdfPoint p,
double width,
double height,
double rotation)
Draws specified image, rotated by
rotation
degrees, at point p with specified width and
height. |
void |
drawImage(PdfImage img,
PdfRect rect)
Draws specified image on specified rectangle.
|
void |
drawImage(PdfImage img,
PdfRect rect,
boolean preserveAspectRatio) |
void |
drawImage(PdfImage img,
PdfRect rect,
double rotation)
Draws specified image, rotated by
rotation
degrees, on specified rectangle. |
void |
drawImage(PdfImage img,
PdfRect rect,
double rotation,
boolean preserveAspectRatio) |
void |
drawImage(String path,
double x,
double y)
Draws image, specified by its pathname, at position (
x , y ). |
void |
drawImage(String path,
double x,
double y,
double rotation)
Draw image, specified by its pathname and rotated by
rotation degrees, at position (x ,
y ). |
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. |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
boolean preserveAspectRatio) |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
boolean preserveAspectRatio,
int positionOfRotation) |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation)
Draws image, specified by its pathname and rotated by
rotation degrees, at position (x ,
y ) with specified width and height. |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio) |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
boolean preserveAspectRatio,
int positionOfRotation) |
void |
drawImage(String path,
double x,
double y,
double width,
double height,
double rotation,
int positionOfRotation) |
void |
drawImage(String path,
PdfPoint p)
Draws image, specified by its pathname, at point
p
. |
void |
drawImage(String path,
PdfPoint p,
double rotation)
Draws image, specified by its pathname and rotated by
rotation degrees, at point p . |
void |
drawImage(String path,
PdfPoint p,
double width,
double height)
Draws image, specified by its pathname, at point
p
with specified width and height. |
void |
drawImage(String path,
PdfPoint p,
double width,
double height,
double rotation)
Draws image, specified by its pathname and rotated by
rotation degrees, at point p with
specified width and height. |
void |
drawImage(String path,
PdfRect rect)
Draws image, specified by its pathname, on rectangle
rect . |
void |
drawImage(String path,
PdfRect rect,
boolean preserveAspectRatio) |
void |
drawImage(String path,
PdfRect rect,
double rotation)
Draws image, specified by its pathname and rotated by
rotation degrees, on rectangle rect . |
void |
drawImage(String path,
PdfRect rect,
double rotation,
boolean preserveAspectRatio) |
void |
drawLine(double startx,
double starty,
double endx,
double endy)
Draws a line between positions (
startx ,
starty ) and (endx , endy
). |
void |
drawLine(PdfPoint start,
PdfPoint end)
Draws a line between points
start and
end . |
void |
drawPie(double x,
double y,
double width,
double height,
double startAngle,
double sweepAngle,
boolean isFill,
boolean isStroke)
Draws a pie segment.
|
void |
drawPolygon(double[] xPoints,
double[] yPoints,
int nPoints,
boolean isFill,
boolean isStroke)
Draws a polygon.
|
void |
drawPolyline(double[] xPoints,
double[] yPoints,
int nPoints)
Draws a polyline.
|
void |
drawRect(double x,
double y,
double width,
double height)
Draws a rectangle at position (
x , y )
with specified width and height. |
void |
drawRect(double x,
double y,
double width,
double height,
boolean isFill,
boolean isStroke)
Draws a rectangle at position (
x , y )
with specified width, height, brush, and pen settings. |
void |
drawRect(PdfPoint p,
double width,
double height)
Draws a rectangle at specified point with specified width and
height.
|
void |
drawRect(PdfPoint p,
double width,
double height,
boolean isFill,
boolean isStroke)
Draws a rectangle at specified point with specified width,
height, brush, and pen settings.
|
void |
drawRect(PdfRect r)
Draws a rectangle.
|
void |
drawRect(Rectangle r)
Draws a rectangle with specified
Rectangle object. |
void |
drawRoundRect(double x,
double y,
double width,
double height,
double arcWidth,
double arcHeight,
boolean isFill,
boolean isStroke)
Draws a rectangle with rounded corners.
|
void |
drawRoundRect(PdfRect rect,
double arcWidth,
double arcHeight,
boolean isFill,
boolean isStroke)
Draws rectangle
rect with specified rounded
corners. |
void |
drawSquare(double x,
double y,
double length)
Draws a square at position (
x , y ). |
void |
drawSquare(double x,
double y,
double length,
boolean isFill,
boolean isStroke)
Draws a square at position (
x , y )
with specified fill and stroke settings. |
void |
drawSquare(PdfPoint p,
double length)
Draws a square at point
p . |
void |
drawSquare(PdfPoint p,
double length,
boolean isFill,
boolean isStroke)
Draws a square at point
p with specified fill and
stroke settings. |
void |
enableAllMargins()
Enables all margins on this
PdfPage . |
void |
enumPageElements(int elementTypes,
PdfEnumPageElementsHandler pdfEnumPageElementsHandler)
Parse all instances of specified page element type(s) and call
PdfEnumPageElementsHandler.onEnumPageElements(int, int, PdfPageElement, boolean[])
event handler of the specified class instance. |
List |
extractText()
Returns all text content from the page.
|
PdfSearchElement |
findFirst(String searchString,
int searchMode,
int searchOptions,
boolean isSearchForward)
Searches for specified text in the page and returns the first
match.
|
PdfSearchElement |
findNext(PdfSearchElement currentSearchElement)
Returns the successor of specified search element.
|
PdfSearchElement |
findPrevious(PdfSearchElement currentSearchElement)
Returns the predecessor of specified search element.
|
void |
flattenFormFields()
Removes interactivity but retains normal appearance of all form
fields in the page.
|
void |
flattenFormFields(boolean flattenWithNewValue)
Removes interactivity but retains normal appearance of all form
fields and also sets run-time values of the form fields if
required.
|
void |
flattenFormFields(int type)
Removes interactivity but retains normal appearance of form
fields of specified type in the page.
|
void |
flattenFormFields(int type,
boolean flattenWithNewValue)
Removes interactivity but retains normal appearance of form
fields of specified type in the page, and also sets run-time
values of the form fields if required.
|
void |
flattenFormFields(String name)
Removes interactivity but retains normal appearance of form
fields with specified name in the page.
|
void |
flattenFormFields(String name,
boolean flattenWithNewValue)
Removes interactivity but retains normal appearance of form
fields with specified name in the page, and also sets run-time
values of the form fields if required.
|
List |
getAllAnnotations()
Returns all annotations in the page.
|
List |
getAllAnnotations(int type)
Returns all annotations of specified type in the page.
|
void |
getAllAnnotations(int type,
List listToPopulate)
Populates specified list with all annotations of specified type
in the page.
|
void |
getAllAnnotations(List listToPopulate)
Populates specified list with all annotations in the page.
|
List |
getAllFontBaseNames()
Returns base names of all fonts used by the text in the page.
|
List |
getAllFormFields()
Returns a list of all form fields in the page.
|
List |
getAllFormFields(int type)
Returns a list of all form fields of specified type in the
page.
|
List |
getAllFormFields(String name)
Returns a list of all form fields with specified name in the
page.
|
double |
getBottomMargin()
Returns size of this page's bottom margin.
|
PdfBrush |
getBrush()
Returns default brush used on this page.
|
int |
getColorSpace()
Returns default colorspace of the page.
|
double |
getCropBottom()
Returns distance between the bottom edge of the page's boundary
and the page's crop box.
|
double |
getCropBottom(int unit)
Returns distance between the bottom edge of the page's boundary
and the page's crop box in specified measurement unit.
|
PdfRect |
getCropBox()
Returns crop box of the page.
|
PdfRect |
getCropBox(int unit)
Returns crop box of the page in specified measurement unit.
|
double |
getCropBoxHeight()
Returns height of the crop box of the page.
|
double |
getCropBoxWidth()
Returns width of the crop box.
|
double |
getCropLeft()
|
double |
getCropLeft(int unit)
Returns distance between the left edge of the page and the left
edge of the page's
crop box.
|
double |
getCropRight()
Returns difference between right boundaries of this page's
media box and
crop
box.
|
double |
getCropRight(int unit)
Returns distance between the right edge of the page and the
right edge of the page's
crop
box.
|
double |
getCropTop()
Returns difference between top boundaries of this page's media
box and
crop
box.
|
double |
getCropTop(int unit)
Returns distance between the top edge of the page and the top
edge of the page's
crop
box.
|
double |
getDisplayDuration()
Returns number of seconds for which the page presentation
effect (transition) specified for this page will take to
finish.
|
PdfFont |
getFont()
Returns default font used to render text elements on this page.
|
double |
getFooterHeight()
Returns height of this page's footer.
|
double |
getHeaderHeight()
Returns height of this page's footer.
|
double |
getHeight()
Returns height of this page.
|
double |
getLeftMargin()
Returns size of this page's left margin.
|
int |
getMeasurementUnit()
Returns default measurement unit currently used for this
PdfPage . |
PdfRect |
getMediaBox()
Returns
media
box of the page.
|
PdfRect |
getMediaBox(int unit)
Returns
media
box of the page in specified measurement unit.
|
List |
getPageElements(int elementTypes) |
PdfPen |
getPen()
Returns a
PdfPen object representing this page's
pen. |
PdfPagePresentation |
getPresentation()
Returns page presentation effect (transition) set for this
page.
|
double |
getRightMargin()
Returns size of this page's right margin.
|
int |
getRotation()
Returns angle of rotation for contents of this page.
|
PdfTextFormatter |
getTextFormatter()
Retrieves
PdfTextFormatter object contained by
this PdfPage . |
double |
getTopMargin()
Returns the size of this page's top margin.
|
double |
getWidth()
Returns width of this page.
|
boolean |
isPageEmpty() |
void |
redactRegion(PdfRect boundingRect,
boolean includeIntersectingText,
boolean clipRegion,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redacts all content in specified region, and fill/stroke the
redacted region if specified.
|
void |
redactRegion(PdfRect boundingRect,
boolean clipRegion,
PdfPen pen,
PdfBrush brush,
boolean isStroke,
boolean isFill)
Redacts all content in specified region, and fill/stroke the
redacted region if specified.
|
void |
redactText(String searchString,
int searchMode,
int searchOptions)
Searches for occurrences of specified text string in the page
and redacts them.
|
void |
redactText(String searchString,
int searchMode,
int searchOptions,
String replaceText,
PdfFont font,
boolean autoSizeText) |
void |
redactText(String searchString,
int searchMode,
int searchOptions,
String replaceText,
PdfFont font,
boolean autoSizeText,
boolean removeAssociatedAnnotations) |
void |
removeThumbnailImage()
Removes thumbnail image specified for this page.
|
void |
saveAsText(Writer writer)
Export all text content of the page to specified stream writer
instance.
|
List |
search(String searchString,
int searchMode,
int searchOptions)
Returns all occurrences of specified text in the page.
|
void |
setBrush(PdfBrush brush)
Specifies default brush used to stroke PDF elements on the
page.
|
void |
setBrushColor(Color c)
Specifies default color for this page's brush.
|
void |
setColorSpace(int colorspace)
Specifies default colorspace for the page.
|
void |
setCph(PdfCustomPlaceholderHandler cph)
Specifies an object of a user class that needs to use custom
placholders in text rendered on documents.
|
void |
setCropBottom(double cropBottom)
Sets position of left edge of the page's
crop
box.
|
void |
setCropBottom(double cropBottom,
int unit)
Sets the bottom edge of the page's
crop box
at specified distance from the bottom edge of the page.
|
void |
setCropBox(double cropLeft,
double cropTop,
double cropRight,
double cropBottom)
Sets
crop
box of the page at specified positions.
|
void |
setCropBox(double cropLeft,
double cropTop,
double cropRight,
double cropBottom,
int unit)
Sets
crop
box of the page with specified boundaries in give
measurement unit.
|
void |
setCropBox(PdfRect rect)
Sets specified rectangle as the
crop
box of the page.
|
void |
setCropBox(PdfRect rect,
int unit)
Sets specified rectangle in specified measurement unit as the
crop
box of the page.
|
void |
setCropLeft(double cropLeft)
Sets left edge of the
crop
box at specified distance from the left edge of the page.
|
void |
setCropLeft(double cropLeft,
int unit)
Sets left edge of the page's
crop box
at specified distance (in specified measurement unit) from the left
edge of the page.
|
void |
setCropRight(double cropRight)
Sets right edge of the
crop
box at specified distance from the right edge of the page.
|
void |
setCropRight(double cropRight,
int unit)
Sets right edge of the page's
crop
box at specified distance (in specified measurement unit)
from the right edge of the page.
|
void |
setCropTop(double cropTop)
Sets top edge of the
crop
box at specified distance from the top edge of the page.
|
void |
setCropTop(double cropTop,
int unit)
Sets top edge of the
crop
box at specified distance (in specified measurement unit) from
the top edge of the page.
|
void |
setDisplayDuration(double displayDuration)
Specifies number of seconds for which the page presentation
effect (transition) specified for this page needs to take to
finish.
|
void |
setFont(PdfFont font)
Specifies a default font that needs to be used render text
elements on this page.
|
void |
setHeight(double height,
int unit)
Sets specified height (in specified measurement unit) for the
page.
|
void |
setHeight(double height,
int unit,
boolean adjustCropBoxSize)
Sets specified height (in specified measuerment unit) for the
page and adjusts the height of the crop box height if
specified.
|
void |
setMeasurementUnit(int mu)
Specifies default measurement unit to be used for this
PdfPage . |
void |
setMediaBox(double left,
double top,
double width,
double height)
Sets
media
box of the page with specified dimensions.
|
void |
setMediaBox(double left,
double top,
double width,
double height,
int unit)
Sets
media
box of the page with specified dimensions (in specified
measurement unit).
|
void |
setMediaBox(PdfRect rect)
Sets
media
box of the page with specified rectangle.
|
void |
setMediaBox(PdfRect rect,
int unit)
Sets
media
box of the page with specified rectangle.
|
void |
setPen(PdfPen pen)
Sets specified
PdfPen object as this page's pen. |
void |
setPenCapStyle(int capStyle)
Specifies default shape of endpoints of paths in this page.
|
void |
setPenColor(Color color)
Specifies default color for this page's pen.
|
void |
setPenDashGap(double gap)
Specifies length of gaps in default
dash pattern
of this page's pen.
|
void |
setPenDashLength(double length)
Specifies length of dashes in default
dash pattern of this
PdfDocument's pen.
|
void |
setPenDashPhase(double phase)
Specifies length of phase of default
dash pattern of this
page's pen.
|
void |
setPenJoinStyle(int joinStyle)
Specifies default shape of joints of
paths that
connect at an angle for this pages's pen.
|
void |
setPenMiterLimit(int limit)
Specifies default miter limit for this page's pen.
|
void |
setPenWidth(double width)
Specifies default width for this page's pen.
|
void |
setPresentation(PdfPagePresentation presentation)
Sets specified page presentation effect (transition) for the page.
|
void |
setRotation(int rotation)
Specifies angle of rotation that viewer applications should
apply when displaying contents of this page.
|
void |
setSize(double width,
double height,
int unit)
Sets specified width and height (in specified measurement unit)
for the page.
|
void |
setSize(double width,
double height,
int unit,
boolean adjustCropBoxSize)
Sets specified width and height (in specified measurement unit)
for the page and proportionally change the dimensions of the
crop box if specified.
|
void |
setTextFormatter(PdfTextFormatter tf)
Specifies new text formatting settings.
|
void |
setWidth(double width,
int unit)
Sets width of the page.
|
void |
setWidth(double width,
int unit,
boolean adjustCropBoxSize)
Sets width (in specified measurement unit) of the page and
proportionally changes the width of the crop box.
|
void |
writeText(String str)
Writes specified text on this
PdfPage . |
void |
writeText(String str,
boolean wrap)
Writes text
str with specified wrap setting on
this PdfPage . |
void |
writeText(String str,
double x,
double y)
Writes text
str at position (x ,
y ). |
void |
writeText(String str,
double x,
double y,
boolean wrap)
Writes text
str at position (x ,
y ) with specified wrap setting. |
void |
writeText(String str,
double x,
double y,
double rotation)
Writes text
str , rotated by rotation
degrees, at position (x , y ). |
void |
writeText(String str,
double x,
double y,
int alignment)
Writes text
str at position (x ,
y ) with specified alignment. |
void |
writeText(String str,
double x,
double y,
int alignment,
boolean wrap)
Writes
str at position (x ,
y ) with specified alignment and wrap setting. |
void |
writeText(String str,
int alignment)
Writes
str with specified alignment. |
void |
writeText(String str,
int alignment,
boolean wrap)
Writes text
str with specified alignment and wrap
setting. |
void |
writeText(String str,
PdfFont f)
Writes specified text with specified font.
|
void |
writeText(String str,
PdfFont f,
boolean wrap)
Writes text
str with specified font and wrap
setting. |
void |
writeText(String str,
PdfFont f,
double x,
double y)
Writes text
str at position (x ,
y ) with specified font. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
boolean wrap)
Writes text
str at position (x ,
y ) with specified font and wrap setting. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
double rotation)
Writes text
str , rotated by rotation
degrees, at specified position with specified font. |
void |
writeText(String str,
PdfFont f,
double x,
double y,
double rotation,
int positionOfRotation) |
void |
writeText(String str,
PdfFont f,
int alignment)
Writes text
str with specified font and alignment. |
void |
writeText(String str,
PdfFont f,
int alignment,
boolean wrap)
Writes text
str with specified font, alignment,
and wrap setting. |
void |
writeText(String str,
PdfFont f,
int alignment,
double x,
double y)
Writes text
str at position (x ,
y ) with specified font and alignement |
void |
writeText(String str,
PdfFont f,
int alignment,
double x,
double y,
boolean wrap)
Writes text
str at position (x ,
y ) with specified font, alignment, and wrap
setting. |
void |
writeText(String str,
PdfFont f,
int alignment,
PdfPoint p)
Writes text
str with specified font and alignment
at specified point. |
void |
writeText(String str,
PdfFont f,
int alignment,
PdfPoint p,
boolean wrap)
Writes text
str with specified font, alignment,
and wrap setting at specified point. |
void |
writeText(String str,
PdfFont f,
PdfPoint p)
Writes text
str with specified font at specified
point. |
void |
writeText(String str,
PdfFont f,
PdfPoint p,
boolean wrap)
Writes text
str with specified font and wrap
setting at specified point. |
void |
writeText(String str,
PdfFont f,
PdfPoint p,
double rotation)
Writes text
str , rotated by rotation
degrees, at specified point with specified font. |
void |
writeText(String str,
PdfFont f,
PdfRect rect)
Writes text
str with specified font inside
specified rectangle. |
void |
writeText(String str,
PdfFont f,
PdfRect rect,
double rotation,
double firstLinePosition)
Writes text
str , rotated by rotation
degrees, with specified font and first-line position inside
specified rectangle. |
void |
writeText(String str,
PdfFont f,
PdfRect rect,
double rotation,
double firstLinePosition,
int positionOfRotation) |
void |
writeText(String str,
PdfFont f,
PdfRect rect,
int alignment)
Writes text
str with specified font and alignment
inside specified rectangle. |
void |
writeText(String str,
PdfFont f,
PdfRect rect,
int alignment,
double rotation,
double firstLinePosition)
Writes text
str , rotated by rotation
degrees, with specified font, alignment, and first-line
position inside specified rectangle. |
void |
writeText(String str,
PdfFont f,
PdfRect rect,
int alignment,
double rotation,
double firstLinePosition,
int positionOfRotation) |
void |
writeText(String str,
PdfPoint p)
Writes specified text at specified point.
|
void |
writeText(String str,
PdfPoint p,
boolean wrap)
Writes text
str with specified wrap setting at
specified point. |
void |
writeText(String str,
PdfPoint p,
double rotation)
Writes text
str , rotated by rotation
degrees, at specified point. |
void |
writeText(String str,
PdfPoint p,
int alignment)
Writes text
str with specified alignment at
specified point. |
void |
writeText(String str,
PdfPoint p,
int alignment,
boolean wrap)
Writes text
str with specified alignment and wrap
setting at specified point. |
void |
writeText(String str,
PdfRect rect)
Writes specified text inside specified rectanlge.
|
void |
writeText(String str,
PdfRect rect,
double rotation,
double firstLinePosition)
Writes text
str , rotated by rotation
degrees, with specified first-line position inside specified
rectangle. |
void |
writeText(String str,
PdfRect rect,
int alignment)
Writes text
str with specified alignment inside
specified rectangle. |
void |
writeText(String str,
PdfRect rect,
int alignment,
double rotation,
double firstLinePosition)
Writes text
str , rotated by rotation
degrees, with specified alignment and first-line position
inside specified rectangle. |
public static final int HP_LEFT
public static final int HP_MIDDLE
public static final int HP_RIGHT
public static final int VP_TOP
public static final int VP_CENTRE
public static final int VP_BOTTOM
public static final boolean UNDERLAY
public static final boolean OVERLAY
public static final int COLORSPACE_RGB
public static final int COLORSPACE_CMYK
public PdfPage()
public PdfPage(int pageSize)
pageSize
- constant specifying the page sizePdfPageSize
public PdfPage(double width, double height)
width
- width of the pageheight
- height of pagepublic PdfPage(double width, double height, int measurementUnit)
width
- width of the pageheight
- height of the pagemeasurementUnit
- constant specifying the measurement unitpublic PdfPage(int pageSize, double pageLeftMargin, double pageTopMargin, double pageRightMargin, double pageBottomMargin, int measurementUnit)
pageSize
- constant specifying the page sizepageLeftMargin
- size of the left marginpageTopMargin
- size of the top marginpageRightMargin
- size of the right marginpageBottomMargin
- size of the bottom marginmeasurementUnit
- constant specifying the measurement unitPdfPageSize
,
PdfMeasurement
public PdfPage(double width, double height, double pageLeftMargin, double pageTopMargin, double pageRightMargin, double pageBottomMargin, int measurementUnit)
width
- width of the pageheight
- height of the pagepageLeftMargin
- size of the left marginpageTopMargin
- size of the top marginpageRightMargin
- size of the right marginpageBottomMargin
- size of the bottom marginmeasurementUnit
- constant specifying the measurement unitPdfMeasurement
public PdfPage(int pageSize, double pageHeaderHeight, double pageFooterHeight, double pageLeftMargin, double pageTopMargin, double pageRightMargin, double pageBottomMargin, int measurementUnit)
pageSize
- constant specifying the page sizepageHeaderHeight
- height of the headerpageFooterHeight
- height of the footerpageLeftMargin
- size of the left marginpageTopMargin
- size of the top marginpageRightMargin
- size of the right marginpageBottomMargin
- size of the bottom marginmeasurementUnit
- constant specifying the measurement unitPdfPageSize
,
PdfMeasurement
public PdfPage(double width, double height, double pageHeaderHeight, double pageFooterHeight, double pageLeftMargin, double pageTopMargin, double pageRightMargin, double pageBottomMargin, int measurementUnit)
width
- width of the pageheight
- height of the pagepageHeaderHeight
- height of the headerpageFooterHeight
- height of the footerpageLeftMargin
- size of the left marginpageTopMargin
- size of the top marginpageRightMargin
- size of the right marginpageBottomMargin
- size of the bottom marginmeasurementUnit
- constant specifying the measurement unitPdfMeasurement
public Object clone()
public double getDisplayDuration()
setDisplayDuration(double)
,
PdfPagePresentation
public void setDisplayDuration(double displayDuration)
displayDuration
- number of secondsgetDisplayDuration()
,
PdfPagePresentation
public PdfPagePresentation getPresentation()
setPresentation(PdfPagePresentation)
,
PdfPagePresentation
public List getAllFontBaseNames() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an error occurs in the method.public void setPresentation(PdfPagePresentation presentation)
presentation
- page presentation effect that the page needs to
display in viewer applicationsgetPresentation()
,
PdfPagePresentation
public void addTable(PdfTable table, double x, double y) throws PdfException, IOException
x
,
y
) on the page.table
- table that needs to addedx
- x-coordinate of the location of the top-left corner
of the table on the pagey
- y-coordinate of the location of the top-left corner
of the table on the pagePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurred.public void addTable(PdfTable table, PdfFont f, double x, double y) throws PdfException, IOException
x
,
y
) on the page.table
- table that needs to be renderedf
- font with which the table needs to be renderedx
- x-coordinate of the location of the top-left corner
of the table on the pagey
- y-coordinate of the location of the top-left corner
of the table on the pagePdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurred.public void setWidth(double width, int unit) throws PdfException, IOException
width
- width of the pageunit
- measurement unit in which the width is specifiedIOException
PdfException
IOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfMeasurement
public void setWidth(double width, int unit, boolean adjustCropBoxSize) throws PdfException, IOException
width
- width of the pageunit
- measurement unit with which the width is specifiedadjustCropBoxSize
- whether the width of the crop box will also be
proportionally changedIOException
PdfException
public void setHeight(double height, int unit) throws IOException, PdfException
height
- height of the pageunit
- measurement unit in which the height is specifiedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfMeasurement
public void setHeight(double height, int unit, boolean adjustCropBoxSize) throws IOException, PdfException
height
- height of the pageunit
- measurement unit with which the height is specifiedadjustCropBoxSize
- whether the crop box size needs to proportionally
adjusted to suit the new heightIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void setSize(double width, double height, int unit) throws IOException, PdfException
width
- width of the pageheight
- height of the pageunit
- measurement unit with which width and height are
specifiedIOException
- if an I/O error occurred.PdfException
- if an illegal argument is supplied.public void setSize(double width, double height, int unit, boolean adjustCropBoxSize) throws IOException, PdfException
width
- width of the pageheight
- height of the pageunit
- measurement unit of the pageadjustCropBoxSize
- whether the dimensions of the crop box needs to be
proportionally adjusted with the new dimensions of
the pageIOException
- if an I/O error occurredPdfException
- if an illegal argument is supplied.public void flattenFormFields(boolean flattenWithNewValue) throws IOException, PdfException
flattenWithNewValue
- whether run-time values need to be set to the form
fields before they are flattenedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFields(int type, boolean flattenWithNewValue) throws IOException, PdfException
type
- constant
specifying type of form fieldflattenWithNewValue
- whether run-time values need to be set to the form
fields before they are flattenedIOException
- 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 fields that need to be removedflattenWithNewValue
- whether run-time values need to be set to the form
fields before they are flattenedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFields() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an error occurs in the method.public void flattenFormFields(int type) throws IOException, PdfException
type
- constant
specifying type of form fieldIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void flattenFormFields(String name) throws IOException, PdfException
name
- name of the form fields that need to be flattenedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void deleteFormFields() throws IOException, PdfException
IOException
- if an I/O error occurs.PdfException
- if an error occurs while deleting the form fieldspublic void deleteFormFields(int type) throws IOException, PdfException
type
- constant
specifying type of form fieldIOException
- 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 fields that need to be removedIOException
- 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 populated with the annotationsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void getAllAnnotations(int type, List listToPopulate) throws PdfException, IOException
type
- constant
specifying
type of the annotationslistToPopulate
- list that needs to be populated with the annotationsPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List getAllAnnotations(int type) throws PdfException, IOException
type
- constant
specifying
type of the annotationsPdfException
- if called in creation mode or if an illegal
argument is supplied.IOException
- if an I/O error occurs.public List getAllAnnotations() throws PdfException, IOException
PdfException
- if an error occurs in the method.IOException
- if an I/O error occurs.public List getAllFormFields() throws PdfException, IOException
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List getAllFormFields(String name) throws PdfException, IOException
name
- name of the form fieldsPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List getAllFormFields(int type) throws PdfException, IOException
type
- constant specifying the
type of form fields
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void addAnnotation(PdfAnnot annotation) throws PdfException
PdfPage
.annotation
- annotation that needs to be addedPdfException
- if an illegal argument is supplied.public void addAnnotationList(List annotList) throws PdfException
annotList
- annotations that need to be added to the pagePdfException
- if an illegal argument is supplied.public void addAnnotationList(List annotList, boolean removeExistingAnnots) throws PdfException
annotList
- annotations that need to be added to the pageremoveExistingAnnots
- whether annotations that already exist in the page
need to be removedPdfException
- if an illegal argument is supplied.public void addFormField(PdfFormField f)
f
- form field that needs to be added to the pagepublic void addFormFieldList(List formFieldList)
formFieldList
- form fields that need to be added to the pagepublic void addThumbnailImage(String path) throws IOException, PdfException
path
- pathname of the imageIOException
- if an I/O error occurred.PdfException
- if an illegal argument is supplied.public void removeThumbnailImage()
public void deleteAnnotations() throws PdfException, IOException
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void deleteAnnotations(int type) throws PdfException, IOException
type
- constant specifying the type of annotations that
needs to be deletedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List getPageElements(int elementTypes) throws PdfException, IOException
PdfException
IOException
public void enumPageElements(int elementTypes, PdfEnumPageElementsHandler pdfEnumPageElementsHandler) throws PdfException, IOException
PdfEnumPageElementsHandler.onEnumPageElements(int, int, PdfPageElement, boolean[])
event handler of the specified class instance.elementTypes
- constant specifying
PdfPageElement.ELEMENT_TYPE_ALL
pdfEnumPageElementsHandler
- class instance whose event handler needs to be
calledPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public List search(String searchString, int searchMode, int searchOptions) throws PdfException, IOException
searchString
- text that whose occurrences need to be foundsearchMode
- constant specifying whether the search string is a literal text or a
regular expression
searchOptions
- constant specifying text search options
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public PdfSearchElement findFirst(String searchString, int searchMode, int searchOptions, boolean isSearchForward) throws PdfException, IOException
searchString
- text whose occurrences need to be searched in the
pagesearchMode
- constant specifying whether the search string is a literal text or a
regular expression
searchOptions
- constant specifying text search options
isSearchForward
- true if search should move towards the end of the
document; false if search should be performed in the
reverse directionPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.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
- search result whose predecessor needs to be foundPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactRegion(PdfRect boundingRect, boolean clipRegion, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
boundingRect
- region in the page that needs to be redactedclipRegion
- pen
- pen used to stroke the regionbrush
- brush used to stroke the regionisStroke
- 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(PdfRect boundingRect, boolean includeIntersectingText, boolean clipRegion, PdfPen pen, PdfBrush brush, boolean isStroke, boolean isFill) throws PdfException, IOException
boundingRect
- region in the page that needs to be redactedincludeIntersectingText
- whether page elements that only appear partially
within the regionclipRegion
- pen
- pen used to stroke the regionbrush
- brush used to stroke the regionisStroke
- 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(String searchString, int searchMode, int searchOptions) throws PdfException, IOException
searchString
- text whose occurrences need to be redactedsearchMode
- constant specifying whether the search string is a literal text or a
regular expression
searchOptions
- constant specifying text search options
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void redactText(String searchString, int searchMode, int searchOptions, String replaceText, PdfFont font, boolean autoSizeText) throws PdfException, IOException
PdfException
IOException
public void redactText(String searchString, int searchMode, int searchOptions, String replaceText, PdfFont font, boolean autoSizeText, boolean removeAssociatedAnnotations) throws PdfException, IOException
PdfException
IOException
public List extractText() throws PdfException, IOException
PdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public void saveAsText(Writer writer) throws PdfException, IOException
writer
- stream writer instance to which the text needs to be
savedPdfException
- if an illegal argument is supplied.IOException
- if an I/O error occurs.public boolean isPageEmpty() throws PdfException, IOException
PdfException
IOException
public void setMeasurementUnit(int mu)
PdfPage
.mu
- constant specifying the new default measurement unitgetMeasurementUnit()
public int getMeasurementUnit()
PdfPage
.setMeasurementUnit(int)
public void setPenWidth(double width)
width
- default width for the page's penpublic void setPenColor(Color color)
color
- default color for the page's penpublic void setPenDashLength(double length)
length
- length of dashes in the default dash patternsetPenDashGap(double)
,
setPenDashPhase(double)
public void setPenDashGap(double gap)
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)
capStyle
- constant specifying the default shapePdfPen
public void setPenJoinStyle(int joinStyle)
joinStyle
- constant specifying the default shapePdfPen
,
setPenCapStyle(int)
public void setPenMiterLimit(int limit)
limit
- default miter limit for the page's penpublic void setBrushColor(Color c)
c
- default color for the page's brushpublic PdfTextFormatter getTextFormatter()
PdfTextFormatter
object contained by
this PdfPage
.PdfTextFormatter
object contained by the
PdfPage
setTextFormatter(PdfTextFormatter)
public void setTextFormatter(PdfTextFormatter tf)
tf
- new text formatting settingsgetTextFormatter()
public void disableAllMargins()
PdfPage
.enableAllMargins()
public void enableAllMargins()
PdfPage
.disableAllMargins()
public double getBottomMargin()
public double getFooterHeight()
public double getHeaderHeight()
public double getLeftMargin()
public double getRightMargin()
public double getTopMargin()
public PdfBrush getBrush()
public void setBrush(PdfBrush brush)
brush
- default brushgetBrush()
,
setPen(PdfPen)
,
setPenBrush(boolean, boolean)
public double getCropBottom()
public double getCropBottom(int unit)
unit
- measurement unit with which distance is returnedpublic void setCropBottom(double cropBottom)
cropBottom
- distance between the left edge of the page and left
edge of the page's crop boxpublic void setCropBottom(double cropBottom, int unit)
cropBottom
- distance between the bottom edge of the page and the
bottom edge of the page's crop boxunit
- measurement unit with which the distance is
specifiedpublic double getCropLeft()
public double getCropLeft(int unit)
unit
- measurement unit with which distance needs to be
specifiedpublic void setCropLeft(double cropLeft)
cropLeft
- distance between from the left edge of the crop box
and the left edge of the pagepublic void setCropLeft(double cropLeft, int unit)
cropLeft
- distance between the left edge of the page and the
page's crop boxunit
- measurement unit with which the distance is
specifiedpublic double getCropRight()
public double getCropRight(int unit)
unit
- measurement unit with which distance needs to be
specifiedpublic void setCropRight(double cropRight)
cropRight
- distance between from the right edge of the crop box
and the right edge of the pagepublic void setCropRight(double cropRight, int unit)
cropRight
- distance between the right edge of the page and the
right edge of the page's crop boxunit
- measurement unit with which the distance is
specifiedpublic double getCropTop()
public double getCropTop(int unit)
unit
- measurement unit with which distance needs to be
specifiedpublic void setCropTop(double cropTop)
cropTop
- distance between from the top edge of the crop box
and the top edge of the pagepublic void setCropTop(double cropTop, int unit)
cropTop
- distance between from the top edge of the crop box
and the top edge of the pageunit
- measurement unit with which the distance is
specifiedpublic void setCropBox(double cropLeft, double cropTop, double cropRight, double cropBottom)
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 pagepublic void setCropBox(double cropLeft, double cropTop, double cropRight, double cropBottom, int unit)
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 boundaries are
specifiedpublic void setCropBox(PdfRect rect) throws PdfException
rect
- rectangular area on the page that needs to be set as
the crop boxPdfException
- if an illegal argument is suppliedpublic void setCropBox(PdfRect rect, int unit) throws PdfException
rect
- rectangular area on the page that needs to be set as
the crop boxunit
- measurement unit with which the rectangle is
specifiedPdfException
- if an illegal argument is supplied.public PdfRect getCropBox()
public PdfRect getCropBox(int unit)
unit
- measurement unit with which the crop box needs to be
specifiedpublic void setMediaBox(double left, double top, double width, double height)
left
- x-coorinate of the top-left corner of the media boxtop
- y-coorinate of the top-left corner of the media boxwidth
- width of the media boxheight
- height of the media boxpublic void setMediaBox(double left, double top, double width, double height, int unit)
left
- x-coorinate of the top-left corner of the media boxtop
- y y-coorinate of the top-left corner of the media
boxwidth
- width of the media boxheight
- height of the media boxunit
- measurement unit used to specify the media boxpublic void setMediaBox(PdfRect rect) throws PdfException
rect
- rectangular area on the page that needs to be used
as the media boxPdfException
- if an illegal argument is suppliedpublic void setMediaBox(PdfRect rect, int unit) throws PdfException
rect
- rectangular area on the page that needs to be set as
the media boxunit
- measurement unit with which the rectangle is
specifiedPdfException
- if an illegal argument is suppliedpublic PdfRect getMediaBox()
public PdfRect getMediaBox(int unit)
unit
- measurement unit with which the crop box needs to be
specifiedpublic double getHeight()
public double getCropBoxHeight()
public double getWidth()
public double getCropBoxWidth()
public PdfPen getPen()
PdfPen
object representing this page's
pen.PdfPen
object representing the page's
pen.setPen(PdfPen)
public void setPen(PdfPen pen)
PdfPen
object as this page's pen.pen
- PdfPen
object to be set as this page's
pengetPen()
public void setFont(PdfFont font) throws PdfException
font
- default font that needs to render text elements on
this pagePdfException
getFont()
public int getRotation()
public void setRotation(int rotation) throws PdfException
rotation
- angle of rotation (needs to be a multiple of 90
degrees)PdfException
- if an illegal argument is supplied.public void setCph(PdfCustomPlaceholderHandler cph)
cph
- an object of a class that implements
PdfCustomPlaceholderHandler
classpublic void setColorSpace(int colorspace) throws PdfException
colorspace
- constant specifying the default colorspace (either
COLORSPACE_CMYK
or COLORSPACE_RGB
PdfException
getColorSpace()
public int getColorSpace()
COLORSPACE_CMYK
or COLORSPACE_RGB
setColorSpace(int)
public void addAction(int event, int actionType, String javascriptOrURI) throws PdfException
event
- constant specifying trigger event for executing the
actionactionType
- constant specifying resolution of URI or execution
of JavaScript scriptjavascriptOrURI
- specified URI or Javascript scriptPdfException
- if an illegal argument is supplied.PdfAction
,
PdfAction.PdfEvent
public void addAction(int event, int actionType, String applicationToLaunch, boolean isPrint) throws PdfException
event
- constant specifying the trigger event for executing
the named actionactionType
- constant specifying action of launching an
application, or displaying or printing a fileapplicationToLaunch
- pathname of the application that needs to be
launched or the file that needs to be displayed or
printedisPrint
- whether to file needs to be printed instead of being
displayedPdfException
- if an illegal argument is supplied.PdfAction
,
PdfAction.PdfEvent
public void addAction(int event, int namedAction) throws PdfException
event
- constant specifying the trigger event for executing
the named actionnamedAction
- constant specifying the named action that needs to
be executed when the trigger event occursPdfException
- if an illegal argument is supplied.PdfAction
,
PdfAction.PdfEvent
public void addWatermarkText(String text, PdfFont font, int position, boolean applyMargins, double angle, boolean underlay) throws IOException, PdfException
position
and
applyMargins
.
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 textapplyMargins
- 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 contentsIOException
- 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) throws IOException, PdfException
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 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 contentsIOException
- 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) throws IOException, PdfException
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 writtenrect
- rectangular area where the 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 contentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(PdfImage image, int position, boolean applyMargins, double angle, boolean underlay) throws IOException, PdfException
PdfImage
object as watermark image with its
exact position determined by position
and
applyMargins
.
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 imageapplyMargins
- 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 contentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(PdfImage image, int position, double angle, boolean underlay) throws IOException, PdfException
PdfImage
object as watermark image.
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 contentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(String path, int position, boolean applyMargins, double angle, boolean underlay) throws IOException, PdfException
position
and
applyMargins
.
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 imageapplyMargins
- 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 contentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addWatermarkImage(String path, int position, double angle, boolean underlay) throws IOException, PdfException
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 contentsIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderText(String text, PdfFont font, int position, boolean underlay) throws IOException, PdfException
text
- text that needs to be added to the headerfont
- font with which the text needs to be writtenposition
- constant specifying the combination of vertical and
horizontal alignment of the text within the headerunderlay
- whether the text needs to be placed underneath other
content in the headerIOException
- 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) throws IOException, PdfException
text
- text that needs to be added to the footerfont
- font with which the text next needs to be writtenrect
- rect in which the text needs to be embededalignment
- alignment of the text embeded inside the rectfirstLinePosition
- firstLinePosition of the text inside rectposition
- 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 footerIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderImage(PdfImage img, int position, boolean underlay) throws IOException, PdfException
PdfImage
object to 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 headerIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addHeaderImage(String path, int position, boolean underlay, boolean scaleToFit, boolean stretch) throws IOException, PdfException
IOException
PdfException
public void addHeaderImage(PdfImage img, int position, boolean underlay, boolean scaleToFit, boolean stretch) throws IOException, PdfException
IOException
PdfException
public void addHeaderImage(String path, int position, boolean underlay) throws IOException, PdfException
path
- pathname of the image, which 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 headerIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addFooterText(String text, PdfFont font, int position, boolean underlay) throws IOException, PdfException
text
- text that needs 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 footerIOException
- 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) throws IOException, PdfException
text
- text that needs to be added to the footerfont
- font with which the text next needs to be writtenrect
- rect in which the text needs to be embededalignment
- alignment of the text embeded inside the rectfirstLinePosition
- firstLinePosition of the text inside rectposition
- 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 footerIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addFooterImage(PdfImage img, int position, boolean underlay) throws IOException, PdfException
PdfImage
object to footer.img
- PdfImage
object that needs to be added
to the footerposition
- constant specifying the combination of vertical and
horizontal alignment of the image within the footerunderlay
- whether the image needs to be placed underneath
other content in the footerIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void addFooterImage(String path, int position, boolean underlay, boolean scaleToFit, boolean stretch) throws IOException, PdfException
IOException
PdfException
public void addFooterImage(PdfImage img, int position, boolean underlay, boolean scaleToFit, boolean stretch) throws IOException, PdfException
IOException
PdfException
public void addFooterImage(String path, int position, boolean underlay) throws IOException, PdfException
path
- pathname of the image, which needs to be added to
the footerposition
- constant specifying the combination of vertical and
horizontal alignment of the image within the footerunderlay
- whether the image needs to be placed underneath
other content in the footerIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str) throws IOException, PdfException
PdfPage
.str
- text that needs to be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, int alignment, boolean wrap) throws IOException, PdfException
str
with specified alignment and wrap
setting.str
- text that needs to be writtenalignment
- constant specifying how the text needs to be alignedwrap
- constant specifying how the text needs to be alignedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, boolean wrap) throws IOException, PdfException
str
with specified wrap setting on
this PdfPage
.str
- text that needs to be writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, int alignment) throws IOException, PdfException
str
with specified alignment.str
- text that needs to be writtenalignment
- constant specifying how the text needs to be alignedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f) throws IOException, PdfException
str
- text that needs to be writtenf
- font with which the text needs to be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, int alignment, boolean wrap) throws IOException, PdfException
str
with specified font, alignment,
and wrap setting.str
- text that needs to be writtenf
- font with which the text needs to be writtenalignment
- constant specifying how the text needs to be alignedwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, boolean wrap) throws IOException, PdfException
str
with specified font and wrap
setting.str
- text that needs to be writtenf
- font with which the text needs to be writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, int alignment) throws IOException, PdfException
str
with specified font and alignment.str
- text that needs to be writtenf
- font with which the text needs to be writtenalignment
- constant specifying how the text needs to be alignedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, double x, double y) throws IOException, PdfException
str
at position (x
,
y
).str
- text that needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfPoint p) throws IOException, PdfException
str
- text that needs to be writtenp
- PdfPoint
where the text needs to be
writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, double x, double y, int alignment) throws IOException, PdfException
str
at position (x
,
y
) with specified alignment.str
- text that needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenalignment
- constant specifying how the text needs to be alignedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfPoint p, int alignment) throws IOException, PdfException
str
with specified alignment at
specified point.str
- text that needs to be writtenp
- PdfPoint
where the text needs to be
writtenalignment
- constant specifying how the text needs to be alignedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, double x, double y) throws IOException, PdfException
str
at position (x
,
y
) with specified font.str
- text that needs to be writtenf
- font with which the text needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, PdfPoint p) throws IOException, PdfException
str
with specified font at specified
point.str
- text that needs to be writtenf
- font with which the text needs to be writtenp
- PdfPoint
where the text needs to be
writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, int alignment, double x, double y) throws IOException, PdfException
str
at position (x
,
y
) with specified font and alignementstr
- text that needs to be writtenf
- font with which the text needs to be writtenalignment
- constant specifying how the text needs to be alignedx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, int alignment, PdfPoint p) throws IOException, PdfException
str
with specified font and alignment
at specified point.str
- text that needs to be writtenf
- font with which the text needs to be writtenalignment
- constant specifying how the text needs to be alignedp
- PdfPoint
where the text needs to be
writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, double x, double y, boolean wrap) throws IOException, PdfException
str
at position (x
,
y
) with specified font and wrap setting.str
- text that needs to be writtenf
- font with which the text needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, PdfPoint p, boolean wrap) throws IOException, PdfException
str
with specified font and wrap
setting at specified point.str
- text that needs to be writtenf
- font with which the text needs to be writtenp
- PdfPoint
where the text needs to be
writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, int alignment, double x, double y, boolean wrap) throws IOException, PdfException
str
at position (x
,
y
) with specified font, alignment, and wrap
setting.str
- text that needs to be writtenf
- font with which the text needs to be writtenalignment
- constant specifying how the text needs to be alignedx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, int alignment, PdfPoint p, boolean wrap) throws IOException, PdfException
str
with specified font, alignment,
and wrap setting at specified point.str
- text that needs to be writtenf
- font with which the text needs to be writtenalignment
- constant specifying how the text needs to be alignedp
- PdfPoint
where the text needs to be
writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, double x, double y, boolean wrap) throws IOException, PdfException
str
at position (x
,
y
) with specified wrap setting.str
- text that needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenwrap
- constant specifying how the text needs to be alignedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfPoint p, boolean wrap) throws IOException, PdfException
str
with specified wrap setting at
specified point.str
- text that needs to be writtenp
- PdfPoint
where the text needs to be
writtenwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, double x, double y, int alignment, boolean wrap) throws IOException, PdfException
str
at position (x
,
y
) with specified alignment and wrap setting.str
- text that needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenalignment
- constant specifying how the text needs to be alignedwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfPoint p, int alignment, boolean wrap) throws IOException, PdfException
str
with specified alignment and wrap
setting at specified point.str
- text that needs to be writtenp
- PdfPoint
where the text needs to be
writtenalignment
- constant specifying how the text needs to be alignedwrap
- constant specifying whether the text needs to be
wrappedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfPoint p, double rotation) throws IOException, PdfException
str
, rotated by rotation
degrees, at specified point.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
This method is recommended only for writing rotated
single-line text. For writing rotated multi-line
text, the writeText(String, PdfRect, double, double)
method is preferred.
str
- text that needs to be writtenp
- PdfPoint
where the text needs to be
writtenrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, double x, double y, double rotation) throws IOException, PdfException
str
, rotated by rotation
degrees, at position (x
, y
).
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
str
- text that needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, PdfPoint p, double rotation) throws IOException, PdfException
str
, rotated by rotation
degrees, at specified point with specified font.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
This method is recommended only for writing rotated
single-line text. For writing rotated multi-line
text, the
writeText(String, PdfFont, PdfRect, double, double)
method is preferred over this.
str
- text that needs to be writtenf
- font with which the text needs to be writtenp
- PdfPoint
where the text needs to be
writtenrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, double x, double y, double rotation) throws IOException, PdfException
str
, rotated by rotation
degrees, at specified position with specified font.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
str
- text that needs to be writtenf
- font with which the text needs to be writtenx
- x-coordinate of the position where the text needs to
be writteny
- y-coordinate of the position where the text needs to
be writtenrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, double x, double y, double rotation, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void writeText(String str, PdfRect rect) throws IOException, PdfException
str
- text that needs to be writtenrect
- rectangle inside which the text needs to be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfRect rect, double rotation, double firstLinePosition) throws IOException, PdfException
str
, rotated by rotation
degrees, with specified first-line position inside specified
rectangle.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
str
- text that needs to be writtenrect
- rectangle inside which the text needs to be writtenrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxfirstLinePosition
- position inside the rectangle where the first line
of text should beginIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfRect rect, int alignment) throws IOException, PdfException
str
with specified alignment inside
specified rectangle.str
- text that needs to be writtenrect
- rectangle inside which the text needs to be writtenalignment
- constant specifying how the text needs to be aligned
inside the rectangleIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfRect rect, int alignment, double rotation, double firstLinePosition) throws IOException, PdfException
str
, rotated by rotation
degrees, with specified alignment and first-line position
inside specified rectangle.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
str
- text that needs to be writtenrect
- rectangle inside which the text needs to be writtenalignment
- constant specifying how the text needs to be aligned
inside the rectanglerotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxfirstLinePosition
- position inside the rectangle where the first line
of text should beginIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, PdfRect rect) throws IOException, PdfException
str
with specified font inside
specified rectangle.str
- text that needs to be writtenf
- font with which the text needs to be writtenrect
- rectangle inside which the text needs to be writtenIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, PdfRect rect, double rotation, double firstLinePosition) throws IOException, PdfException
str
, rotated by rotation
degrees, with specified font and first-line position inside
specified rectangle.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
str
- text that needs to be writtenf
- font with which the text needs to be writtenrect
- rectangle inside which the text needs to be writtenrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxfirstLinePosition
- position inside the rectangle where the first line
of text should beginIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, PdfRect rect, double rotation, double firstLinePosition, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void writeText(String str, PdfFont f, PdfRect rect, int alignment) throws IOException, PdfException
str
with specified font and alignment
inside specified rectangle.str
- text that needs to be writtenf
- font with which the text needs to be writtenrect
- rectangle inside which the text needs to be writtenalignment
- constant specifying how the text needs to be aligned
inside the rectangleIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.PdfTextFormatter
public void writeText(String str, PdfFont f, PdfRect rect, int alignment, double rotation, double firstLinePosition) throws IOException, PdfException
str
, rotated by rotation
degrees, with specified font, alignment, and first-line
position inside specified rectangle.
The text is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
str
- text that needs to be writtenf
- font with which the text needs to be writtenrect
- rectangle inside which the text needs to be writtenalignment
- constant specifying how the text needs to be aligned
inside the rectanglerotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the text with reference to
center of its bounding boxfirstLinePosition
- position inside the rectangle where the first line
of text should beginIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void writeText(String str, PdfFont f, PdfRect rect, int alignment, double rotation, double firstLinePosition, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, double x, double y) throws IOException, PdfException
x
, y
).path
- pathname of the image filex
- x-coordinate of the position where the image needs
to be drawny
- 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 width, double height) throws IOException, PdfException
x
, y
) with specified width and
height.path
- pathname of the image filex
- x-coordinate of the position where the image needs
to be drawny
- 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, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, double x, double y, double width, double height, boolean preserveAspectRatio, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, PdfPoint p) throws IOException, PdfException
p
.path
- pathname of the image filep
- point 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, PdfPoint p, double width, double height) throws IOException, PdfException
p
with specified width and height.path
- pathname of the image filep
- 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(String path, PdfRect rect) throws IOException, PdfException
rect
.path
- pathname of the image filerect
- rectangle 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, PdfRect rect, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y) throws IOException, PdfException
x
,
y
).img
- image that needs to be drawnx
- x-coordinate of the position where the image needs
to be drawny
- 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(PdfImage img, double x, double y, boolean scaleToFit, boolean stretch) throws IOException, PdfException
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 position where the image needs
to be renderedy
- y-coordinate of the position where the image needs
to be renderedscaleToFit
- 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, double width, double height) throws IOException, PdfException
x
,
y
) with specified width and height.img
- image that needs to be drawnx
- x-coordinate of the position where the image needs
to be drawny
- 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(PdfImage img, double x, double y, double width, double height, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, PdfPoint p) throws IOException, PdfException
img
- image that needs to be drawnp
- 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 p, double width, double height) throws IOException, PdfException
p
with specified
width and height.img
- image that needs to be drawnp
- 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, PdfRect rect) throws IOException, PdfException
img
- image that needs to be drawnrect
- rectangle 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) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, double x, double y, double rotation) throws IOException, PdfException
rotation
degrees, at position (x
,
y
).
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
path
- pathname of the image filex
- x-coordinate of the position where the image needs
to be drawny
- y-coordinate of the position where the image needs
to be drawnrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- 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.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
path
- pathname of the image filex
- x-coordinate of the position where the image needs
to be drawny
- y-coordinate of the position where the image needs
to be drawnwidth
- width of the imageheight
- height of the imagerotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- 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, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(String path, PdfPoint p, double rotation) throws IOException, PdfException
rotation
degrees, at point p
.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
path
- pathname of the image filep
- point where the image needs to be drawnrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, PdfPoint p, double width, double height, double rotation) throws IOException, PdfException
rotation
degrees, at point p
with
specified width and height.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
path
- pathname of the image filep
- point where the image needs to be drawnwidth
- width of the imageheight
- height of the imagerotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, PdfRect rect, double rotation) throws IOException, PdfException
rotation
degrees, on rectangle rect
.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
path
- pathname of the image filerect
- rectangle on which the image needs to be drawnrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(String path, PdfRect rect, double rotation, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y, double rotation) throws IOException, PdfException
rotation
degrees, at position (x
, y
).
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
img
- image that needs to be drawnx
- x-coordinate of the position where the image needs
to be drawny
- y-coordinate of the position where the image needs
to be drawnrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, double x, double y, double rotation, boolean scaleToFit, boolean stretch) throws IOException, PdfException
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 right or bottom edge of the page.
stretch
will be considered only if
scaleToFit
is true.img
- image that needs to be drawnx
- x-coordinate of the position where the image needs
to be renderedy
- y-coordinate of the position where the image needs
to be renderedrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxscaleToFit
- 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, double width, double height, double rotation) throws IOException, PdfException
rotation
degrees,
at position (x
, y
) with specified
height and width.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
img
- image that needs to be drawnx
- x-coordinate of the position where the image needs
to be drawny
- y-coordinate of the position where the image needs
to be drawnwidth
- width of the imageheight
- height of the imagerotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- 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, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, double x, double y, double width, double height, double rotation, boolean preserveAspectRatio, int positionOfRotation) throws IOException, PdfException
IOException
PdfException
public void drawImage(PdfImage img, PdfPoint p, double rotation) throws IOException, PdfException
rotation
degrees, at point p
.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
img
- image that needs to be drawnp
- point where the image needs to be drawnrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawImage(PdfImage img, PdfPoint p, double width, double height, double rotation) throws IOException, PdfException
rotation
degrees, at point p
with specified width and
height.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
img
- image that needs to be drawnp
- point where the image needs to be drawnwidth
- width of the imageheight
- height of the imagerotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- 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, on specified rectangle.
The image is rotated on center of its bounding box by
rotation
degrees in anti-clockwise direction.
img
- image that needs to be drawnrect
- rectangle on which the image needs to be drawnrotation
- (measured in anti-clockwise direction and expressed
in degrees) tilt of the image with reference to
center of its bounding boxIOException
- 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
IOException
PdfException
public void drawLine(double startx, double starty, double endx, double endy) throws IOException
startx
,
starty
) and (endx
, endy
).startx
- x-coordinate of the starting position of the linestarty
- y-coordinate of the starting position of the lineendx
- x-coordinate of the ending position of the lineendy
- y-coordinate of the ending position of the lineIOException
- if an I/O error occurs.public void drawLine(PdfPoint start, PdfPoint end) throws IOException
start
and
end
.start
- starting point of the lineend
- ending point of the lineIOException
- if an I/O error occurs.public void drawRect(PdfPoint p, double width, double height, boolean isFill, boolean isStroke) throws IOException
p
- position of the top-left corner of the rectanglewidth
- width of the rectangleheight
- height of the rectangleisFill
- whether the rectangle needs to be filledisStroke
- whether the rectangle needs to be strokedIOException
- if an I/O error occurs.public void drawRect(double x, double y, double width, double height, boolean isFill, boolean isStroke) throws IOException
x
, y
)
with specified width, height, brush, and pen settings.x
- x-coordinate of top-left corner of the rectangley
- y-coordinate of top-left corner of the rectanglewidth
- width of the rectangleheight
- height of the rectangleisFill
- whether the rectangle needs to be filledisStroke
- whether the rectangle needs to be strokedIOException
- if an I/O error occurs.public void drawRect(Rectangle r) throws IOException
Rectangle
object.r
- rectangle that needs to be drawnIOException
- if an I/O error occurs.public void drawRect(PdfRect r) throws IOException
r
- rectangle that needs to be drawnIOException
- if an I/O error occurs.public void drawRect(double x, double y, double width, double height) throws IOException
x
, y
)
with specified width and height.x
- x-coordinate of top-left corner of the rectangley
- y-coordinate of top-left corner of the rectanglewidth
- width of the rectangleheight
- height of the rectangleIOException
- if an I/O error occurs.public void drawRect(PdfPoint p, double width, double height) throws IOException
p
- position of the top-left corner of the rectanglewidth
- width of the rectangleheight
- height of the rectangleIOException
- if an I/O error occurs.public void drawSquare(double x, double y, double length, boolean isFill, boolean isStroke) throws IOException
x
, y
)
with specified fill and stroke settings.x
- x-coordinate of the top-left corner of the squarey
- y-coordinate of the top-left corner of the squarelength
- length of a side of the squareisFill
- whether the square needs to be filledisStroke
- whether the square needs to be strokedIOException
- if an I/O error occurs.public void drawSquare(double x, double y, double length) throws IOException
x
, y
).x
- x-coordinate of the top-left corner of the squarey
- y-coordinate of the top-left corner of the squarelength
- length of a side of the squareIOException
- if an I/O error occurs.public void drawSquare(PdfPoint p, double length, boolean isFill, boolean isStroke) throws IOException
p
with specified fill and
stroke settings.p
- position of top-left corner of the rectanglelength
- length of a side of the squareisFill
- whether the square needs to be filledisStroke
- whether the square needs to be strokedIOException
- if an I/O error occurs.public void drawSquare(PdfPoint p, double length) throws IOException
p
.p
- position of top-left corner of the rectanglelength
- length of a side of the squareIOException
- if an I/O error occurs.public void drawBezierCurve(PdfPoint start, PdfPoint controlPoint1, PdfPoint controlPoint2, PdfPoint end, boolean isFill, boolean isStroke) throws IOException
start
- starting point of the curvecontrolPoint1
- first control point of the curvecontrolPoint2
- second control point of the curveend
- 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.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
ctrlX1
, ctrlY1
) and (
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.public void drawBezierCurve(PdfPoint start, PdfPoint control, PdfPoint end, boolean isFill, boolean isStroke) throws IOException
start
- starting point of the curvecontrol
- control point of the curveend
- 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.public void drawBezierCurve(double startX, double startY, double ctrlX, double ctrlY, double endX, double endY, boolean isFill, boolean isStroke) throws IOException
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.public void drawEllipse(double x1, double y1, double x2, double y2, boolean isFill, boolean isStroke) throws IOException
x1
, y1
) and its bottom-right corner
at (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.public void drawEllipse(PdfPoint p1, PdfPoint p2, boolean isFill, boolean isStroke) throws IOException
point1
and its bottom-right corner at
point2
.p1
- top-left corner of the ellipse's bounding boxp2
- 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.public void drawCircle(double x, double y, double radius, boolean isFill, boolean isStroke) throws IOException
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.public void drawCircle(PdfPoint center, double radius, boolean isFill, boolean isStroke) throws IOException
center
- position 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.public void drawPolyline(double[] xPoints, double[] yPoints, int nPoints) throws IOException, PdfException
xPoints
- array containing x-coordinates of the kinks in the
polylineyPoints
- array containing y-coordinates of the kinks in the
polylinenPoints
- number of kinks in the polylineIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawPolygon(double[] xPoints, double[] yPoints, int nPoints, boolean isFill, boolean isStroke) throws IOException, PdfException
xPoints
- array containing x-coordinates of the corners of the
polygonyPoints
- array containing y-coordinates of the corners of the
polygonnPoints
- number of sides of the polygonisFill
- whether the polygon needs to be filledisStroke
- whether the polygon needs to be strokedIOException
- if an I/O error occurs.PdfException
- if an illegal argument is supplied.public void drawArc(PdfRect rect, double startAngle, double sweepAngle) throws IOException
rect
specifies bounding
box of an imaginary circle, which completes the arc. The arc
begins at startAngle
degrees and spans for
sweepAngle
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 beginsweepAngle
- (expressed in degrees) angle for which the arc needs
to spanIOException
- if an I/O error occurs.public void drawPie(double x, double y, double width, double height, double startAngle, double sweepAngle, boolean isFill, boolean isStroke) throws IOException
x
,
y
) represents the top-left corner of the bounding
box of an imaginary ellipse, which the pie segment can neatly
fit into.x
- x-coordinate of top-left corner of the bounding box
of the imaginary ellipse that contains the pie
segmenty
- x-coordinate of top-left corner of the bounding box
of the imaginary ellipse that contains the pie
segmentwidth
- width of the bounding box of the imaginary ellipse
that contains the pie segmentheight
- height of the bounding box of the imaginary ellipse
that contains the pie segmentstartAngle
- (measured in anti-clockwise direction and expressed
in degrees) angle from which the pie segment needs
to startsweepAngle
- (expressed in degrees) angle for which the pie
segment needs to spanisFill
- whether the pie segment needs to be filledisStroke
- whether the pie segment needs to be strokedIOException
- if an I/O error occurs.public void drawRoundRect(PdfRect rect, double arcWidth, double arcHeight, boolean isFill, boolean isStroke) throws IOException
rect
with specified rounded
corners.rect
- rectangle that needs to be drawnarcWidth
- width of the rounded cornersarcHeight
- height of the rounded cornersisFill
- whether the rectangle needs to be filledisStroke
- whether the rectangle needs to be strokedIOException
- if an I/O error occurs.public void drawRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight, boolean isFill, boolean isStroke) throws IOException
arcWidth
and arcHeight
. The
dimensions of the whole rectangle are specified by
width
and height
.x
- x-coordinate of top-left corner of the rectangley
- y-coordinate of top-left corner of the rectanglewidth
- width of the rectangleheight
- height of the rectanglearcWidth
- width of the rounded cornersarcHeight
- height of the rounded cornersisFill
- whether the rectangle needs to be filledisStroke
- whether the rectangle needs to be strokedIOException
public PdfFont getFont()
If no default font was specified, this methods returns
PdfFont
object for Helvetica 10 pt.
setFont(PdfFont)