Comments (6)
@wildrove I have noticed in my own testing that RTF files saved with WordPad or MS Word have a null byte (0x00) on the end of the file after the closing }
. I get the same error as you when attempting to parse those files.
If your error is the same cause, you can work around it by using rtrim($evolution)
to chop it off.
from rtf-html-php.
Hi @wildrove and sorry for the inconvenience.
Please debug your code and check what contents the $evolution variable passes to the HtmlRtfPhp module. If you still encounter the same problem then please append the RTF string that causes the trouble.
Regards
from rtf-html-php.
@wildrove If you are retrieving the value from the DB, it's highly likely the DB column isn't large enough. Change to LONGTEXT if using mysql.
from rtf-html-php.
Hi Everyone,
Thank you for your support. I've stopped with this project for some months, but I started it again. And I keep getting the same errors. I'll try to explain better my issues this time. I'm using a Firebird Database and the table which I'm receiving the Rtf data is that in this image :
. As you can see is a BLOB Column I'm novice in PHP and I don't know BLOB type. Below there is an example of rtf file came from this column, I debugged using var_dump() function to show here.
rtf.txt. Below there is de php file where I'm trying to run some tests but I keep getting the same issues yet.
`<?php
session_start();
require '../../vendor/autoload.php';
use Classes\Pacient\PacientEvolution\PacientEvolution;
use RtfHtmlPhp\Document;
use RtfHtmlPhp\Html\HtmlFormatter;
$pacientProntuary = intval($_GET['regProntuary']);
$pacientRegistry = (isset($_GET['regPacient']) ? intval($_GET['regPacient']) : "");
$hourEvo = $_GET['hourEvolution'];
$dateEvo = $_GET['dateEvolution'];
$pacientName = (isset($_GET['pacientName']) ? $_GET['pacientName'] : "");
$mother = (isset($_GET['mother']) ? $_GET['mother'] : "");
$birthday = (isset($_GET['birthday']) ? date('d/m/Y', strtotime($_GET['birthday'])) : "");
$type = (isset($_GET['type']) ? $_GET['type'] : "");
$resumeType = (isset($_GET['resumeType']) ? $_GET['resumeType'] : "");
$pacientEvolution = new PacientEvolution();
$rtf;
$pacientEvo = $pacientEvolution->pacientEvo($pacientProntuary,$dateEvo,$hourEvo);
foreach ($pacientEvo as $key => $value) {
$rtf = $pacientEvo[$key]['EVOLUCAO'];
}
$document = new Document($rtf);
echo $document;`
Is there a way to fix this issues? I can't find any solution to this.
from rtf-html-php.
@wildrove I have noticed in my own testing that RTF files saved with WordPad or MS Word have a null byte (0x00) on the end of the file after the closing
}
. I get the same error as you when attempting to parse those files.
If your error is the same cause, you can work around it by usingrtrim($evolution)
to chop it off.
Hi @Leshana thank you for your tip. I used trim() and worked for me. I don't know what happend but worked. But unfortunately grids are removed from tables presents in some string.
from rtf-html-php.
@wildrove if u wanna to maintain the grid, u only need to use rtrim($evolution, "\0"); that will only remove the NUL caracter at the end.
from rtf-html-php.
Related Issues (20)
- PHP 8.2 and 9.0 HOT 2
- Testing rtf before parsing HOT 1
- Fatal error HOT 1
- New release needed
- line break corruption
- List color
- Output just plain text HOT 1
- Parse error: RTF text outside of group HOT 4
- Bad conversion in this case HOT 1
- table not convert proper
- throw new Exception in Document on line 30
- Not working in my case (example)
- Error: Creating default object from empty value HOT 1
- join(): Passing glue string after array is deprecated. Swap the parameters
- New release ? HOT 1
- Error encoding image HOT 1
- One Line HTML output
- Uncaught Error: Call to a member function toStyle() on null in /vendor/henck/rtf-to-html/src/Html/State.php:68 Stack trace: #0
- WingDings font gives "iconv(): Detected an incomplete multibyte character in input string" HOT 1
- Converting RTF portugues file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtf-html-php.