Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 179371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:23:43+00:00 2026-05-11T14:23:43+00:00

I have an RTF file that I want to display inside a web page

  • 0

I have an RTF file that I want to display inside a web page after tags have been replaced with user input.

I would like to be able to display the RTF file without having to convert it to something before displaying it.

Every time I try it now it gives me the popup open/save box even though I am telling it to display it inline with:

header('Content-type: application/msword'); header('Content-Disposition: inline; filename=mark.rtf'); header('Content-length: ' . strlen($output));  echo $output; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:23:44+00:00Added an answer on May 11, 2026 at 2:23 pm

    Most browsers won’t reliably display RTF content. It IS possible to parse the RTF into HTML, and display the HTML content on your web page however.

    You need some kind of program to parse RTF and convert it to HTML. I’m assuming it has to be free. I do not know of any reliable free RTF parsing or RTF to HTML libraries in PHP.

    I recommend you use a command-line conversion program like RTF2HTML: http://sageshome.net/?w=downloads/soft/RTF2HTML.html

    You would need to download and install this program on your webserver, allow the user to upload the file to a temp directory, and then call the command line application from PHP with shell_exec():

    $html_output_path = '/path/for/processing/files/' $html_output_filename = $username . $timestamp; if (is_uploaded_file($_FILES['userfile']['tmp_name']) {   shell_exec('rtf2html ' .      escapeshellarg($_FILES['userfile']['tmp_name']) . ' ' .     $html_output_path . $html_output_filename); } $html_to_display = file_get_contents($html_output_path .    $html_output_filename); 

    Then, parse the results as HTML and display them. Not a bad strategy. Note that you will probably need to remove the head, body and possibly other tags if you’re going to display the content inside another web page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 85k
  • Answers 85k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can call the php exec function to execute whoami:… May 11, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer href and onclick both get fired when you click an… May 11, 2026 at 5:08 pm
  • Editorial Team
    Editorial Team added an answer First, you need to add a custom XML namespace that… May 11, 2026 at 5:08 pm

Related Questions

I have an RTF file that I need to display to a user. I
I currently have a PrintingWebService that I call from an AJAX page with all
I have an excel document represented as a byte[] and I'm wanting to send
using jython I have a situation where emails come in with different attachments. Certain

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.