pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Multi-line text or wrap to next line Issue
Date Tue, 14 Oct 2014 20:43:08 GMT
Hi,

just pass it with the line breaks within the string and make sure the multiline property for
the field is set.

Maruan

Am 14.10.2014 um 21:07 schrieb Rajeev Menon <rajeevrmenong@gmail.com>:

> Hello,
> 
> I am using PDFBox to populate data on a PDF form (AcroForm). Here is a
> sample code that I am using to fill the data on to the PDF.
> 
>    public void fillPDF(HashMap<String, String> mpData) {
>        try {
>            PDDocumentCatalog docCatalog = pdfDoc.getDocumentCatalog();
>            PDAcroForm acroForm = docCatalog.getAcroForm();
> 
>            Iterator<Entry<String, String>> itrData =
> mpData.entrySet().iterator();
>            while (itrData.hasNext()) {
>                Entry<String, String> entryData = itrData.next();
>                PDField fldPD = acroForm.getField(entryData.getKey());
>                if (fldPD!=null) {
>                    fldPD.setValue(entryData.getValue());
>                }
>            }
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
> 
>    }
> 
> 
> If one of the strings is "First line \n Second line \n Third line", how do
> I populate this text to the PDF so that each piece of text will be on a new
> line in the field. Please advise.
> 
> Thanks.
> Reevs.


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