java.lang.Objectcom.pdfjet.Page
public class Page
Used to create PDF page objects. Please note:
The coordinate (0f, 0f) is the top left corner of the page. The size of the pages are represented in points. 1 point is 1/72 inches.
Constructor Summary | |
---|---|
Page(PDF pdf,
float[] pageSize)
Creates page object and add it to the PDF document. |
|
Page(PDF pdf,
float[] pageSize,
boolean addPageToPDF)
Creates page object and add it to the PDF document. |
|
Page(PDF pdf,
java.util.Map<java.lang.Integer,PDFobj> objects,
PDFobj pageObj)
|
Method Summary | |
---|---|
void |
addBMC(java.lang.String structure,
java.lang.String altDescription,
java.lang.String actualText)
|
void |
addBMC(java.lang.String structure,
java.lang.String language,
java.lang.String altDescription,
java.lang.String actualText)
|
Destination |
addDestination(java.lang.String name,
float yPosition)
Adds destination to this page. |
void |
addEMC()
|
Font |
addFontResource(CoreFont coreFont)
|
void |
append(byte[] buffer)
Appends the specified array of bytes to the page. |
void |
bezierCurveTo(Point p1,
Point p2,
Point p3)
Draws a bezier curve starting from the current point. |
void |
clipPath()
Clips the path. |
void |
clipRect(float x,
float y,
float w,
float h)
|
void |
closePath()
Closes the path and draws it using the current pen color. |
void |
complete()
|
void |
drawCircle(double x,
double y,
double r)
Draws a circle on the page. |
void |
drawCircle(double x,
double y,
double r,
char operation)
Draws the specified circle on the page and fills it with the current brush color. |
void |
drawCircle(float x,
float y,
float r)
Draws a circle on the page. |
void |
drawEllipse(double x,
double y,
double r1,
double r2)
Draws an ellipse on the page using the current pen color. |
void |
drawEllipse(float x,
float y,
float r1,
float r2)
Draws an ellipse on the page using the current pen color. |
void |
drawLine(double x1,
double y1,
double x2,
double y2)
Draws a line on the page, using the current color, between the points (x1, y1) and (x2, y2). |
void |
drawLine(float x1,
float y1,
float x2,
float y2)
Draws a line on the page, using the current color, between the points (x1, y1) and (x2, y2). |
void |
drawPath(java.util.List<Point> path,
char operation)
Draws or fills the specified path using the current pen or brush. |
void |
drawPoint(Point p)
Draws a point on the page using the current pen color. |
void |
drawRect(double x,
double y,
double w,
double h)
Draws the outline of the specified rectangle on the page. |
void |
drawRect(float x,
float y,
float w,
float h)
Draws the outline of the specified rectangle on the page. |
void |
drawRectRoundCorners(float x,
float y,
float w,
float h,
float r1,
float r2,
char operation)
|
void |
drawString(Font font1,
Font font2,
java.lang.String str,
float x,
float y)
Draws the text given by the specified string, using the specified main font and the current brush color. |
void |
drawString(Font font,
java.lang.String str,
double x,
double y)
Draws the text given by the specified string, using the specified font and the current brush color. |
void |
drawString(Font font,
java.lang.String str,
float x,
float y)
Draws the text given by the specified string, using the specified font and the current brush color. |
void |
fillEllipse(double x,
double y,
double r1,
double r2)
Fills an ellipse on the page using the current pen color. |
void |
fillEllipse(float x,
float y,
float r1,
float r2)
Fills an ellipse on the page using the current pen color. |
void |
fillPath()
Closes and fills the path with the current brush color. |
void |
fillRect(double x,
double y,
double w,
double h)
Fills the specified rectangle on the page. |
void |
fillRect(float x,
float y,
float w,
float h)
Fills the specified rectangle on the page. |
float[] |
getBrushColor()
Returns the brush color. |
byte[] |
getContent()
|
float |
getHeight()
Returns the height of this page. |
float |
getWidth()
Returns the width of this page. |
void |
lineTo(double x,
double y)
Draws a line from the current pen position to the point with coordinates (x, y), using the current pen width and stroke color. |
void |
lineTo(float x,
float y)
Draws a line from the current pen position to the point with coordinates (x, y), using the current pen width and stroke color. |
void |
moveTo(double x,
double y)
Moves the pen to the point with coordinates (x, y) on the page. |
void |
moveTo(float x,
float y)
Moves the pen to the point with coordinates (x, y) on the page. |
void |
print(java.lang.String str)
Prints a line of text. |
void |
println()
Move to the next line. |
void |
println(java.lang.String str)
Prints a line of text and moves to the next line. |
void |
restore()
|
void |
save()
|
void |
setArtBox(float upperLeftX,
float upperLeftY,
float lowerRightX,
float lowerRightY)
Sets the page ArtBox. |
void |
setBleedBox(float upperLeftX,
float upperLeftY,
float lowerRightX,
float lowerRightY)
Sets the page BleedBox. |
void |
setBrushColor(double r,
double g,
double b)
Sets the color for brush operations. |
void |
setBrushColor(float[] color)
Sets the color for brush operations. |
void |
setBrushColor(float r,
float g,
float b)
Sets the color for brush operations. |
void |
setBrushColor(int color)
Sets the brush color. |
void |
setCharSpacing(float spacing)
|
void |
setCropBox(float upperLeftX,
float upperLeftY,
float lowerRightX,
float lowerRightY)
Sets the page CropBox. |
void |
setDefaultLinePattern()
Sets the default line dash pattern - solid line. |
void |
setDefaultLineWidth()
Sets the line width to the default. |
void |
setLineCapStyle(int style)
Sets the current line cap style. |
void |
setLineJoinStyle(int style)
Sets the line join style. |
void |
setLinePattern(java.lang.String pattern)
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. |
void |
setPenColor(double r,
double g,
double b)
Sets the color for stroking operations. |
void |
setPenColor(float r,
float g,
float b)
Sets the color for stroking operations. |
void |
setPenColor(int color)
Sets the pen color. |
void |
setPenWidth(double width)
Sets the pen width that will be used to draw lines and splines on this page. |
void |
setPenWidth(float width)
Sets the pen width that will be used to draw lines and splines on this page. |
void |
setTextBegin(float x,
float y)
|
void |
setTextDirection(int degrees)
Sets the text direction. |
void |
setTextEnd()
Sets the end of text block. |
void |
setTextFont(Font font)
|
void |
setTextLeading(float leading)
Sets the text leading. |
void |
setTextLocation(float x,
float y)
Sets the text location. |
void |
setTextRenderingMode(int mode)
Sets the text rendering mode. |
void |
setTextRise(float rise)
|
void |
setTextScaling(float scaling)
|
void |
setTextStart()
Sets the start of text block. |
void |
setTrimBox(float upperLeftX,
float upperLeftY,
float lowerRightX,
float lowerRightY)
Sets the page TrimBox. |
void |
setWordSpacing(float spacing)
|
void |
strokePath()
Draws the path using the current pen color. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Page(PDF pdf, float[] pageSize) throws java.lang.Exception
The coordinate (0f, 0f) is the top left corner of the page. The size of the pages are represented in points. 1 point is 1/72 inches.
pdf
- the pdf object.pageSize
- the page size of this page.
java.lang.Exception
public Page(PDF pdf, float[] pageSize, boolean addPageToPDF) throws java.lang.Exception
The coordinate (0f, 0f) is the top left corner of the page. The size of the pages are represented in points. 1 point is 1/72 inches.
pdf
- the pdf object.pageSize
- the page size of this page.addPageToPDF
- boolean flag.
java.lang.Exception
public Page(PDF pdf, java.util.Map<java.lang.Integer,PDFobj> objects, PDFobj pageObj) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public Font addFontResource(CoreFont coreFont)
public void complete()
public byte[] getContent()
public Destination addDestination(java.lang.String name, float yPosition)
name
- The destination name.yPosition
- The vertical position of the destination on this page.
public float getWidth()
public float getHeight()
public void drawLine(double x1, double y1, double x2, double y2) throws java.io.IOException
x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.
java.io.IOException
public void drawLine(float x1, float y1, float x2, float y2) throws java.io.IOException
x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.
java.io.IOException
public void drawString(Font font1, Font font2, java.lang.String str, float x, float y) throws java.io.IOException
font1
- the main font.font2
- the fallback font.str
- the string to be drawn.x
- the x coordinate.y
- the y coordinate.
java.io.IOException
public void drawString(Font font, java.lang.String str, double x, double y) throws java.io.IOException
font
- the font to use.str
- the string to be drawn.x
- the x coordinate.y
- the y coordinate.
java.io.IOException
public void drawString(Font font, java.lang.String str, float x, float y) throws java.io.IOException
font
- the font to use.str
- the string to be drawn.x
- the x coordinate.y
- the y coordinate.
java.io.IOException
public void setPenColor(double r, double g, double b) throws java.io.IOException
r
- the red component is float value from 0.0 to 1.0.g
- the green component is float value from 0.0 to 1.0.b
- the blue component is float value from 0.0 to 1.0.
java.io.IOException
public void setPenColor(float r, float g, float b) throws java.io.IOException
r
- the red component is float value from 0.0f to 1.0f.g
- the green component is float value from 0.0f to 1.0f.b
- the blue component is float value from 0.0f to 1.0f.
java.io.IOException
public void setBrushColor(double r, double g, double b) throws java.io.IOException
r
- the red component is float value from 0.0 to 1.0.g
- the green component is float value from 0.0 to 1.0.b
- the blue component is float value from 0.0 to 1.0.
java.io.IOException
public void setBrushColor(float r, float g, float b) throws java.io.IOException
r
- the red component is float value from 0.0f to 1.0f.g
- the green component is float value from 0.0f to 1.0f.b
- the blue component is float value from 0.0f to 1.0f.
java.io.IOException
public void setBrushColor(float[] color) throws java.io.IOException
color
- the color.
java.io.IOException
public float[] getBrushColor()
public void setPenColor(int color) throws java.io.IOException
color
- the color. See the Color class for predefined values or define your own using 0x00RRGGBB packed integers.
java.io.IOException
public void setBrushColor(int color) throws java.io.IOException
color
- the color. See the Color class for predefined values or define your own using 0x00RRGGBB packed integers.
java.io.IOException
public void setDefaultLineWidth() throws java.io.IOException
java.io.IOException
public void setLinePattern(java.lang.String pattern) throws java.io.IOException
Examples of line dash patterns: "[Array] Phase" Appearance Description _______________ _________________ ____________________________________ "[] 0" ----------------- Solid line "[3] 0" --- --- --- 3 units on, 3 units off, ... "[2] 1" - -- -- -- -- 1 on, 2 off, 2 on, 2 off, ... "[2 1] 0" -- -- -- -- -- -- 2 on, 1 off, 2 on, 1 off, ... "[3 5] 6" --- --- 2 off, 3 on, 5 off, 3 on, 5 off, ... "[2 3] 11" - -- -- -- 1 on, 3 off, 2 on, 3 off, 2 on, ...
pattern
- the line dash pattern.
java.io.IOException
public void setDefaultLinePattern() throws java.io.IOException
java.io.IOException
public void setPenWidth(double width) throws java.io.IOException
width
- the pen width.
java.io.IOException
public void setPenWidth(float width) throws java.io.IOException
width
- the pen width.
java.io.IOException
public void setLineCapStyle(int style) throws java.io.IOException
style
- the cap style of the current line. Supported values: Cap.BUTT, Cap.ROUND and Cap.PROJECTING_SQUARE
java.io.IOException
public void setLineJoinStyle(int style) throws java.io.IOException
style
- the line join style code. Supported values: Join.MITER, Join.ROUND and Join.BEVEL
java.io.IOException
public void moveTo(double x, double y) throws java.io.IOException
x
- the x coordinate of new pen position.y
- the y coordinate of new pen position.
java.io.IOException
public void moveTo(float x, float y) throws java.io.IOException
x
- the x coordinate of new pen position.y
- the y coordinate of new pen position.
java.io.IOException
public void lineTo(double x, double y) throws java.io.IOException
java.io.IOException
public void lineTo(float x, float y) throws java.io.IOException
java.io.IOException
public void strokePath() throws java.io.IOException
java.io.IOException
public void closePath() throws java.io.IOException
java.io.IOException
public void fillPath() throws java.io.IOException
java.io.IOException
public void drawRect(double x, double y, double w, double h) throws java.io.IOException
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.w
- the width of the rectangle to be drawn.h
- the height of the rectangle to be drawn.
java.io.IOException
public void drawRect(float x, float y, float w, float h) throws java.io.IOException
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.w
- the width of the rectangle to be drawn.h
- the height of the rectangle to be drawn.
java.io.IOException
public void fillRect(double x, double y, double w, double h) throws java.io.IOException
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.w
- the width of the rectangle to be drawn.h
- the height of the rectangle to be drawn.
java.io.IOException
public void fillRect(float x, float y, float w, float h) throws java.io.IOException
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.w
- the width of the rectangle to be drawn.h
- the height of the rectangle to be drawn.
java.io.IOException
public void drawPath(java.util.List<Point> path, char operation) throws java.lang.Exception
path
- the path.operation
- specifies 'stroke' or 'fill' operation.
java.lang.Exception
public void drawCircle(double x, double y, double r) throws java.lang.Exception
x
- the x coordinate of the center of the circle to be drawn.y
- the y coordinate of the center of the circle to be drawn.r
- the radius of the circle to be drawn.
java.lang.Exception
public void drawCircle(float x, float y, float r) throws java.lang.Exception
x
- the x coordinate of the center of the circle to be drawn.y
- the y coordinate of the center of the circle to be drawn.r
- the radius of the circle to be drawn.
java.lang.Exception
public void drawCircle(double x, double y, double r, char operation) throws java.lang.Exception
x
- the x coordinate of the center of the circle to be drawn.y
- the y coordinate of the center of the circle to be drawn.r
- the radius of the circle to be drawn.operation
- must be Operation.STROKE, Operation.CLOSE or Operation.FILL.
java.lang.Exception
public void drawEllipse(double x, double y, double r1, double r2) throws java.lang.Exception
x
- the x coordinate of the center of the ellipse to be drawn.y
- the y coordinate of the center of the ellipse to be drawn.r1
- the horizontal radius of the ellipse to be drawn.r2
- the vertical radius of the ellipse to be drawn.
java.lang.Exception
public void drawEllipse(float x, float y, float r1, float r2) throws java.lang.Exception
x
- the x coordinate of the center of the ellipse to be drawn.y
- the y coordinate of the center of the ellipse to be drawn.r1
- the horizontal radius of the ellipse to be drawn.r2
- the vertical radius of the ellipse to be drawn.
java.lang.Exception
public void fillEllipse(double x, double y, double r1, double r2) throws java.lang.Exception
x
- the x coordinate of the center of the ellipse to be drawn.y
- the y coordinate of the center of the ellipse to be drawn.r1
- the horizontal radius of the ellipse to be drawn.r2
- the vertical radius of the ellipse to be drawn.
java.lang.Exception
public void fillEllipse(float x, float y, float r1, float r2) throws java.lang.Exception
x
- the x coordinate of the center of the ellipse to be drawn.y
- the y coordinate of the center of the ellipse to be drawn.r1
- the horizontal radius of the ellipse to be drawn.r2
- the vertical radius of the ellipse to be drawn.
java.lang.Exception
public void drawPoint(Point p) throws java.lang.Exception
p
- the point.
java.lang.Exception
public void setTextRenderingMode(int mode) throws java.lang.Exception
mode
- the rendering mode.
java.lang.Exception
public void setTextDirection(int degrees) throws java.lang.Exception
degrees
- the angle.
java.lang.Exception
public void bezierCurveTo(Point p1, Point p2, Point p3) throws java.io.IOException
Author: Pieter Libin, pieter@emweb.be
p1
- first control pointp2
- second control pointp3
- end point
java.io.IOException
public void setTextStart() throws java.io.IOException
java.io.IOException
public void setTextLocation(float x, float y) throws java.io.IOException
x
- the x coordinate of new text location.y
- the y coordinate of new text location.
java.io.IOException
public void setTextBegin(float x, float y) throws java.io.IOException
java.io.IOException
public void setTextLeading(float leading) throws java.io.IOException
leading
- the leading.
java.io.IOException
public void setCharSpacing(float spacing) throws java.io.IOException
java.io.IOException
public void setWordSpacing(float spacing) throws java.io.IOException
java.io.IOException
public void setTextScaling(float scaling) throws java.io.IOException
java.io.IOException
public void setTextRise(float rise) throws java.io.IOException
java.io.IOException
public void setTextFont(Font font) throws java.io.IOException
java.io.IOException
public void println(java.lang.String str) throws java.io.IOException
java.io.IOException
public void print(java.lang.String str) throws java.io.IOException
java.io.IOException
public void println() throws java.io.IOException
java.io.IOException
public void setTextEnd() throws java.io.IOException
java.io.IOException
public void drawRectRoundCorners(float x, float y, float w, float h, float r1, float r2, char operation) throws java.lang.Exception
java.lang.Exception
public void clipPath() throws java.io.IOException
java.io.IOException
public void clipRect(float x, float y, float w, float h) throws java.io.IOException
java.io.IOException
public void save() throws java.io.IOException
java.io.IOException
public void restore() throws java.io.IOException
java.io.IOException
public void setCropBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
upperLeftX
- the top left X coordinate of the CropBox.upperLeftY
- the top left Y coordinate of the CropBox.lowerRightX
- the bottom right X coordinate of the CropBox.lowerRightY
- the bottom right Y coordinate of the CropBox.public void setBleedBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
upperLeftX
- the top left X coordinate of the BleedBox.upperLeftY
- the top left Y coordinate of the BleedBox.lowerRightX
- the bottom right X coordinate of the BleedBox.lowerRightY
- the bottom right Y coordinate of the BleedBox.public void setTrimBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
upperLeftX
- the top left X coordinate of the TrimBox.upperLeftY
- the top left Y coordinate of the TrimBox.lowerRightX
- the bottom right X coordinate of the TrimBox.lowerRightY
- the bottom right Y coordinate of the TrimBox.public void setArtBox(float upperLeftX, float upperLeftY, float lowerRightX, float lowerRightY)
upperLeftX
- the top left X coordinate of the ArtBox.upperLeftY
- the top left Y coordinate of the ArtBox.lowerRightX
- the bottom right X coordinate of the ArtBox.lowerRightY
- the bottom right Y coordinate of the ArtBox.public void append(byte[] buffer) throws java.io.IOException
java.io.IOException
public void addBMC(java.lang.String structure, java.lang.String altDescription, java.lang.String actualText) throws java.lang.Exception
java.lang.Exception
public void addBMC(java.lang.String structure, java.lang.String language, java.lang.String altDescription, java.lang.String actualText) throws java.lang.Exception
java.lang.Exception
public void addEMC() throws java.lang.Exception
java.lang.Exception