use of com.itextpdf.layout.element.Image in project i7js-highlevel by itext.
the class C04E10_MaryReillyV3 method manipulatePdf.
public void manipulatePdf(String src, String dest) throws IOException {
PdfReader reader = new PdfReader(src);
PdfWriter writer = new PdfWriter(dest);
PdfDocument pdfDoc = new PdfDocument(reader, writer);
Document document = new Document(pdfDoc);
Image img = new Image(ImageDataFactory.create(MARY), 400, 36, 1);
document.add(img);
document.close();
}
use of com.itextpdf.layout.element.Image in project pdf-editor by Pdf-Creator.
the class PDFDocument method addRectangleWithImageItem.
public void addRectangleWithImageItem(ImageItem imageItem) throws MalformedURLException {
PdfCanvas canvas = new PdfCanvas(currentPage);
Rectangle rect = new Rectangle(imageItem.getX(), imageItem.getY(), imageItem.getW(), imageItem.getH());
canvas.setStrokeColor(imageItem.getRectangleStrokeColor()).setFillColor(imageItem.getRectangleFillColor()).rectangle(rect).fill().stroke();
ImageData data = ImageDataFactory.create(imageItem.getImagePath());
Image image = new Image(data);
image.setFixedPosition(imageItem.getX(), imageItem.getY());
image.scaleAbsolute(imageItem.getW(), imageItem.getH());
new Canvas(canvas, rect).add(image);
}
Aggregations