Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone
Class PdfAppearanceStream

java.lang.Object
  extended bycom.gnostice.pdfone.PdfObject
      extended bycom.gnostice.pdfone.PdfStream
          extended bycom.gnostice.pdfone.PdfAppearanceStream
All Implemented Interfaces:
Cloneable, Usable

public class PdfAppearanceStream
extends PdfStream
implements Usable

This class represents an appearance stream. An appearance stream is a rectangle containing PDF elements such as shapes, images, and text. After creating an appearance stream object, it can be used to provide an alternate appearance for PDF elements such as form fields and annotations. The x-y coordinate of the top-left corner of the rectangle will be relative to the x-y coordinate of the top-left corner of the form field or annotation for which it used.

After creating an PdfAppearanceStream object with a specified rectangle, use methods such as drawCircle() or drawImage() to specify how the object that use the appearance stream should be rendered. Next, you can any of the following methods to add the appearance stream to a form field or annotation object:

See Also:
Defining Custom Appearances for PDF Annotations, Defining Custom Appearances For PDF Form Fields (AcroForms)

Field Summary
 
Fields inherited from interface com.gnostice.pdfone.Usable
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_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_TEXTDIMENSION, PDF_TEXTFONT, PDF_TEXTLEAD, PDF_TEXTMATRIX, PDF_TEXTNEWLINESTART, PDF_TEXTRENDER, PDF_TEXTWIDTH, 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_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 Summary
PdfAppearanceStream(PdfRect rect)
          Constructs an appearance stream with specified rectangle.
PdfAppearanceStream(PdfRect rect, int measurementUnit)
          Constructs an appearance stream with specified rectangle and measurement unit.
 
Method Summary
 Object clone()
           
 void drawCircle(PdfPoint center, double radius, PdfPen pen, PdfBrush brush)
          Draws a circle inside the rectangle of the appearance stream.
 void drawEllipse(PdfPoint p1, PdfPoint p2, PdfPen pen, PdfBrush brush)
          Draws an ellipse inside the rectangle of the appearance stream.
 void drawImage(PdfImage img)
          Draws specified image inside the rectangle of the appearance stream.
 void drawImage(PdfImage img, PdfRect rect)
          Draws specified image within a specified rectangular area inside the rectangle of the appearance stream.
 void drawLine(PdfPoint start, PdfPoint end, PdfPen pen)
          Draws a line inside the rectangle of the appearance stream.
 void drawPolygon(double[] xPoints, double[] yPoints, int nPoints, PdfPen pen, PdfBrush brush)
          Draws a polygon inside the rectangle of the appearance stream.
 void drawPolyline(double[] xPoints, double[] yPoints, int nPoints, PdfPen pen)
          Draws a polyline inside the rectangle of the appearance stream.
 void drawRect(PdfRect rect, PdfPen pen, PdfBrush brush)
          Draws a rectangular box inside the rectangle of the appearance stream.
 void writeText(String text, PdfFont font, PdfPoint p, PdfTextFormatter tf)
          Writes specified text at specified position with specified font and text formatting inside the rectangle of the appearance stream.
 void writeText(String text, PdfFont font, PdfRect rect, PdfTextFormatter tf)
          Writes specified text within specified rectangle with specified font and text formatting inside the rectangle of the appearance stream.
 void writeText(String text, PdfFont font, PdfRect rect, PdfTextFormatter tf, int measurementUnit)
          Writes specified text within specified rectangle with specified font, text formatting, and measurement unit inside the rectangle of the appearance stream.
 
Methods inherited from class com.gnostice.pdfone.PdfStream
decompress, equals, getBuffer, getDecodeParms, getDictionary, getFilters, setBuffer
 
Methods inherited from class com.gnostice.pdfone.PdfObject
getGenerationNumber, getObjectNumber, setGenerationNumber, setObjectNumber, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PdfAppearanceStream

public PdfAppearanceStream(PdfRect rect,
                           int measurementUnit)
Constructs an appearance stream with specified rectangle and measurement unit.

Parameters:
rect - rectangle where the contents of the appearance stream will be rendered
measurementUnit - measurement unit with which PDF elements will be rendered in the rectangle
See Also:
PdfMeasurement

PdfAppearanceStream

public PdfAppearanceStream(PdfRect rect)
Constructs an appearance stream with specified rectangle.

Parameters:
rect - rectangle where the contents of the appearance stream will be rendered
Method Detail

clone

public Object clone()
Overrides:
clone in class PdfStream

drawLine

public void drawLine(PdfPoint start,
                     PdfPoint end,
                     PdfPen pen)
              throws IOException
Draws a line inside the rectangle of the appearance stream.

Parameters:
start - position from which the line needs to be drawn
end - position to which the line needs to be drawn
pen - pen used to stroke the line
Throws:
IOException - if an illegal argument is supplied.

drawEllipse

