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 8070733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:29:48+00:00 2026-06-05T13:29:48+00:00

Is there a way in PHP to access compressed RTF and ouput RTF code

  • 0

Is there a way in PHP to access compressed RTF and ouput RTF code to the browser?

I have a text column in SQL and I would like to extract the RTF from it – I have managed to output the data as 0x1F8B

I believe this data is compressed RTF – http://www.freeutils.net/source/jtnef/rtfcompressed.jsp

Using [MS-OXRTFCP]: Rich Text Format (RTF) Compression Algorithm http://msdn.microsoft.com/en-us/library/cc463890%28v=exchg.80%29

Sample data :

0x1F8B0800000000000000654E316EC3300CEC5CA07FE0D6AD909D1628E0A1C8D01F74E422CB94CD46A11C4A6E5018F97B6967EC72381EC9BB5B516B6CD04BE11DC23C36ED5B8B03C5E8364C5EC6C61D0E2BC62CB5F6C988C358AE5C0AC6592F2DC630792D541D1C957DEA6E76D260144EFF57B7A7C715434E59CD0A3A541A1C8E4A240EFBB490EBEC027F98AE2796E11597D0E0EC75C013D1BC8360F1EF0EC316B115695BF89A08CE390B70816ABC571EA74AA542EEBF295460D975642B069F5EEBF45C6CB27707E5F4FBB14558EC1D83D9EEEC28D9BE142E8B59719697BB6C051FFE00D09796A337010000

And this looks like what I want but its in VB http://www.vbforums.com/attachment.php?attachmentid=87371&d=1326754610

  • 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. Editorial Team
    Editorial Team
    2026-06-05T13:29:50+00:00Added an answer on June 5, 2026 at 1:29 pm

    Your data sample is gzipped data, use gzdecode to decode it. You’ll need to pass a binary string not the hex string supplied(use hex2bin or pack to convert)

    if (!function_exists(hex2bin)){
        function hex2bin($hexStr){
            return pack('H*', $hexStr);
        }
    }
    $rtf = gzdecode(hex2bin('1F8B0800000000000000654E316EC3300CEC5CA07FE0D6AD909D1628E0A1C8D01F74E422CB94CD46A11C4A6E5018F97B6967EC72381EC9BB5B516B6CD04BE11DC23C36ED5B8B03C5E8364C5EC6C61D0E2BC62CB5F6C988C358AE5C0AC6592F2DC630792D541D1C957DEA6E76D260144EFF57B7A7C715434E59CD0A3A541A1C8E4A240EFBB490EBEC027F98AE2796E11597D0E0EC75C013D1BC8360F1EF0EC316B115695BF89A08CE390B70816ABC571EA74AA542EEBF295460D975642B069F5EEBF45C6CB27707E5F4FBB14558EC1D83D9EEEC28D9BE142E8B59719697BB6C051FFE00D09796A337010000'));
    

    Here is the raw data.

    {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fnil\fcharset0 Arial;}}
    {\colortbl ;\red0\green0\blue0;}
    \viewkind4\uc1\pard\keep\keepn\sa80\cf1\f0\fs22 The moon is the brightest object in the \i\f1 Earth's \i0\f0 sky?\par
    \par
    \cf0\par
    Another question.\par
    }
    

    And this is the rendered text.

    The moon is the brightest object in the Earth’s sky?

    Another question.

    I’m not sure if you only want the raw rtf or rendered, take a look at Free (preferably) PHP RTF to HTML converter? if you want the rtf in html.

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

Sidebar

Related Questions

I would like to know if there is a way to prevent PHP from
If yes is there any way to access a var defined in another PHP
Is there a way to get PHP-like print_r(object) funcionality in iPython? I know I
Is there a good way (PHP class/function) to access Gmail Contacts List? If not
I have a web folder that I would like to restrict access to via
Is there a way to hide my password for database access in my config.php
When using PHP PDO to access the database, is there a way to list
Ok, is there a way for the PHP user (www-data) to gain access to
Is there an easy way to create dictionary like associative array in php? in
Is there a better way in PHP to access this array in groups of

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.