pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ragunath marudhachalam <ragu.w...@gmail.com>
Subject Textbox word wrap and multiline help...
Date Wed, 19 Aug 2015 18:04:22 GMT
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());
        }
     }

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message