[iText-questions] Fill comb-field
Hi, today I tried to fill in a COMB-field: form.setField(combFieldXXX, value); My problem is, that the characters don't show up in separate boxes. Instead it appears as one single string. What am I doing wrong here? Any hints? Thanks in advance Jonny P.S.: This question was raised by some other guy 6 years ago, but was never answered. -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerryreg; mobile platform with sessions, labs more. See new tools and technologies. Register for BlackBerryreg; DevCon today! http://p.sf.net/sfu/rim-devcon-copy1 ___ 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
[iText-questions] Tables and FormFields: Is this a bug?
Hi all, thanks to help of you (especially 1T3XT BVBA) I'm now able to create tables with PdfFormFields in them. But now I'm having a strange side-effect: The code attached generates the attached pdf. As you can see, the PdfFormFields of the last table are drawn on the second page, not in the table as I would expect. My questions: - Am I doing this the wrong way? If so, what is my problem here? - Is this a bug? If so, is there a workaround? Thanks Jonny /* in_action/chapter15/SenderReceiver.java */ package com.foo; import java.io.FileOutputStream; import java.io.IOException; import java.util.Random; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.ExceptionConverter; import com.lowagie.text.Paragraph; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfFormField; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPCellEvent; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfWriter; import com.lowagie.text.pdf.TextField; /** * This example was written by Bruno Lowagie. It is part of the book 'iText in * Action' by Manning Publications. * ISBN: 1932394796 * http://www.1t3xt.com/docs/book.php * http://www.manning.com/lowagie/ */ public class SenderReceiver1 implements PdfPCellEvent { protected PdfFormField parent; protected String partialFieldName; protected PdfWriter writer; protected boolean required; public SenderReceiver1(PdfWriter writer, PdfFormField parent, String name, boolean required) { this.writer = writer; this.parent = parent; this.partialFieldName = name; this.required = required; } /** * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, * com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[]) */ public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] cb) { TextField tf = new TextField(writer, new Rectangle(rect.getLeft(2), rect .getBottom(2), rect.getRight(2), rect.getTop(2)), partialFieldName); if (required) tf.setOptions(TextField.REQUIRED); tf.setFontSize(12); try { parent.addKid(tf.getTextField()); } catch (Exception e) { throw new ExceptionConverter(e); } } public static void main(String[] args) { System.out.println(Chapter 15: example Sender Receiver); System.out.println(- Creates a PDF file with an AcroForm); System.out.println(- jars needed: iText.jar); System.out.println(- files generated in /results subdirectory:); System.out.println( sender_receiver.pdf); // step 1 Document document = new Document(); try { // step 2 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(C:/Temp/senderreceiver_ + new Random().nextInt() + .pdf)); // step 3 document.open(); // step 4 document.add(new Paragraph(Sender)); PdfFormField sender = PdfFormField.createEmpty(writer); sender.setFieldName(sender); document.add(createTable(writer, sender)); writer.addAnnotation(sender); document.add(new Paragraph(Sender1)); PdfFormField sender1 = PdfFormField.createEmpty(writer); sender1.setFieldName(sender1); document.add(createTable(writer, sender1)); writer.addAnnotation(sender1); document.add(new Paragraph(Sender2)); PdfFormField sender2 = PdfFormField.createEmpty(writer); sender2.setFieldName(sender2); document.add(createTable(writer, sender2)); writer.addAnnotation(sender2); document.add(new Paragraph(Sender3)); PdfFormField sender3 = PdfFormField.createEmpty(writer); sender3.setFieldName(sender3); document.add(createTable(writer, sender3)); writer.addAnnotation(sender3); document.add(new Paragraph(Sender4)); PdfFormField sender4 =
Re: [iText-questions] Tables and FormFields: Is this a bug?
Hi, thanks for the quick reply. Does the problem also exist in the most recent iText version? Yes it does (iText 5.0.5). Thanks Jonny Am 04.01.2011 17:37, schrieb 1T3XT BVBA: Op 4/01/2011 14:45, Johannes Becker schreef: Hi all, thanks to help of you (especially 1T3XT BVBA) I'm now able to create tables with PdfFormFields in them. But now I'm having a strange side-effect: The code attached generates the attached pdf. As you can see, the PdfFormFields of the last table are drawn on the second page, not in the table as I would expect. You're using a mighty old version of iText. I can tell because you're still using com.lowagie classes. Does the problem also exist in the most recent iText version? -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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 -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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
Re: [iText-questions] Tables and FormFields: Is this a bug?
Hi, thanks again for the quick reply. so whatever problem there was: it's already fixed ;-) Good job. Since I'm stuck to an old version, might there be a workaround (i.e. wrapping my tables in some other object)? Thanks Jonny Am 04.01.2011 18:10, schrieb 1T3XT BVBA: /* in_action/chapter15/SenderReceiver.java */ import java.io.FileOutputStream; import java.io.IOException; import java.util.Random; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.ExceptionConverter; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfFormField; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPCellEvent; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.text.pdf.TextField; /** * This example was written by Bruno Lowagie. It is part of the book 'iText in * Action' by Manning Publications. * ISBN: 1932394796 *http://www.1t3xt.com/docs/book.php *http://www.manning.com/lowagie/ */ public class SenderReceiver implements PdfPCellEvent { -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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
Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell
, DocumentException { int options = TextField.MULTILINE | TextField.DO_NOT_SPELL_CHECK; addTextField(rect, 500, options); } private void addTextField(Rectangle rect, int width, int options) throws IOException, DocumentException { TextField tf = new TextField(writer, new Rectangle(rect.getLeft(2), rect.getBottom(2), width, rect.getTop(2)), partialFieldName); tf.setBorderColor(Color.BLACK); tf.setBorderWidth(1); tf.setBorderStyle(PdfBorderDictionary.STYLE_SOLID); tf.setText(text); tf.setOptions(options); parent.addKid(tf.getTextField()); } private void createRadioField(Rectangle rect) throws IOException, DocumentException { RadioCheckField rf = new RadioCheckField(writer, new Rectangle(rect.getLeft(4), rect.getBottom(4), rect.getRight(4), rect.getTop(4)), partialFieldName, ); rf.setChecked(checked); rf.setBorderColor(GrayColor.GRAYBLACK); rf.setBackgroundColor(GrayColor.GRAYWHITE); rf.setCheckType(RadioCheckField.TYPE_CIRCLE); parent.addKid(rf.getRadioField()); } private void createCheckboxField(Rectangle rect) throws IOException, DocumentException { RadioCheckField rf = new RadioCheckField(writer, new Rectangle(rect.getLeft(4), rect.getBottom(4), rect.getRight(4), rect.getTop(4)), partialFieldName, ); rf.setChecked(checked); rf.setBorderColor(GrayColor.GRAYBLACK); rf.setBackgroundColor(GrayColor.GRAYWHITE); rf.setCheckType(RadioCheckField.TYPE_CHECK); parent.addKid(rf.getCheckField()); } } /** * Main method * @param args no arguments needed * @throws IOException * @throws DocumentException */ public static void main(String[] args) throws IOException, DocumentException { TestPDF test = new TestPDF(); } } Thanks jonny Am 27.12.2010 17:48, schrieb Mark Storer: If your CellField event makes a copy, then setting the FF_READ_ONLY flag after creating the event handler won't do you any good. PS: This code won't create radio/check fields. You should at the very least be calling PdfFromField.createButton, createCheckBox or createRadioButton. That or we're missing some Important Code in CellField. --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; DisclaimerCardiff DisCard = null; -Original Message- From: Johannes Becker [mailto:jonnybec...@gmx.net] Sent: Monday, December 27, 2010 6:14 AM To: Post all your questions about iText here Subject: Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell Hi, thanks to your help, I'm able now to to add my checkboxes/radiobuttons/textfields to my table. Only one more thing bugs me: I can't get my fields immutable (except of radiobutton). ... PdfFormField someField = PdfFormField.createEmpty(writer); someField.setFieldName(xxx); PdfPCell someCell = new PdfPCell(); someCell.setCellEvent(new CellField(writer, someField, cellFieldName, FIELD_TYPE_TEXT, someText); someTable.addCell(someCell); someField.setFieldFlags(PdfFormField.FF_READ_ONLY); document.add(someTable); Cheers Jonny Am 23.12.2010 13:01, schrieb 1T3XT BVBA: Op 23/12/2010 10:25, Johannes Becker schreef: Please read chapter 8 for more info. My problem is that im working with the 2007 book. :( Read on until you reach p490. There's a code sample on that page that shows how to: get the connection between the PdfPCellEvent and how to add a RadioCheckField into my cell. Actually, the code sample adds a TextField, not a RadioCheckField, but it's easy to adapt the example. More precise: I dont't know how to get the rect out of the PdfPCellEvent, to dynamically create a RadioCheckFields within the table. I guess I'm missing something here. As I explained in my previous answer: The coordinates of the cell are stored in rect. If I misinterpreted your question, and if you mean you don't understand how cell events work, read section 10.2.2 in the First Edition of iText in Action (that's the 2007 book). -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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 -- Learn how Oracle Real Application Clusters (RAC) One Node allows
Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell
Hi, thanks to your help, I'm able now to to add my checkboxes/radiobuttons/textfields to my table. Only one more thing bugs me: I can't get my fields immutable (except of radiobutton). ... PdfFormField someField = PdfFormField.createEmpty(writer); someField.setFieldName(xxx); PdfPCell someCell = new PdfPCell(); someCell.setCellEvent(new CellField(writer, someField, cellFieldName, FIELD_TYPE_TEXT, someText); someTable.addCell(someCell); someField.setFieldFlags(PdfFormField.FF_READ_ONLY); document.add(someTable); Cheers Jonny Am 23.12.2010 13:01, schrieb 1T3XT BVBA: Op 23/12/2010 10:25, Johannes Becker schreef: Please read chapter 8 for more info. My problem is that im working with the 2007 book. :( Read on until you reach p490. There's a code sample on that page that shows how to: get the connection between the PdfPCellEvent and how to add a RadioCheckField into my cell. Actually, the code sample adds a TextField, not a RadioCheckField, but it's easy to adapt the example. More precise: I dont't know how to get the rect out of the PdfPCellEvent, to dynamically create a RadioCheckFields within the table. I guess I'm missing something here. As I explained in my previous answer: The coordinates of the cell are stored in rect. If I misinterpreted your question, and if you mean you don't understand how cell events work, read section 10.2.2 in the First Edition of iText in Action (that's the 2007 book). -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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 -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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
Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell
Hi, thanks for the quick response. Please read chapter 8 for more info. My problem is that im working with the 2007 book. :( The coordinates of the cell are stored in rect. With these parameters, it's just a matter of creating the checkbox as is done in the book. My problem is, that I quite don't get the connection between the PdfPCellEvent and how to add a RadioCheckField into my cell. More precise: I dont't know how to get the rect out of the PdfPCellEvent, to dynamically create a RadioCheckFields within the table. I guess I'm missing something here. Thanks Jonny Am 23.12.2010 09:29, schrieb 1T3XT BVBA: Op 23/12/2010 8:41, Johannes Becker schreef: private class RadioRectangle implements PdfPCellEvent { public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) { // dont know what to do Get the PdfWriter instance from one of the canvases (for instance canvas[0].getWriter()). The coordinates of the cell are stored in rect. With these parameters, it's just a matter of creating the checkbox as is done in the book. Please read chapter 8 for more info. } } -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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 -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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
[iText-questions] Unmodifiable radiobuttons/checkboxes in table cell
Hi, I'm trying to put radio buttons/checkboxes (checked and unchecked) in a table cell. These buttons shouldn't be modifiable (i.e. only for display). As far as I understood, fields like RadioCheckField are always modifiable. Is there another way to achieve this. I'm using iText 2.1.7. Thanks in advance Jonny -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt auch mit gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl -- Forrester recently released a report on the Return on Investment (ROI) of Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even within 7 months. Over 3 million businesses have gone Google with Google Apps: an online email calendar, and document program that's accessible from your browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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
Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell
Hi, thank you all for the quick responses. You can always set the fields to Read Only as well Ok, didn't know that. Since I'm having textfields in the future, I should prefer this instead of fonts with radio-button/checkbox glyphs. So here comes another problem. Could someone provide me a link/hint/code-snippet, how to add a radio-button/checkbox to a table cell. I read that I would have to add some PdfPCellEvent. // my code so far RadioRectangle radioRectangleEvent= new RadioRectangle(); PdfPTable table = new PdfPTable(2); table.setWidths(new int[] { 5, 100}); PdfPCell radioCell = new PdfPCell(table.getDefaultCell()); radioCell.setCellEvent(radioRectangleEvent); // dont know what to do ... table.addCell(radioCell); // ... private class RadioRectangle implements PdfPCellEvent { public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) { // dont know what to do ... } } Thanks Jonny Original-Nachricht Datum: Wed, 22 Dec 2010 09:13:01 -0800 Von: Leonard Rosenthol lrose...@adobe.com An: itext-questions@lists.sourceforge.net itext-questions@lists.sourceforge.net Betreff: Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell You can always set the fields to Read Only as well -Original Message- From: 1T3XT BVBA [mailto:i...@1t3xt.info] Sent: Wednesday, December 22, 2010 12:10 PM To: itext-questions@lists.sourceforge.net Subject: Re: [iText-questions] Unmodifiable radiobuttons/checkboxes in table cell Op 22/12/2010 17:49, Johannes Becker schreef: Hi, I'm trying to put radio buttons/checkboxes (checked and unchecked) in a table cell. These buttons shouldn't be modifiable (i.e. only for display). So you don't need an interactive form? Then you should use a font containing checkbox glyphs (for instance wingdings). As far as I understood, fields like RadioCheckField are always modifiable. Why would you use RadioCheckField if you don't need an interactive form? Is there another way to achieve this. Search for a font that has checkboxes, use those glyphs. If you don't like this solution: create your own Type3 font so that you can design your own checkboxes. Or use an image (for instance wrapped in a Chunk). -- Forrester recently released a report on the Return on Investment (ROI) of Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even within 7 months. Over 3 million businesses have gone Google with Google Apps: an online email calendar, and document program that's accessible from your browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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 -- Forrester recently released a report on the Return on Investment (ROI) of Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even within 7 months. Over 3 million businesses have gone Google with Google Apps: an online email calendar, and document program that's accessible from your browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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 -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 100,- Euro! https://freundschaftswerbung.gmx.de -- Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions 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
[iText-questions] Looking for something in iText similar like 'region-start/end' in xsl
Hi, I'm a toatal newbie to iText. I have experiences with generating PDF with xsl-fo. My aim is to create a multiple pages with same header, footer, region on the right and left ( 'region-start/end' in xsl ). I found examples for header and footer, but nothing for the region on the right and left. Is there something similar for 'region-start/end' in iText (with example code if possible)? Cheers Jonny __ XXL-Speicher, PC-Virenschutz, Spartarife mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions