Hi all this is the very first time I'm posting this question. I'm using iText for generating barcodes and I'm experiencing following problems
1. Fixed barcode size: I'm trying to fix barcode size but the size is not getting fixed for barcodes. 2. Spacing for the Barcodes: I have a barcode stickers which have 4 columns and 12 rows i.e. one sheet holds 48 barcode stickers. I want to know about how to fix the barcode size. Whwn I'm trying to print the barcode the first row prints properly but the when the last row is to be printed it prints that last row in the third last row of the sticker sheet. Please help me finding the solution. here is my code: try { Document document = new Document(PageSize.A4, 1f, 1f, 16f, 1f); // step 2 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D://barcodr1.pdf")); // step 3 document.open(); Barcode128 code128 = new Barcode128(); // step 4 PdfContentByte cb = writer.getDirectContent(); Class.forName("com.mysql.jdbc.Driver"); Connection cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/fireworks", "root", "pranit"); PreparedStatement ps = cn.prepareStatement("select * from stock where status = 'Not Printed'"); ResultSet rs = ps.executeQuery(); rs.beforeFirst(); String f = ""; PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100); table.setSpacingAfter(1f); int g = 0; Image img = null; while (rs.next()) { g = rs.getInt("id"); f = rs.getString("bcode"); String a[] = f.split("_"); code128.setBarHeight(50f); code128.setCode(rs.getString("bcode") + " " + rs.getString("bname") + "" + rs.getString("itemname") + "" + a[1]); code128.setCodeType(Barcode.CODE128); img = code128.createImageWithBarcode(cb, null, null); img.setWidthPercentage(80); // img.scalePercent(50, 50); //System.err.println(img.getHeight()); PdfPCell c1 = new PdfPCell(img); c1.setBorder(0); c1.setPadding(15); c1.setColspan(0); // c1.setRowspan(0); c1.setHorizontalAlignment(Element.ALIGN_CENTER); c1.setVerticalAlignment(Element.ALIGN_CENTER); table.addCell(c1); } document.add(table); document.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e, null, JOptionPane.ERROR_MESSAGE); } -- View this message in context: http://itext-general.2136553.n4.nabble.com/Fixed-Barcode-apsinc-and-size-tp4660586.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php