Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

582
Views
How can I convert RTF to plain text in JavaScript (removing images and styling)?

I am trying to remove all RTF formatting from a document but when I do so it seems to keep images and styling (i.e. the Fonts etc.)

Here is my Code:

    function convertToPlain(rtf) {
    rtf = rtf.replace(/\\par[d]?/g, "");
    return rtf.replace(/\{\*?\\[^{}]+}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?/g, "").replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

var body = input[0].text.toString();

var content = convertToPlain(body.toString());  
var rq = <Test>{content}</Test>
next.xml = rq;

This does remove the RTF formatting but keeps all images and styling within the result.

Does anyone know how to remove the images and styling aswell?

Thanks

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!