Closed zoozalp closed 4 years ago
Can you replace your <p></p>
with <br>
? If yes, then it will work.
If you cannot, then I'll have to take some time to think about it... As it's Christmas holidays I may not have time to check it before at least a few days.
Nice catch! Content is coming from Quill. I'll try to replace as you suggested on the fly and see how it works.
It worked for the sample html I posted above but unfortunately it doesn't work for the rest of the document.
Here is another example;
<table border="1">
<tbody>
<tr>
<td align="center" valign="top">
<p>TARİH</p>
<p style="color: blue;">DATUM</p>
</td>
<td align="center" valign="top">
<p>ÜNİTE VE KONULAR</p>
<p style="color: blue;">LEKTIONEN UND THEMEN</p>
</td>
</tr>
</tbody>
</table>
Ok. I'll review it later this week or sometime next week.
It looks like the issue is related to PDFMake and not to my library. Inside cells, we have to use \n
to have the texte on several lines (based on PDFMake website).
So, I guess you're stuck with using <br>
. You can inject <br>
after your </p>
in your HTML code. For example:
yourHTMLcode.replace(/<\/p>\n(\s+)?<p/g,'</p><br><p')
It will return (using your last example):
<table border="1">
<tbody>
<tr>
<td align="center" valign="top">
<p>TARİH</p><br><p style="color: blue;">DATUM</p>
</td>
<td align="center" valign="top">
<p>ÜNİTE VE KONULAR</p><br><p style="color: blue;">LEKTIONEN UND THEMEN</p>
</td>
</tr>
</tbody>
</table>
And, once translated by html-to-pdfmake
:
Hi,
I'm having a styling problem with the following html. Can you please help me figure this out?
The problem also exists in the playground.