public class StampStationery {
public static final String filename = "F://demo.pdf";
public static void main(String[] args) throws IOException,
DocumentException{
Document document = new Document(new Rectangle(400, 400));
PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(filename));
document.open();
PdfContentByte cb = writer.getDirectContent();
String content = "hello word!";
cb.beginText();
Font f = new Font();
f.setSize(18);
Phrase p = new Phrase(content, f);
//(100,200) 是x,y座標 45 是偏移角度 字型的演示自己設定
ColumnText.showTextAligned(cb, 0, p, 100, 200, 45);
cb.endText();
document.close();
}
public class StampStationery {
public static final String filename = "F://demo.pdf";
public static void main(String[] args) throws IOException,
DocumentException{
Document document = new Document(new Rectangle(400, 400));
PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(filename));
document.open();
PdfContentByte cb = writer.getDirectContent();
String content = "hello word!";
cb.beginText();
Font f = new Font();
f.setSize(18);
Phrase p = new Phrase(content, f);
//(100,200) 是x,y座標 45 是偏移角度 字型的演示自己設定
ColumnText.showTextAligned(cb, 0, p, 100, 200, 45);
cb.endText();
document.close();
}
}