pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Textbox word wrap and multiline help...
Date Wed, 19 Aug 2015 20:44:37 GMT
Hi,

multiline has to be set before setting the fields value

BR
Maruan

> Am 19.08.2015 um 20:04 schrieb ragunath marudhachalam <ragu.work@gmail.com>:
> 
> 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: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message