public void drawEllipse(PdfPoint p1,
                        PdfPoint p2,
                        PdfPen pen,
                        PdfBrush brush)
                 throws IOException
Draws an ellipse inside the rectangle of the appearance stream.

Parameters:
p1 - position of the top-left corner of the ellipse's bounding box
p2 - position of the bottom-right corner of the ellipse's bounding box
pen - pen used to stroke the ellipse
brush - brush used to fill the ellipse
Throws:
IOException - if an illegal argument is supplied.

drawCircle

public void drawCircle(PdfPoint center,
                       double radius,
                       PdfPen pen,
                       PdfBrush brush)
                throws IOException
Draws a circle inside the rectangle of the appearance stream.

Parameters:
center - position of the center of the circle
radius - radius of the circle
pen - pen used to stroke the circle
brush - brush used to fill the circle
Throws:
IOException - if an illegal argument is supplied.

drawPolyline

public void drawPolyline(double[] xPoints,
                         double[] yPoints,
                         int nPoints,
                         PdfPen pen)
                  throws IOException,
                         PdfException
Draws a polyline inside the rectangle of the appearance stream. The polyline is made of several lines. The first line will be between (xPoints[0], yPoints[0]) and (xPoints[1], yPoints[1]). The second line will be between (xPoints[1], yPoints[1] and (xPoints[2], yPoints[2]. The rest of the lines will be drawn in a similar manner until the last line ends at (xPoints[nPoints], yPoints[nPoints].

Parameters:
xPoints - array containing x-coordinates of the vertices of the polyline
yPoints - array containing y-coordinates of the vertices of the polyline
nPoints - number of points that need to be connected together to draw the polyline
pen - pen used to stroke the polyline
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

drawPolygon

public void drawPolygon(double[] xPoints,
                        double[] yPoints,
                        int nPoints,
                        PdfPen pen,
                        PdfBrush brush)
                 throws IOException,
                        PdfException
Draws a polygon inside the rectangle of the appearance stream. The first edge of the polygon will be between (xPoints[0], yPoints[0]) and (xPoints[1], yPoints[1]). The second edge will be between (xPoints[1], yPoints[1]) and (xPoints[2], yPoints[2]). Other edges of the polygon will be drawn in a similar manner until the last edge is drawn between (xPoints[nPoints], yPoints[nPoints]) and (xPoints[0], yPoints[0]).

Parameters:
xPoints - array containing x-coordinates of the vertices of the polygon
yPoints - array containing y-coordinates of the vertices of the polygon
nPoints - number of edges of the polygon
pen - pen used to stroke the polygon
brush - brush used to fill the polygon
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

drawRect

public void drawRect(PdfRect rect,
                     PdfPen pen,
                     PdfBrush brush)
              throws IOException
Draws a rectangular box inside the rectangle of the appearance stream.

Parameters:
rect - rectangular box that needs to be drawn
pen - pen used to stroke the rectangular box
brush - brush used to fill the rectangular box
Throws:
IOException - if an I/O error occurs.

drawImage

public void drawImage(PdfImage img,
                      PdfRect rect)
               throws IOException,
                      PdfException
Draws specified image within a specified rectangular area inside the rectangle of the appearance stream.

Parameters:
img - image that needs to be drawn
rect - rectangular area within which the image needs to be tightly fit
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

drawImage

public void drawImage(PdfImage img)
               throws IOException,
                      PdfException
Draws specified image inside the rectangle of the appearance stream.

Parameters:
img - image that needs to be drawn
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

writeText

public void writeText(String text,
                      PdfFont font,
                      PdfPoint p,
                      PdfTextFormatter tf)
               throws IOException,
                      PdfException
Writes specified text at specified position with specified font and text formatting inside the rectangle of the appearance stream.

Parameters:
text - text that needs to be rendered
font - font with which the text needs to be rendered
p - position at which the text needs to be rendered
tf - formatting with which the text needs to be rendered
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

writeText

public void writeText(String text,
                      PdfFont font,
                      PdfRect rect,
                      PdfTextFormatter tf)
               throws IOException,
                      PdfException
Writes specified text within specified rectangle with specified font and text formatting inside the rectangle of the appearance stream.

Parameters:
text - text that needs to be rendered
font - font with which the text needs to be rendered
rect - rectangle within which the text needs to be rendered
tf - formatting with which the text needs to be rendered
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

writeText

public void writeText(String text,
                      PdfFont font,
                      PdfRect rect,
                      PdfTextFormatter tf,
                      int measurementUnit)
               throws IOException,
                      PdfException
Writes specified text within specified rectangle with specified font, text formatting, and measurement unit inside the rectangle of the appearance stream.

Parameters:
text - text that needs to be rendered
font - font with which the text needs to be rendered
rect - rectangle within which the text needs to be rendered
tf - formatting with which the text needs to be rendered
measurementUnit - measurement unit with which the rect is specified
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com