
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
html-to-rtf
Advanced tools
This project convert html to rtf format in the Browser (v2.0.0+) and the server with NodeJS.
$ npm install html-to-rtf
* Encoding string correctly (v2.0.1)
* Setting correct space and fix some insecure dependencies (v2.0.4)
* Improving better control of spaces (v2.1.0)
<html>
<head>
<title>Teste HTML TO RTF</title>
<script src="./node_modules/html-to-rtf/app/browser/bundle.js"></script>
<script type="text/javascript">
window.onload = function() {
const html =`<p style="color:#333;" align="center">text of p<b>start b <i>italic with bold</i>final text of b</b><i>italic<i>final text of p </p>`;
document.getElementById('html').innerHTML = html;
document.getElementById('rtf').innerHTML = htmlToRtf(html);
}
</script>
<link rel="stylesheet" href="./node_modules/html-to-rtf/app/browser/style.css">
</head>
<body>
<h1>HTML To RTF Example:</h1>
<div class="container">
<h2>HTML</h2>
<textarea id="html" readonly></textarea>
</div>
<div class="container">
<h2>RTF</h2>
<textarea id="rtf" readonly></textarea>
</div>
</body>
</html>
There is a file example (index.html) in "./node_modules/html-to-rtf/app/browser/index.html"
var htmlToRtf = require('html-to-rtf');
var html = `
<h1>Title <span style="color:rgb(255,0,0);">with</span> tag h1<h1>
<div>
<p style="color:#333; margin:5px;" class="test" align="center">
text of paragraph <b>text with bold <i>text with italic and bold</i></b><i>text with italic</i>
</p>
<p style="color:rgb(255,0,0);" align="right">red paragraph => right with tag</p>
<p style="color:rgb(0,0,255); text-align:center;">blue paragraph => center with style</p>
<table>
<tbody>
<tr>
<td><mark>column 1</mark></td>
<td>column 2</td>
<td><mark>column 3</mark></td>
<td>column 4</td>
</tr>
<tr>
<td>content 1</td>
<td>content 2<br></td>
<td>content 3<br></td>
<td>content 4<br></td>
</tr>
</tbody>
</table>
</div>
`
htmlToRtf.saveRtfInFile('<Path>/<FileName>.rtf', htmlToRtf.convertHtmlToRtf(html))
Now test in your preferred text editor (wordpad, word, libreoffice, ...).
You can't copy the output of terminal. Save the output at a file.rtf
<b>, <br>, <center>, <div>, <em>, <font>, <h1>, <h2>, <h3>, <h4>,
<h5>, <h6>, <i>, <li>, <mark>, <p>, <ol>, <s>, <span>, <sub>, <sup>,
<strong>, <table>, <td>, <th>, <tr>, <u>, <ul>
color(Hex and Rgb), font-size(px), text-align
$ gulp tests
- Ozires R.S.O.F
This project is licensed under the MIT License
FAQs
Convert html to rtf format in the browser and the server
We found that html-to-rtf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.