public class ReportImage extends AbstractReportElement implements ReportElement
IMPORTANT: Although this class is publicly visible, it is subject to change and may not be implemented by clients!
| Modifier and Type | Class and Description |
|---|---|
static class |
ReportImage.ImagePrintIntent
This class is required, since pdf image printing has a bug.
|
| Constructor and Description |
|---|
ReportImage(java.awt.image.BufferedImage img,
float width,
float height)
The image will be placed as is.
|
| Modifier and Type | Method and Description |
|---|---|
ReportAlignType |
getAlign() |
float |
getHeight() |
float |
getHeight(float allowedWidth)
Height of this segment
|
java.util.Collection<ReportImage.ImagePrintIntent> |
getImageIntents()
Returns all the images that should have been printed by this element
|
float |
getWidth() |
float |
print(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPageContentStream stream,
int pageNumber,
float leftX,
float startY,
float allowedWidth) |
void |
printImage(org.apache.pdfbox.pdmodel.PDDocument document,
int pageNumber,
float x,
float y)
Call this method to print images.
|
void |
setAlign(ReportAlignType align) |
void |
setHeight(float height) |
void |
setWidth(float width) |
getFirstSegmentHeight, getHeightOfElementToSplit, isSplitable, split, splitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFirstSegmentHeight, getHeightOfElementToSplit, isSplitable, split, splitpublic ReportImage(java.awt.image.BufferedImage img,
float width,
float height)
img - Buffered imagewidth - width of image on reportheight - height of image on reportpublic float print(org.apache.pdfbox.pdmodel.PDDocument document,
org.apache.pdfbox.pdmodel.PDPageContentStream stream,
int pageNumber,
float leftX,
float startY,
float allowedWidth)
throws java.io.IOException
print in interface ReportElementdocument - PdfBox documentstream - PdfBox streampageNumber - current page number (0 based)leftX - starting xstartY - starting yallowedWidth - maximal width of segmentjava.io.IOException - in case something happens during printingpublic float getHeight(float allowedWidth)
ReportElementgetHeight in interface ReportElementallowedWidth - allowed with of the segmentpublic void printImage(org.apache.pdfbox.pdmodel.PDDocument document,
int pageNumber,
float x,
float y)
throws java.io.IOException
Call this method to print images. Make sure that the streams are closed before calling this method
Normal print method doesn't work since: http://stackoverflow.com/questions/9326245/how-to-exactly-position-an-image-inside-an-existing-pdf-page-using-pdfbox
document - the pdDocument.pageNumber - page of imagex - location of imagey - location of imagejava.io.IOException - in case there are problems at reading or writing the imagepublic java.util.Collection<ReportImage.ImagePrintIntent> getImageIntents()
ReportElementgetImageIntents in interface ReportElementgetImageIntents in class AbstractReportElementpublic void setAlign(ReportAlignType align)
public ReportAlignType getAlign()
public void setWidth(float width)
public void setHeight(float height)
public float getWidth()
public float getHeight()