Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • tbisof 7 posts 87 karma points
    Aug 26, 2015 @ 09:37
    tbisof
    0

    PDF output not respecting line breaks

    This is the second issue from my previous thread.

    The PDF generator is not respecting HTML line breaks in the generation of the PDF file, but instead prints out one big chunk of text. Due to this, we have to go and manually edit the HTML in Umbraco for each post to get the formatting right. Our solution so far was to replace the line breaks (which Umbraco automatically adds as you use the text editor) with paragraph tags which print out in the PDF correctly.

    You can see this more clearly in the examples below:

    http://i.imgur.com/57QWKvo.jpg (before fix)

    http://i.imgur.com/ciYwjcU.jpg (after fix)

    Thanks for any help you can provide,

    Tomislav

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Aug 26, 2015 @ 13:18
    Darren Ferguson
    100

    In the sample templates you'll see a function ParseElement.

    You need to add a case that replaces the br tag with something - probably a fo:block of a fixed height:

    @helper ParseElement(XmlNode node) { 
      @* @node.Name *@
      switch(node.Name) 
      {
        case "p":
          <fo:block margin-bottom="0.5cm">
            @ParseRichText(node.ChildNodes)
          </fo:block>
          break;
        case "strong":
          <fo:inline font-weight="bold">
            @ParseRichText(node.ChildNodes)
          </fo:inline>
          break;
        case "em":
    
  • tbisof 7 posts 87 karma points
    Aug 27, 2015 @ 07:44
    tbisof
    0

    Thank you very much! Adding a case for br fixed the problem.

    case "br":
            <fo:block margin-bottom="0.25cm">
            </fo:block>
            break;
    
Please Sign in or register to post replies

Write your reply to:

Draft