List of usage examples for com.itextpdf.text.pdf PdfContentByte rectangle
public void rectangle(final Rectangle rectangle)
From source file:org.durel.mydooble.PDF.java
License:Open Source License
public void newCard() { col++;/*from www .j a va 2 s . co m*/ if (col > (COL_NUM - 1)) { col = 0; row++; if (row > (ROW_NUM - 1)) newPage(); } float x1 = col * (WIDTH + MARGIN) + MARGIN; float x2 = (col + 1) * (WIDTH + MARGIN); float y2 = (row + 1) * (HEIGHT + MARGIN); float y1 = row * (HEIGHT + MARGIN) + MARGIN; cardBox = new Rectangle(x1, y1, x2, y2); try { PdfContentByte cb = writer.getDirectContent(); cb.saveState(); cardBox.setBorderWidth(1.2f); cardBox.setBorderColor(BaseColor.BLACK); cardBox.setBorder(Rectangle.BOX); cb.rectangle(cardBox); cb.stroke(); cb.restoreState(); } catch (Exception e) { e.printStackTrace(); } }