import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.Type3Font;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
Type3Font t3 = new Type3Font(writer, new char[] { ' ', '1', '2', '3', '4', '5' }, false);
PdfContentByte g;
g = t3.defineGlyph(' ', 300, 0, 0, 600, 1200);
g = t3.defineGlyph('1', 600, 0, 0, 600, 1200);
g.moveTo(250, 1200);
g.lineTo(350, 100);
g.lineTo(400, 1100);
g.closePathFillStroke();
g = t3.defineGlyph('2', 800, 0, 0, 800, 1200);
g = t3.defineGlyph('3', 1000, 0, 0, 500, 600);
g.moveTo(250, 1200);
g.lineTo(350, 100);
g.lineTo(400, 1100);
g.closePathFillStroke();
g.moveTo(650, 1200);
g.lineTo(750, 100);
g.lineTo(800, 1100);
g.closePathFillStroke();
g = t3.defineGlyph('4', 1200, 0, 0, 600, 600);
g.closePathFillStroke();
g = t3.defineGlyph('5', 1200, 0, 0, 1200, 1200);
g.closePathFillStroke();
Font font = new Font(t3, 24);
document.add(new Paragraph("1 2 3 4 5\n5 5 5 5 5 5 5 1", font));
document.close();
}
}
|