Simplifier Community Home Forums Simplifier Forum Linebreaks in PDF

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25446
    AvatarJMH
    Participant
    • Topics: 1
    • Replies: 1
    • Padawan

    Hey there,

    im trying to create a pdf file via plugin.

    How do i have to handle the line breaks from a Textarea for example. Either im getting just plain text in the pdf file or \n as written text in the pdf.

     

    Textarea:

    1

    2

    3

     

    PDF: 123 or “1\n2\n3”

     

    Thank you in advance.

    #25471
    AvatarNina Schmidt
    Moderator
    • Topics: 0
    • Replies: 2
    • Padawan
    Up
    1
    Down

    Hi JMH,

    you can use the html <pre> element. With it you can display formatted text exactly as you define it in your html document. You can read more about it here.

    I tried this in a small example and got the following result:

    Picture final PDF: See Attachment “PDF_withLinebreaks”

    Picture text field: See Attachment “textField”

    Code in the PDF Plugin  template:

    <h2>Welcome to the PDF Generator</h2>
    <p>Content of text field saved as String</p>
    <pre>{{textfield1}}</pre>
    

    Is this the format you are looking for?

    Best regards,

    Nina

    • This reply was modified 5 days, 23 hours ago by AvatarNina Schmidt.
    Attachments:
    You must be logged in to view attached files.
    #25487
    AvatarJMH
    Participant
    • Topics: 1
    • Replies: 1
    • Padawan
    Up
    1
    Down

    Works perfectly now.

    Huge thanks for the details.

    Regards

    JMH

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.