public class ImageElement extends Object implements Element, Drawable, Dividable, WidthRespecting
Dividable.Divided| Modifier and Type | Field and Description |
|---|---|
static float |
SCALE_TO_RESPECT_WIDTH
Set this to
setWidth(float) resp. |
| Constructor and Description |
|---|
ImageElement(BufferedImage image) |
ImageElement(InputStream inputStream) |
ImageElement(String filePath) |
| Modifier and Type | Method and Description |
|---|---|
Dividable.Divided |
divide(float remainingHeight,
float nextPageHeight)
Divides the drawable vetically into pieces where the first part is to
respect the given remaining height.
|
void |
draw(org.apache.pdfbox.pdmodel.PDDocument pdDocument,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
Position upperLeft,
DrawListener drawListener)
Draws the object at the given position.
|
Position |
getAbsolutePosition()
If an absolute position is given, the drawable will be drawn at this
position ignoring any
Layout. |
float |
getHeight() |
float |
getMaxWidth() |
float |
getWidth() |
Drawable |
removeLeadingEmptyVerticalSpace() |
void |
setAbsolutePosition(Position absolutePosition)
Sets the absolute position to render at.
|
void |
setHeight(float height)
Sets the height.
|
void |
setMaxWidth(float maxWidth)
Sets the max width to respect.
|
void |
setWidth(float width)
Sets the width.
|
public static final float SCALE_TO_RESPECT_WIDTH
public ImageElement(BufferedImage image)
public ImageElement(InputStream inputStream) throws IOException
IOExceptionpublic ImageElement(String filePath) throws IOException
IOExceptionpublic float getWidth()
throws IOException
getWidth in interface DrawableIOException - by pdfboxpublic void setWidth(float width)
SCALE_TO_RESPECT_WIDTH in order to let the image
respect any given width.width - the width to use.public float getHeight()
throws IOException
getHeight in interface DrawableIOException - by pdfboxpublic void setHeight(float height)
SCALE_TO_RESPECT_WIDTH in order to let the image
respect any given width. Usually this makes only
sense if you also set the width to SCALE_TO_RESPECT_WIDTH.height - the height to use.public Dividable.Divided divide(float remainingHeight, float nextPageHeight) throws IOException
Dividabledivide in interface DividableremainingHeight - the remaining height on the page dictating the height of the
first part.nextPageHeight - the height of the next page allows to make better decisions on
how to divide best, e.g. maybe the element fits completely on
the next page.IOException - by pdfbox.public float getMaxWidth()
getMaxWidth in interface WidthRespectingpublic void setMaxWidth(float maxWidth)
WidthRespectingsetMaxWidth in interface WidthRespectingmaxWidth - the maximum width.public Position getAbsolutePosition()
DrawableLayout.getAbsolutePosition in interface Drawablepublic void setAbsolutePosition(Position absolutePosition)
absolutePosition - the absolute position.public void draw(org.apache.pdfbox.pdmodel.PDDocument pdDocument,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
Position upperLeft,
DrawListener drawListener)
throws IOException
Drawabledraw in interface DrawablepdDocument - the underlying pdfbox document.contentStream - the stream to draw to.upperLeft - the upper left position to start drawing.drawListener - the listener to
notify on
drawn objects.IOException - by pdfboxpublic Drawable removeLeadingEmptyVerticalSpace()
removeLeadingEmptyVerticalSpace in interface DrawableCopyright © 2021. All rights reserved.