Search in sources :

Example 26 with AreaBreak

use of com.itextpdf.layout.element.AreaBreak in project i7js-highlevel by itext.

the class TableProperties 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);
    PdfFont font = PdfFontFactory.createFont(StandardFonts.TIMES_ROMAN);
    Style style = new Style();
    style.setBackgroundColor(ColorConstants.YELLOW);
    document.add(createNewTable().addStyle(style).setDestination("Top").setWidth(300).setHorizontalAlignment(HorizontalAlignment.CENTER)).setHorizontalAlignment(HorizontalAlignment.CENTER);
    document.add(createNewTable().setBorder(new DottedBorder(5)).setHyphenation(new HyphenationConfig("en", "uk", 3, 3)));
    document.add(createNewTable().setTextAlignment(TextAlignment.CENTER));
    document.add(ListSeparatorProperties.createNewSeparator().setMargin(10).setWidth(300).setKeepWithNext(true));
    document.add(createNewTable().setKeepTogether(true).setWidth(UnitValue.createPercentValue(90)));
    document.add(createNewTable());
    document.add(createNewTable().setRelativePosition(10, 10, 50, 10));
    document.add(createNewTable());
    document.add(new AreaBreak());
    document.add(createNewTable().setFixedPosition(100, 400, 350).setAction(PdfAction.createGoTo("Top")));
    document.add(new AreaBreak());
    document.add(createNewTable().setBackgroundColor(ColorConstants.YELLOW).setMarginBottom(10));
    document.add(createNewTable().setBackgroundColor(ColorConstants.LIGHT_GRAY).setPaddingLeft(20).setPaddingRight(50));
    document.add(createNewTable().setBackgroundColor(ColorConstants.YELLOW));
    document.add(createNewTable().setBackgroundColor(ColorConstants.LIGHT_GRAY));
    document.add(createNewTable().setBackgroundColor(ColorConstants.YELLOW));
    document.add(createNewTable().setBackgroundColor(ColorConstants.LIGHT_GRAY).setMargin(50).setPadding(30));
    document.add(createNewTable().setBackgroundColor(ColorConstants.YELLOW));
    document.add(createNewTable().setBackgroundColor(ColorConstants.LIGHT_GRAY));
    document.close();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfFont(com.itextpdf.kernel.font.PdfFont) Style(com.itextpdf.layout.Style) HyphenationConfig(com.itextpdf.layout.hyphenation.HyphenationConfig) AreaBreak(com.itextpdf.layout.element.AreaBreak) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) DottedBorder(com.itextpdf.layout.borders.DottedBorder) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument)

Aggregations

AreaBreak (com.itextpdf.layout.element.AreaBreak)26 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)25 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)25 Document (com.itextpdf.layout.Document)25 Paragraph (com.itextpdf.layout.element.Paragraph)20 PdfFont (com.itextpdf.kernel.font.PdfFont)17 HyphenationConfig (com.itextpdf.layout.hyphenation.HyphenationConfig)17 BufferedReader (java.io.BufferedReader)13 FileReader (java.io.FileReader)13 Rectangle (com.itextpdf.kernel.geom.Rectangle)8 DottedLine (com.itextpdf.kernel.pdf.canvas.draw.DottedLine)7 Tab (com.itextpdf.layout.element.Tab)7 TabStop (com.itextpdf.layout.element.TabStop)7 ArrayList (java.util.ArrayList)7 ColumnDocumentRenderer (com.itextpdf.layout.ColumnDocumentRenderer)6 Style (com.itextpdf.layout.Style)5 SolidBorder (com.itextpdf.layout.borders.SolidBorder)5 SimpleEntry (java.util.AbstractMap.SimpleEntry)5 Image (com.itextpdf.layout.element.Image)4 PdfPage (com.itextpdf.kernel.pdf.PdfPage)3