Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Report; import com.itextpdf.text.DocumentException; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfWriter; import java.io.IOException; /** * * @author Alessandro */ public class ItextReport { /* */ public static void absText(PdfWriter writer, String text, int x, int y) { try { PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.saveState(); cb.beginText(); cb.moveText(x, y); cb.setFontAndSize(bf, 12); cb.showText(text); cb.endText(); cb.restoreState(); } catch (DocumentException | IOException e) { e.getMessage(); } } }