Search in sources :

Example 36 with Image

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();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfReader(com.itextpdf.kernel.pdf.PdfReader) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) Image(com.itextpdf.layout.element.Image) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument)

Example 37 with Image

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);
}
Also used : ImageData(com.itextpdf.io.image.ImageData) Canvas(com.itextpdf.layout.Canvas) PdfCanvas(com.itextpdf.kernel.pdf.canvas.PdfCanvas) Rectangle(com.itextpdf.kernel.geom.Rectangle) PdfCanvas(com.itextpdf.kernel.pdf.canvas.PdfCanvas) BufferedImage(java.awt.image.BufferedImage) Image(com.itextpdf.layout.element.Image)

Aggregations

Image (com.itextpdf.layout.element.Image)37 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)25 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)25 Document (com.itextpdf.layout.Document)25 Paragraph (com.itextpdf.layout.element.Paragraph)20 CsvTo2DList (com.itextpdf.highlevel.util.CsvTo2DList)6 File (java.io.File)6 List (java.util.List)6 ImageData (com.itextpdf.io.image.ImageData)5 SolidBorder (com.itextpdf.layout.borders.SolidBorder)4 AreaBreak (com.itextpdf.layout.element.AreaBreak)4 Cell (com.itextpdf.layout.element.Cell)4 Link (com.itextpdf.layout.element.Link)4 IOException (java.io.IOException)4 PdfFont (com.itextpdf.kernel.font.PdfFont)3 Rectangle (com.itextpdf.kernel.geom.Rectangle)3 PdfReader (com.itextpdf.kernel.pdf.PdfReader)3 ListItem (com.itextpdf.layout.element.ListItem)3 Barcode128 (com.itextpdf.barcodes.Barcode128)2 BarcodeQRCode (com.itextpdf.barcodes.BarcodeQRCode)2