Example usage for com.lowagie.text.pdf PdfTemplate newPath

List of usage examples for com.lowagie.text.pdf PdfTemplate newPath

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfTemplate newPath.

Prototype


public void newPath() 

Source Link

Document

Ends the path without filling or stroking it.

Usage

From source file:storemanagment.Printing.java

public PdfPCell createImageCellCrip(String path, PdfWriter writer) throws IOException, DocumentException {
    PdfPCell cell = null;/*  ww  w .j  a va 2 s.c  o m*/
    try {
        Image img = Image.getInstance(path);
        float w = img.getScaledWidth();
        float h = img.getScaledHeight();

        PdfTemplate t = writer.getDirectContent().createTemplate(w, h);
        t.ellipse(0, 0, w, h);
        t.newPath();
        t.addImage(img, w, 0, 0, h, 0, -600);
        Image clipped = Image.getInstance(t);
        cell = new PdfPCell(clipped, true);
        // cell.setFixedHeight(30);
        // cell.setBorder(Rectangle.NO_BORDER);
        //cell.setBorder(R);
        cell.setPaddingTop(10);

    } catch (BadElementException ex) {
        Logger.getLogger(Printing.class.getName()).log(Level.SEVERE, null, ex);
    } catch (MalformedURLException ex) {
        Logger.getLogger(Printing.class.getName()).log(Level.SEVERE, null, ex);
    }

    return cell;
}