Hi, multiline has to be set before setting the fields value
BR Maruan > Am 19.08.2015 um 20:04 schrieb ragunath marudhachalam <[email protected]>: > > Hello, > > In one of the mailing list posting, it was mentioned that pdfbox2.0 > snapshot supports multiline in a pdtextbox. I downloaded 2.0 snapshot and > setmultiline to true. But I still get only a single line without word > wrap. I am attaching my code where I set the value for the field and set > multiline to true. Can someone please assist me and suggest how I can get > the word wrap working if the text is larger than the textbox. Thank you > very much for your help and time.. > > while (fieldsIter.hasNext()) > { > PDField field = (PDField) fieldsIter.next(); > String fieldName = field.getPartialName(); > //logger.error("field name "+ fieldName); > if(field instanceof PDCheckbox) > { > PDCheckbox cb = (PDCheckbox)field; > //cb.check(); > } > else > { > if(!field.isReadonly()) > { > if(field instanceof PDVariableText) > { > logger.error("variable text"); > String fieldNameToCheck = field.getPartialName().substring(0, > 3); > if(map.get(fieldNameToCheck) != null) > { > if(field.getPartialName().contains("CURRENCY")) > { > field.setValue("$ "+ (String)map.get(fieldNameToCheck)); > } > else if(field.getPartialName().contains("PERCENT")) > { > field.setValue((String)map.get(fieldNameToCheck) +"%"); > } > else > { > field.setValue(map.get(fieldNameToCheck)); > } > ((PDVariableText) field).setMultiline(true); > //field.setReadonly(true); > } > > } > else > { > String fieldNameToCheck = field.getPartialName().substring(0, > 3); > if(map.get(fieldNameToCheck) != null) > { > if(field.getPartialName().contains("CURRENCY")) > { > field.setValue("$ "+ (String)map.get(fieldNameToCheck)); > } > else if(field.getPartialName().contains("PERCENT")) > { > field.setValue((String)map.get(fieldNameToCheck) +"%"); > } > else > { > field.setValue(map.get(fieldNameToCheck)); > } > //field.setReadonly(true); > } > } > } > > > } > //processField(pdf, field, "|--", field.getPartialName()); > } > } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

