Java tutorial
import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfLayer; import com.lowagie.text.pdf.PdfWriter; public class MainClass { public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); writer.setPdfVersion(PdfWriter.VERSION_1_5); document.open(); PdfLayer layer = new PdfLayer("Do you see me?", writer); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); PdfContentByte cb = writer.getDirectContent(); cb.beginText(); cb.setTextMatrix(50, 790); cb.setLeading(24); cb.setFontAndSize(bf, 18); cb.showText("Do you see me?"); cb.beginLayer(layer); cb.newlineShowText("this is a test"); cb.endLayer(); cb.endText(); document.close(); } }