use of com.itextpdf.layout.element.Text in project i7js-highlevel by itext.
the class TextProperties method createPdf.
public void createPdf(String dest) throws IOException {
// Initialize PDF document
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
// Initialize document
Document document = new Document(pdf);
Style style = new Style().setBold().setDestination("Top");
Text t1 = new Text("Test").addStyle(style);
document.add(new Paragraph(t1));
Text t2 = new Text("Test").setBorder(new SolidBorder(0.5f));
document.add(new Paragraph(t2));
Text t3 = new Text("Test").setBorderLeft(new SolidBorder(0.5f)).setBackgroundColor(ColorConstants.LIGHT_GRAY);
document.add(new Paragraph(t3));
Text t4 = new Text("AWAY AGAIN").setCharacterSpacing(10);
document.add(new Paragraph(t4));
Text t5 = new Text("AWAY AGAIN").setWordSpacing(10);
document.add(new Paragraph(t5));
Text t6 = new Text("AWAY AGAIN").setRelativePosition(-10, 50, 0, 0);
document.add(new Paragraph(t6));
PdfAction top = PdfAction.createGoTo("Top");
Text t7 = new Text("go to top").setAction(top);
document.add(new Paragraph(t7));
document.close();
}
use of com.itextpdf.layout.element.Text in project i7js-highlevel by itext.
the class TextWithColoredBorder method createPdf.
public void createPdf(String dest) throws IOException {
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
Document document = new Document(pdf);
document.add(new Paragraph("Paragraph with orange border").setBorder(new SolidBorder(ColorConstants.ORANGE, 5)));
Text text = new Text("Text with orange border").setBorder(new SolidBorder(ColorConstants.ORANGE, 5));
document.add(new Paragraph(text));
Link link = new Link("Link with orange border", PdfAction.createURI("http://itextpdf.com"));
link.setBorder(new SolidBorder(ColorConstants.ORANGE, 5));
document.add(new Paragraph(link));
document.close();
}
Aggregations