use of com.tom_roush.pdfbox.pdmodel.common.PDRectangle in project PdfBox-Android by TomRoush.
the class PDFRenderer method transform.
// scale rotate translate
private void transform(Canvas canvas, PDPage page, float scaleX, float scaleY) {
canvas.scale(scaleX, scaleY);
// TODO should we be passing the scale to PageDrawer rather than messing with Graphics?
int rotationAngle = page.getRotation();
PDRectangle cropBox = page.getCropBox();
if (rotationAngle != 0) {
float translateX = 0;
float translateY = 0;
switch(rotationAngle) {
case 90:
translateX = cropBox.getHeight();
break;
case 270:
translateY = cropBox.getWidth();
break;
case 180:
translateX = cropBox.getWidth();
translateY = cropBox.getHeight();
break;
default:
break;
}
canvas.translate(translateX, translateY);
canvas.rotate(rotationAngle);
}
}
use of com.tom_roush.pdfbox.pdmodel.common.PDRectangle in project PdfBox-Android by TomRoush.
the class FDFAnnotation method getRectangle.
/**
* The rectangle associated with this annotation.
*
* @return The annotation rectangle.
*/
public PDRectangle getRectangle() {
PDRectangle retval = null;
COSArray rectArray = (COSArray) annot.getDictionaryObject(COSName.RECT);
if (rectArray != null) {
retval = new PDRectangle(rectArray);
}
return retval;
}
use of com.tom_roush.pdfbox.pdmodel.common.PDRectangle in project PdfBox-Android by TomRoush.
the class FDFAnnotationCaret method initFringe.
private void initFringe(Element element) throws IOException {
String fringe = element.getAttribute("fringe");
if (fringe != null && !fringe.isEmpty()) {
String[] fringeValues = fringe.split(",");
if (fringeValues.length != 4) {
throw new IOException("Error: wrong amount of numbers in attribute 'fringe'");
}
PDRectangle rect = new PDRectangle();
rect.setLowerLeftX(Float.parseFloat(fringeValues[0]));
rect.setLowerLeftY(Float.parseFloat(fringeValues[1]));
rect.setUpperRightX(Float.parseFloat(fringeValues[2]));
rect.setUpperRightY(Float.parseFloat(fringeValues[3]));
setFringe(rect);
}
}
use of com.tom_roush.pdfbox.pdmodel.common.PDRectangle in project PdfBox-Android by TomRoush.
the class FDFAnnotationCircle method initFringe.
private void initFringe(Element element) throws IOException {
String fringe = element.getAttribute("fringe");
if (fringe != null && !fringe.isEmpty()) {
String[] fringeValues = fringe.split(",");
if (fringeValues.length != 4) {
throw new IOException("Error: wrong amount of numbers in attribute 'fringe'");
}
PDRectangle rect = new PDRectangle();
rect.setLowerLeftX(Float.parseFloat(fringeValues[0]));
rect.setLowerLeftY(Float.parseFloat(fringeValues[1]));
rect.setUpperRightX(Float.parseFloat(fringeValues[2]));
rect.setUpperRightY(Float.parseFloat(fringeValues[3]));
setFringe(rect);
}
}
use of com.tom_roush.pdfbox.pdmodel.common.PDRectangle in project PdfBox-Android by TomRoush.
the class PDArtifactMarkedContent method getBBox.
/**
* Gets the artifact's bounding box (BBox).
*
* @return the artifact's bounding box
*/
public PDRectangle getBBox() {
PDRectangle retval = null;
COSArray a = (COSArray) this.getProperties().getDictionaryObject(COSName.BBOX);
if (a != null) {
retval = new PDRectangle(a);
}
return retval;
}
Aggregations