List of usage examples for com.lowagie.text Rectangle setBorderWidthRight
public void setBorderWidthRight(float borderWidthRight)
From source file:com.gtdfree.test.TableBorders.java
License:Open Source License
/** * Demonstrates different borderstyles./*from w ww .j a v a2 s. c o m*/ * * @param args * the number of rows for each table fragment. */ public static void main(String[] args) { System.out.println("Table Borders"); // step1 Document document = new Document(PageSize.A4, 50, 50, 50, 50); try { // step2 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("TableBorders.pdf")); // step3 document.open(); // step4 // page 1 Font tableFont = FontFactory.getFont("Helvetica", 8, Font.BOLD, Color.BLACK); float padding = 0f; Rectangle border = new Rectangle(0f, 0f); border.setBorderWidthLeft(6f); border.setBorderWidthBottom(5f); border.setBorderWidthRight(4f); border.setBorderWidthTop(2f); border.setBorderColorLeft(Color.RED); border.setBorderColorBottom(Color.ORANGE); border.setBorderColorRight(Color.YELLOW); border.setBorderColorTop(Color.GREEN); makeTestPage(tableFont, border, writer, document, padding, true, true); Font font = FontFactory.getFont("Helvetica", 10); Paragraph p; p = new Paragraph("\nVarious border widths and colors\nuseAscender=true, useDescender=true", font); document.add(p); document.newPage(); // page 2 padding = 2f; border = new Rectangle(0f, 0f); border.setBorderWidthLeft(1f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(1f); border.setBorderWidthTop(2f); border.setBorderColor(Color.BLACK); makeTestPage(tableFont, border, writer, document, padding, true, true); p = new Paragraph( "More typical use - padding of 2\nuseBorderPadding=true, useAscender=true, useDescender=true", font); document.add(p); document.newPage(); // page 3 padding = 0f; border = new Rectangle(0f, 0f); border.setBorderWidthLeft(1f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(1f); border.setBorderWidthTop(2f); border.setBorderColor(Color.BLACK); makeTestPage(tableFont, border, writer, document, padding, false, true); p = new Paragraph("\nuseBorderPadding=true, useAscender=false, useDescender=true", font); document.add(p); document.newPage(); // page 4 padding = 0f; border = new Rectangle(0f, 0f); border.setBorderWidthLeft(1f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(1f); border.setBorderWidthTop(2f); border.setBorderColor(Color.BLACK); makeTestPage(tableFont, border, writer, document, padding, false, false); p = new Paragraph("\nuseBorderPadding=true, useAscender=false, useDescender=false", font); document.add(p); document.newPage(); // page 5 padding = 0f; border = new Rectangle(0f, 0f); border.setBorderWidthLeft(1f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(1f); border.setBorderWidthTop(2f); border.setBorderColor(Color.BLACK); makeTestPage(tableFont, border, writer, document, padding, true, false); p = new Paragraph("\nuseBorderPadding=true, useAscender=true, useDescender=false", font); document.add(p); } catch (Exception de) { de.printStackTrace(); } // step5 document.close(); }