  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | PdfFormField expands across entire cell | PdfFormField expands across entire cell 2006-09-20 - By Jon Galentine
Back I performed a search in the archives for this topic however I was unable to find a solution that fits my needs. I apologize if this has already been covered. My problem is when attempting to add a PdfFormField object to a PdfPcell much like the following snippet the form field expands to the full size of the cell. I would like to add the form field to the cell such that it is displayed in the dimensions specified in the Rectangle object and not the full size of the cell. Is this possible, and if so are there any examples available that I can use as a reference? Thank you in advance for your time.
Best Regards,
Jon Galentine
float[] widths = { 0.30f, 0.70f };
PdfPTable fieldTable = new PdfPTable(widths);
RadioCheckField bt = new RadioCheckField(writer, new Rectangle(10, 10, 20, 20), idAtt, value);
bt.setCheckType(RadioCheckField.TYPE_CIRCLE);
PdfFormField ck = bt.getCheckField();
PdfFormField textField = PdfFormField.createTextField(this.writer, false, false, Integer.parseInt(maxLengthAtt));
textField.setWidget(new Rectangle(100, 750, 342, 769), PdfAnnotation.HIGHLIGHT_INVERT);
textField.setFieldName(idAtt);
PdfPCell fieldCell1 = new PdfPCell();
fieldCell1.setMinimumHeight(20f);
fieldCell1.setCellEvent(new FieldPositioningEvents(writer, ck));
PdfPCell fieldCell2 = new PdfPCell();
fieldCell2.setMinimumHeight(20f);
fieldCell2.setCellEvent(new FieldPositioningEvents(writer, textField));
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft -com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http: //www.w3.org/TR/REC-html40">
<head> <meta http-equiv=Content-Type content="text/html; charset=us-ascii"> <meta name=Generator content="Microsoft Word 11 (filtered medium)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} @(protected) Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--> </head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>I performed a search in the archives for this topic however I was unable to find a solution that fits my needs. I apologize if this has already been covered. My problem is when attempting to add a PdfFormField object to a PdfPcell much like the following snippet the form field expands to the full size of the cell. I would like to add the form field to the cell such that it is displayed in the dimensions specified in the Rectangle object and not the full size of the cell. Is this possible, and if so are there any examples available that I can use as a reference? Thank you in advance for your time.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Best Regards,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Jon Galentine<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>float[] widths = { 0.30f, 0.70f };<o:p></o:p></span></font>< /p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>PdfPTable fieldTable = new PdfPTable(widths);<o:p></o:p>< /span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>RadioCheckField bt = new RadioCheckField(writer, new Rectangle(10, 10, 20, 20), idAtt, value);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>bt.setCheckType(RadioCheckField.TYPE_CIRCLE); <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>PdfFormField ck = bt.getCheckField();<o:p></o:p></span>< /font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>PdfFormField textField = PdfFormField.createTextField(this .writer, false, false, Integer.parseInt(maxLengthAtt));<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>textField.setWidget(new Rectangle(100, 750, 342, 769), PdfAnnotation.HIGHLIGHT_INVERT);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>textField.setFieldName(idAtt);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>PdfPCell fieldCell1 = new PdfPCell();<o:p></o:p></span>< /font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>fieldCell1.setMinimumHeight(20f);<o:p></o:p></span></font>< /p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>fieldCell1.setCellEvent(new FieldPositioningEvents(writer, ck));<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>PdfPCell fieldCell2 = new PdfPCell();<o:p></o:p></span>< /font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>fieldCell2.setMinimumHeight(20f);<o:p></o:p></span></font>< /p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>fieldCell2.setCellEvent(new FieldPositioningEvents(writer, textField));<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions
|
|
 |