Code Monkey home page Code Monkey logo

Comments (6)

Leshana avatar Leshana commented on August 16, 2024 2

@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.

sipryan avatar sipryan commented on August 16, 2024

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.

bretto36 avatar bretto36 commented on August 16, 2024

@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.

wildrove avatar wildrove commented on August 16, 2024

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 :
Colummn BLOB. 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;`

rtf error
Is there a way to fix this issues? I can't find any solution to this.

from rtf-html-php.

wildrove avatar wildrove commented on August 16, 2024

@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.

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.

fialhoFabio avatar fialhoFabio commented on August 16, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.