Java tutorial
import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.Font; import com.lowagie.text.FontFactory; import com.lowagie.text.Image; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PatternColor; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfPatternPainter; import com.lowagie.text.pdf.PdfWriter; public class ImagePatternShapePDF { public static void main(String[] args) { Document document = new Document(); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ImagePatternShapePDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfPatternPainter p = cb.createPattern(30f, 30f, 30f, 30f); Image img = Image.getInstance("logo.png"); p.addImage(img, img.scaledWidth(), 0f, 0f, img.scaledHeight(), 0f, 0f); p.setPatternMatrix(1f, 0f, 0f, 1f, 60f, 60f); cb.setPatternFill(p); cb.circle(150f, 400f, 150f); cb.fillStroke(); } catch (Exception e) { e.printStackTrace(); } document.close(); } }