Line break PHP

  • Last Post 04 September 2012
Rather Wild posted this 07 July 2012

I was wondering if there is a way return line breaks with "exportFormat=txt" (PHP) or any other way to return each line of text on the image as a separate line and/or variable? Rich Text Format returns too much text formatting for my use.

Order By: Standard | Newest | Votes
Rather Wild posted this 11 July 2012

I figured it out. I saved the response string to a file and used "fgets" to get each separate line of the file.

dan8833 posted this 28 August 2012


Can you post your code here? I am trying to do the same too

Rather Wild posted this 28 August 2012

Here's the code I added to the ABBYY PHP example:

$file_name = "ocr_file"; //whatever you want to name the file(I auto generate a unique name)

$myFile = "directory of where you want to save the file/".$file_name.".txt";

//write the file

$fh = fopen($myFile, 'w') or die("can't open file");

$stringData = $response;

fwrite($fh, $stringData);


$file = fopen($myFile, "r") or exit("Unable to open file!");

//Output a line of the file until the end is reached



echo fgets($file). "
"; }


dan8833 posted this 04 September 2012

thanks for the code