Giter Club home page Giter Club logo

Comments (3)

Aymkdn avatar Aymkdn commented on August 29, 2024

line-height in PDFMake doesn't work like in HTML/CSS. I'd recommand to use a number value only instead of a number + "px/%" (e.g. line-height:1.2), and to do some test in the PDFMake playground to find which value would work best with your expectation. In your case, the use of line-height is weird, and maybe a padding/margin would be good enough?!

Also your HTML code is messy and has too many layers of unnecessary tags, that may cause an unexpected result. The translation of the HTML to PDFMake is very complex, and this tool is only here for simple code and quick page layout.

Try to simplify your HTML code. For example:

<div id='element-to-print'>
  <div style="color: #2d2d2d;font-weight:bold;margin-top:5px;font-size:19.2px;">First sentence</div>
  <ul>
    <li>Option 1</li>
    <li>Option 2</li>
    <li>Option 3</li>
  </ul>
  <div style="color: #2d2d2d;font-weight:bold;margin-top:15px;font-size:19.2px;">Second sentence</div>
  <ul>
    <li>Option 4</li>
  </ul>
</div>

And finally, be aware that <p> adds by default a margin which could also impact the result.

from html-to-pdfmake.

codeservice avatar codeservice commented on August 29, 2024

Also your HTML code is messy and has too many layers of unnecessary tags,

Yes, this code generated by html WYSIWYG editor. Whoever using it doesn't understand html code well, but this code valid. I can't really tell them how to modify html for export optimization. Only solution for now is to disable line-height.

from html-to-pdfmake.

Aymkdn avatar Aymkdn commented on August 29, 2024

Yes, I think it's better to remove line-height in your case :-)

from html-to-pdfmake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.