use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.
the class C05E06_CellBorders1 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);
Table table = new Table(UnitValue.createPercentArray(new float[] { 2, 1, 1 }));
table.setWidth(UnitValue.createPercentValue(80)).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER);
table.addCell(new Cell(1, 3).add(new Paragraph("Cell with colspan 3")).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorder(new DashedBorder(0.5f)));
table.addCell(new Cell(2, 1).add(new Paragraph("Cell with rowspan 2")).setVerticalAlignment(VerticalAlignment.MIDDLE).setBorderBottom(new DottedBorder(0.5f)).setBorderLeft(new DottedBorder(0.5f)));
table.addCell(new Cell().add(new Paragraph("row 1; cell 1")).setBorder(new DottedBorder(ColorConstants.ORANGE, 0.5f)));
table.addCell(new Cell().add(new Paragraph("row 1; cell 2")));
table.addCell(new Cell().add(new Paragraph("row 2; cell 1")).setBorderBottom(new SolidBorder(2)));
table.addCell(new Cell().add(new Paragraph("row 2; cell 2")).setBorderBottom(new SolidBorder(2)));
document.add(table);
document.close();
}
use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.
the class C05E06_CellBorders3 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);
Table table = new Table(UnitValue.createPercentArray(new float[] { 2, 1, 1 }));
table.setWidth(UnitValue.createPercentValue(80)).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER);
Cell cell = new RoundedCornersCell(1, 3).add(new Paragraph("Cell with colspan 3"));
table.addCell(cell);
cell = new RoundedCornersCell(2, 1).add(new Paragraph("Cell with rowspan 2"));
table.addCell(cell);
cell = new RoundedCornersCell().add(new Paragraph("row 1; cell 1"));
table.addCell(cell);
cell = new RoundedCornersCell().add(new Paragraph("row 1; cell 2"));
table.addCell(cell);
cell = new RoundedCornersCell().add(new Paragraph("row 2; cell 1"));
table.addCell(cell);
cell = new RoundedCornersCell().add(new Paragraph("row 2; cell 2"));
table.addCell(cell);
document.add(table);
document.close();
}
use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.
the class C05E07_NestedTable 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);
Table table = new Table(new float[] { 1, 1 }).setWidth(UnitValue.createPercentValue(80)).setHorizontalAlignment(HorizontalAlignment.CENTER);
table.addCell(new Cell(1, 2).add(new Paragraph("Cell with colspan 2")));
table.addCell(new Cell().add(new Paragraph("Cell with rowspan 1")));
Table inner = new Table(new float[] { 1, 1 });
inner.addCell("row 1; cell 1");
inner.addCell("row 1; cell 2");
inner.addCell("row 2; cell 1");
inner.addCell("row 2; cell 2");
table.addCell(inner);
document.add(table);
table = new Table(new float[] { 1, 1 }).setMarginTop(10).setWidth(UnitValue.createPercentValue(80)).setHorizontalAlignment(HorizontalAlignment.CENTER);
table.addCell(new Cell(1, 2).add(new Paragraph("Cell with colspan 2")));
table.addCell(new Cell().add(new Paragraph("Cell with rowspan 1")));
inner = new Table(new float[] { 1, 1 });
inner.addCell("row 1; cell 1");
inner.addCell("row 1; cell 2");
inner.addCell("row 2; cell 1");
inner.addCell("row 2; cell 2");
table.addCell(new Cell().add(inner).setPadding(0));
document.add(table);
table = new Table(new float[] { 1, 1 }).setMarginTop(10).setWidth(UnitValue.createPercentValue(80)).setHorizontalAlignment(HorizontalAlignment.CENTER);
table.addCell(new Cell(1, 2).add(new Paragraph("Cell with colspan 2")));
table.addCell(new Cell().add(new Paragraph("Cell with rowspan 1")));
inner = new Table(new float[] { 1, 1 }).setWidth(UnitValue.createPercentValue(100));
inner.addCell("row 1; cell 1");
inner.addCell("row 1; cell 2");
inner.addCell("row 2; cell 1");
inner.addCell("row 2; cell 2");
table.addCell(new Cell().add(inner).setPadding(0));
document.add(table);
document.close();
}
use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.
the class C05E02_ColumnWidths1 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);
Table table = new Table(new float[] { 200, 100, 100 });
table.addCell(new Cell(1, 3).add(new Paragraph("Cell with colspan 3")));
table.addCell(new Cell(2, 1).add(new Paragraph("Cell with rowspan 2")));
table.addCell("row 1; cell 1");
table.addCell("row 1; cell 2");
table.addCell("row 2; cell 1");
table.addCell("row 2; cell 2");
document.add(table);
document.close();
}
use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.
the class C02E14_ShowTextAligned 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);
Paragraph title = new Paragraph("The Strange Case of Dr. Jekyll and Mr. Hyde");
document.showTextAligned(title, 36, 806, TextAlignment.LEFT);
Paragraph author = new Paragraph("by Robert Louis Stevenson");
document.showTextAligned(author, 36, 806, TextAlignment.LEFT, VerticalAlignment.TOP);
document.showTextAligned("Jekyll", 300, 800, TextAlignment.CENTER, 0.5f * (float) Math.PI);
document.showTextAligned("Hyde", 300, 800, TextAlignment.CENTER, -0.5f * (float) Math.PI);
document.showTextAligned("Jekyll", 350, 800, TextAlignment.CENTER, VerticalAlignment.TOP, 0.5f * (float) Math.PI);
document.showTextAligned("Hyde", 350, 800, TextAlignment.CENTER, VerticalAlignment.TOP, -0.5f * (float) Math.PI);
document.showTextAligned("Jekyll", 400, 800, TextAlignment.CENTER, VerticalAlignment.MIDDLE, 0.5f * (float) Math.PI);
document.showTextAligned("Hyde", 400, 800, TextAlignment.CENTER, VerticalAlignment.MIDDLE, -0.5f * (float) Math.PI);
document.close();
}
Aggregations