Skip to content

Commit 9bcabd6

Browse files
authored
Merge pull request #79 from devdreamsolution/master
update code
2 parents e6b4c48 + 8c0c058 commit 9bcabd6

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

index.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
error_reporting(-1);
3+
ini_set('display_errors', 'on');
4+
require_once __DIR__ . '/vendor/autoload.php';
5+
6+
use RtfHtmlPhp\Document;
7+
use RtfHtmlPhp\Html\HtmlFormatter;
8+
9+
$original = file_get_contents("tests/rtf/hello-world.rtf");
10+
11+
$document = new Document($original); // or use a string directly
12+
$formatter = new HtmlFormatter('UTF-8');
13+
$r = $formatter->Format($document);
14+
file_put_contents('rtf.html', $r);
15+
echo $r;
16+
?>

src/Document.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected function Parse(string $rtf)
302302
$this->group = null;
303303
$this->root = null;
304304

305-
while($this->pos < $this->len)
305+
while($this->pos < $this->len-1)
306306
{
307307
// Read next character:
308308
$this->GetChar();

0 commit comments

Comments
 (0)