package org.apache.fop.pdf;
// Java
+import java.awt.Rectangle;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.FileNotFoundException;
* @return the created /Page object
*/
public PDFPage makePage(PDFResources resources, int pageIndex,
- Rectangle2D mediaBox, Rectangle2D cropBox,
- Rectangle2D bleedBox, Rectangle2D trimBox) {
+ Rectangle mediaBox, Rectangle cropBox,
+ Rectangle bleedBox, Rectangle trimBox) {
PDFPage page = new PDFPage(resources, pageIndex, mediaBox, cropBox, bleedBox, trimBox);
getDocument().assignObjectNumber(page);
*/
public PDFPage makePage(PDFResources resources,
int pageWidth, int pageHeight, int pageIndex) {
- Rectangle2D mediaBox = new Rectangle2D.Double(0, 0, pageWidth, pageHeight);
+ Rectangle mediaBox = new Rectangle(0, 0, pageWidth, pageHeight);
return makePage(resources, pageIndex, mediaBox, mediaBox, mediaBox, mediaBox);
}
package org.apache.fop.pdf;
-import java.awt.geom.Rectangle2D;
+import java.awt.Rectangle;
/**
* Class representing a /Page object.
* @param trimBox the TrimBox. If null, bleedBox is used.
*/
public PDFPage(PDFResources resources, int pageIndex,
- Rectangle2D mediaBox, Rectangle2D cropBox,
- Rectangle2D bleedBox, Rectangle2D trimBox) {
+ Rectangle mediaBox, Rectangle cropBox,
+ Rectangle bleedBox, Rectangle trimBox) {
/* generic creation of object */
super(resources);
this.pageIndex = pageIndex;
}
- private void setSimplePageSize(Rectangle2D mediaBox, Rectangle2D cropBox,
- Rectangle2D bleedBox, Rectangle2D trimBox) {
+ private void setSimplePageSize(Rectangle mediaBox, Rectangle cropBox,
+ Rectangle bleedBox, Rectangle trimBox) {
setMediaBox(mediaBox);
if (cropBox == null) {
setTrimBox(trimBox); //Needed for PDF/X
}
- private PDFArray toPDFArray(Rectangle2D box) {
- return new PDFArray(this, new double[] {
- box.getX(), box.getY(), box.getMaxX(), box.getMaxY()});
+ private PDFArray toPDFArray(Rectangle box) {
+ return new PDFArray(this, new int[] {
+ box.x, box.y, box.x + box.width, box.y + box.height});
}
/**
* Sets the "MediaBox" entry
* @param box the media rectangle
*/
- public void setMediaBox(Rectangle2D box) {
+ public void setMediaBox(Rectangle box) {
put("MediaBox", toPDFArray(box));
}
* Sets the "CropBox" entry
* @param box the bleed rectangle
*/
- public void setCropBox(Rectangle2D box) {
+ public void setCropBox(Rectangle box) {
put("CropBox", toPDFArray(box));
}
* Sets the "BleedBox" entry
* @param box the bleed rectangle
*/
- public void setBleedBox(Rectangle2D box) {
+ public void setBleedBox(Rectangle box) {
put("BleedBox", toPDFArray(box));
}
* Sets the "TrimBox" entry
* @param box the trim rectangle
*/
- public void setTrimBox(Rectangle2D box) {
+ public void setTrimBox(Rectangle box) {
put("TrimBox", toPDFArray(box));
}