You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Marko Kattelus (JIRA)" <ji...@apache.org> on 2015/12/02 12:05:10 UTC

[jira] [Commented] (PDFBOX-3148) Multiline fields won't get rendered correctly if there are multiple paragraphs in field value

    [ https://issues.apache.org/jira/browse/PDFBOX-3148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15035639#comment-15035639 ] 

Marko Kattelus commented on PDFBOX-3148:
----------------------------------------

Code used in testing:
{code}
public class PDFBoxMultilineTest {

    @Test
    public void testGeneration() throws IOException  {
        File template = FileBackedStringAssert.resolveResource("PDFBox_test.pdf");
        File result = File.createTempFile("test", ".pdf");

        PDDocument pdfDocument = PDDocument.load(template);

        // get the document catalog
        PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm();
        fillField(acroForm, "multiline", "1\n2\n3\n4");

        // Save and close the filled out form.
        pdfDocument.save(result);
        pdfDocument.close();
        Desktop.getDesktop().open(result);
    }

    private void fillField(PDAcroForm acroForm, String fieldName, String value) throws IOException {
        PDField field = acroForm.getField(fieldName);
        field.setValue(value);
        field.setReadOnly(true);
    }
}
{code}

> Multiline fields won't get rendered correctly if there are multiple paragraphs in field value
> ---------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3148
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3148
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: Marko Kattelus
>
> I have problem with multiline fields in form filling. It seems that if i have value with newlines "\n" rendering won't work correctly. Every line seems to be rendered over previous line. 
> E.g. 
> {code}
> value = "1\n2\n3\n4"
> {code}
> will be rendered so than every number are rendered over each other but what I'm expecting would be something like:
> {code}
> 1
> 2
> 3
> 4
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org