2017 © Pedro Peláez
 

library php-rtflex

A simple library to allow parsing of RTF files and strings. Forked from skyh13/php-rtflex which is a fork of silvermine/php-rtflex.

image

mike-k-burke/php-rtflex

A simple library to allow parsing of RTF files and strings. Forked from skyh13/php-rtflex which is a fork of silvermine/php-rtflex.

  • Thursday, June 28, 2018
  • by mike-k-burke
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

RTFLex

Build Status, (*1)

RTFLex is a simple lexer / tokenizer for RTF formatted data., (*2)

Example Usage

RTFLex allows you to easily extract plain text from an RTF formatted file, or a text string containing RTF formatting. Here's how you would read an RTF file:, (*3)

require_once "rtflex/RTFLexer.php";

use RTFLex\io\StreamReader;
use RTFLex\tokenizer\RTFTokenizer;
use RTFLex\tree\RTFDocument;

$reader = new StreamReader('/path/to/myFile.rtf');
$tokenizer = new RTFTokenizer($reader);
$doc = new RTFDocument($tokenizer);
echo $doc->extractText();

While RTFLex uses namespaces to organize it's inner-workings, it also provides a simple, global, front-end class for easy of use. This accomplishes the same as the above code:, (*4)

require_once "rtflex/RTFLexer.php";

$doc = RTFLexer::file('/path/to/myFile.rtf');
echo $doc->extractText();

RTFLex also lets you easily extract hidden metadata from an RTF file. Take, for example, the follow RTF header:, (*5)

{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\info
{\title Sample Title}
{\subject Sample Subject}
{\author Craig Weber}
{\*\company silvermine}
{\*\copyright 2013 silvermine.}}\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
...

Using the RTFDocument class, it's easy to extract those field., (*6)

$doc = RTFLexer::file('/path/to/myFile.rtf');
echo $doc->extractMetadata('title');     // => "Sample Title"
echo $doc->extractMetadata('copyright'); // => "2013 silvermine."

The Versions

28/06 2018

dev-master

9999999-dev

A simple library to allow parsing of RTF files and strings. Forked from skyh13/php-rtflex which is a fork of silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

28/06 2018

0.6

0.6.0.0

A simple library to allow parsing of RTF files and strings. Forked from skyh13/php-rtflex which is a fork of silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

28/06 2018

0.5

0.5.0.0

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

02/06 2016

0.4

0.4.0.0

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

01/06 2016

dev-development

dev-development

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

01/06 2016

dev-release/0.4

dev-release/0.4

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

11/05 2016

0.3

0.3.0.0

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

11/05 2016

dev-release/0.3

dev-release/0.3

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

05/04 2016

0.2

0.2.0.0

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

20/08 2015

0.1

0.1.0.0

A simple library to allow parsing of RTF files and strings. Forked from silvermine/php-rtflex.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires