Giter Club home page Giter Club logo

Comments (5)

Aymkdn avatar Aymkdn commented on July 25, 2024 2

I see. But, too late, I'm already gone on vacation....

While waiting for me to get back, you can remove . trim() on

text = element.textContent.replace(/\n(\s+)?/g, "").trim();

When I'm back I'll release a new version with a fix.

from html-to-pdfmake.

Aymkdn avatar Aymkdn commented on July 25, 2024

Yes I added a trim because it seemed useless to keep empty spaces like that. What is the issue with that?

from html-to-pdfmake.

Aymkdn avatar Aymkdn commented on July 25, 2024

If you have an example of a problematic code to let me understand what's going on?

from html-to-pdfmake.

matt-quoin avatar matt-quoin commented on July 25, 2024

Thanks for the quick reply! An example would be this HTML:

<p>
    This is a sentence with a <strong>bold word</strong>, <em>one in italic</em>,
    and <u>one with underline</u>.
</p>

which converts to:

[
  {
    "text": [
      {
        "text": "This is a sentence with a"
      },
      {
        "text": "bold word",
        "bold": true,
        "style": [
          "html-strong"
        ]
      },
      {
        "text": ","
      },
      {
        "text": "one in italic",
        "italics": true,
        "style": [
          "html-em"
        ]
      },
      {
        "text": ", and"
      },
      {
        "text": "one with underline",
        "decoration": "underline",
        "style": [
          "html-u"
        ]
      },
      {
        "text": "."
      }
    ],
    "margin": [
      0,
      5,
      0,
      10
    ],
    "style": [
      "html-p"
    ]
  }
]

which looks like this in the pdf:
Screen Shot 2019-08-30 at 8 59 25 AM

The spaces around the words in bold, italics, or underlined get removed so the word 'a' is now attached to the word 'bold', etc.

from html-to-pdfmake.

Aymkdn avatar Aymkdn commented on July 25, 2024

That should be resolved with v1.0.7

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.