float[] columnWidths = new float[] {38f, 105f, 90f}; PdfPTable table_SectionTwo= new PdfPTable(clmnWdthTpHdr); table_SectionTwo.setTotalWidth(500.0f); table_SectionTwo.setWidthPercentage(100.0f); table_SectionTwo.setLockedWidth(true);
PdfPTable table = new PdfPTable(2); table.setTotalWidth(new float[]{ 72, 216 }); table.setLockedWidth(true);
public ExtendedPdfPTable( int numColumns ) { super( numColumns ); super.setSpacingBefore( 0f ); this.empty = true; super.setLockedWidth( true ); super.setHorizontalAlignment( Element.ALIGN_LEFT ); }
public ExtendedPdfPTable( int numColumns ) { super( numColumns ); super.setSpacingBefore( 0f ); this.empty = true; super.setLockedWidth( true ); super.setHorizontalAlignment( Element.ALIGN_LEFT ); }
PdfPTable table = new PdfPTable(2); table.setTotalWidth(288); table.setLockedWidth(true);
private PdfPTable getProgramStageMainTable() { PdfPTable mainTable = new PdfPTable( 1 ); // Code 1 mainTable.setTotalWidth( 800f ); mainTable.setLockedWidth( true ); mainTable.setHorizontalAlignment( Element.ALIGN_LEFT ); return mainTable; }
public PdfPTable buildTable() { if (rows.isEmpty()) return new PdfPTable(1); int ncol = 0; ArrayList c0 = (ArrayList)rows.get(0); for (int k = 0; k < c0.size(); ++k) { ncol += ((PdfPCell)c0.get(k)).getColspan(); } PdfPTable table = new PdfPTable(ncol); String width = (String)props.get("width"); if (width == null) table.setWidthPercentage(100); else { if (width.endsWith("%")) table.setWidthPercentage(Float.parseFloat(width.substring(0, width.length() - 1))); else { table.setTotalWidth(Float.parseFloat(width)); table.setLockedWidth(true); } } for (int row = 0; row < rows.size(); ++row) { ArrayList col = (ArrayList)rows.get(row); for (int k = 0; k < col.size(); ++k) { table.addCell((PdfPCell)col.get(k)); } } return table; } }
public PdfPTable buildTable() { if (rows.isEmpty()) return new PdfPTable(1); int ncol = 0; ArrayList c0 = (ArrayList)rows.get(0); for (int k = 0; k < c0.size(); ++k) { ncol += ((PdfPCell)c0.get(k)).getColspan(); } PdfPTable table = new PdfPTable(ncol); String width = (String)props.get("width"); if (width == null) table.setWidthPercentage(100); else { if (width.endsWith("%")) table.setWidthPercentage(Float.parseFloat(width.substring(0, width.length() - 1))); else { table.setTotalWidth(Float.parseFloat(width)); table.setLockedWidth(true); } } for (int row = 0; row < rows.size(); ++row) { ArrayList col = (ArrayList)rows.get(row); for (int k = 0; k < col.size(); ++k) { table.addCell((PdfPCell)col.get(k)); } } return table; } }
public PdfPTable buildTable() { if (rows.isEmpty()) return new PdfPTable(1); int ncol = 0; ArrayList c0 = (ArrayList)rows.get(0); for (int k = 0; k < c0.size(); ++k) { ncol += ((PdfPCell)c0.get(k)).getColspan(); } PdfPTable table = new PdfPTable(ncol); String width = (String)props.get("width"); if (width == null) table.setWidthPercentage(100); else { if (width.endsWith("%")) table.setWidthPercentage(Float.parseFloat(width.substring(0, width.length() - 1))); else { table.setTotalWidth(Float.parseFloat(width)); table.setLockedWidth(true); } } for (int row = 0; row < rows.size(); ++row) { ArrayList col = (ArrayList)rows.get(row); for (int k = 0; k < col.size(); ++k) { table.addCell((PdfPCell)col.get(k)); } } return table; } }
PdfPTable tableFactura = new PdfPTable(4); tableFactura.setLockedWidth(true); tableFactura.setTotalWidth(425f); tableFactura.setWidths(new int[]{55, 15, 15, 15});
PdfPTable outerTable = new PdfPTable(1); outerTable.setSpacingAfter(0); outerTable.setSpacingBefore(0); outerTable.setTotalWidth(document.right() - document.left()); outerTable.setLockedWidth(true);
public void createPdf(String dest) throws IOException, DocumentException { float width = 85; float border = 1; PdfPTable table = new PdfPTable(1); table.setTotalWidth(width - 2 * border); table.setLockedWidth(true); table.addCell("Some text in some cell."); table.addCell("In some very narrow table"); Rectangle rect = new Rectangle(width, table.getTotalHeight() + 2 * border); Document document = new Document(rect, border, border, border, border); PdfWriter.getInstance(document, new FileOutputStream(dest)); document.open(); document.add(table); document.close(); }
public static PdfPTable createTwoColumnsTitledTable( final List<String> titles, final List<String> content) { PdfPTable table = new PdfPTable(10); Iterator<String> itLeft = titles.iterator(); Iterator<String> itRight = content.iterator(); while (itLeft.hasNext()) { String textLeft = itLeft.next(); String textRight = itRight.next(); table.getDefaultCell().setColspan(1); table.addCell(textLeft); table.getDefaultCell().setColspan(9); table.addCell(textRight); } table.setSpacingBefore(20); table.setSpacingAfter(20); table.setLockedWidth(false); table.setWidthPercentage(90); return table; } }
Image image = Image.getInstance(IMG); image.setScaleToFitHeight(false); PdfPTable table = new PdfPTable(1); table.setTotalWidth(new float[]{120}); table.setLockedWidth(true); Phrase listOfDots = new Phrase(); for (int i = 0; i < 40; i++) { listOfDots.add(new Chunk(image, 0, 0)); listOfDots.add(new Chunk(" ")); } table.addCell(listOfDots);
Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("datamatrix.pdf")); document.open(); PdfPTable table = new PdfPTable(2); table.setHorizontalAlignment(Element.ALIGN_LEFT); table.setTotalWidth(100); table.setLockedWidth(true); table.addCell("1"); BarcodeDatamatrix dm = new BarcodeDatamatrix(); dm.generate("1234567890"); Image img = dm.createImage(); PdfPCell cell = new PdfPCell(img, false); cell.setPadding(2); table.addCell(cell);; document.add(table); document.close();
{ 24, 24, 2 }); tableF.setTotalWidth(527); tableF.setLockedWidth(true); tableF.getDefaultCell().setFixedHeight(9); tableF.getDefaultCell().setBorder(Rectangle.BOTTOM);
public static void main(String[] args) throws DocumentException, FileNotFoundException, IOException { String TARGET = "temp.pdf"; Document document = new Document(PageSize.A4); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(TARGET)); document.open(); PdfPTable table = new PdfPTable(7); for (int i = 0; i < 700; i++) { Phrase p = new Phrase("some text"); PdfPCell cell = new PdfPCell(); cell.addElement(p); table.addCell(cell); } table.setTotalWidth(PageSize.A4.getWidth()); table.setLockedWidth(true); PdfContentByte canvas = writer.getDirectContent(); PdfTemplate template = canvas.createTemplate(table.getTotalWidth(), table.getTotalHeight()); table.writeSelectedRows(0, -1, 0, table.getTotalHeight(), template); Image img = Image.getInstance(template); img.scaleToFit(PageSize.A4.getWidth(), PageSize.A4.getHeight()); img.setAbsolutePosition(0, (PageSize.A4.getHeight() - table.getTotalHeight()) / 2); document.add(img); document.close(); }
private PdfPTable createTable( PdfPCell cell ) { PdfPTable table = new PdfPTable( 1 ); table.setSpacingBefore( this.spacingBefore() ); table.setSpacingAfter( this.spacingAfter() ); table.setHorizontalAlignment( this.getHorizontalAlignment() ); table.setTotalWidth( cell.getPaddingLeft() + this.getTotalWidth() + cell.getPaddingRight() ); table.setLockedWidth( true ); table.setSplitLate( false ); table.addCell( cell ); return table; }
private PdfPTable createTable( PdfPCell cell ) { PdfPTable table = new PdfPTable( 1 ); table.setSpacingBefore( this.spacingBefore() ); table.setSpacingAfter( this.spacingAfter() ); table.setHorizontalAlignment( this.getHorizontalAlignment() ); table.setTotalWidth( cell.getPaddingLeft() + this.getTotalWidth() + cell.getPaddingRight() ); table.setLockedWidth( true ); table.setSplitLate( false ); table.addCell( cell ); return table; }
table.setSpacingBefore(0); table.setTotalWidth(document.right() - document.left()); table.setLockedWidth(true);