HTMLToQPDF icon indicating copy to clipboard operation
HTMLToQPDF copied to clipboard

Empty paragraphs <p> not being displayed

Open mjefim opened this issue 1 year ago • 4 comments

Hi, I am trying to render html that contains empty paragraphs to provide some spacing in the text. The issue is that if the paragraphs are empty the output does not seem to contain them. I am attaching the test html and a screenshot of the output (please ignore the yellow masking, it just hides other information).

Image of the output: image

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <style>
          body {  font-family:Calibri;
          }
          p {  margin-bottom: 15px;
          }
      </style>
  </head>
  <body>
    <p>Testing the empty paragraphs for spacing.</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>two empty paragraphs before this</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>three empty paragraphs before this</p>
  </body>
</html>

mjefim avatar Oct 10 '24 08:10 mjefim

Hi, why empty paragraphs?

Maybe you should try something else, like <br> ?

uladzimirvysotski avatar Oct 10 '24 19:10 uladzimirvysotski

The HTML is the output of a WSIWYG editor, so I can not fully control the HTML in advance. I guess it could be possible to replace it the empty paragraph with the line break but I would rather keep the preprocessing to a minimum. Is there another solution perhaps?

mjefim avatar Oct 11 '24 04:10 mjefim

You always can contribute :)

uladzimirvysotski avatar Oct 11 '24 09:10 uladzimirvysotski