Line break PHP

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.

Was this article helpful?

0 out of 0 found this helpful

Comments

4 comments

  • Avatar
    Rather Wild

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

    0
  • Avatar
    dan8833

    Hi,

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

    0
  • Avatar
    Rather Wild

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

    fclose($fh);

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

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

    while(!feof($file))

    {

    echo fgets($file). "
    "; }

    fclose($file);

    0
  • Avatar
    dan8833

    thanks for the code

    0

Please sign in to leave a comment.