Hi
I want to read a pdf file using php. but i want toread that file line by line and made changes in it is it possible
thanks

Hi akbar ali butt,

Without knowing further details, it's hard to say if it's possible or not. It is certainly possible to open, create and modify PDF's using PHP's built in PDF functions. You may benefit from reading through the PDF functions that PHP offers and deciding for yourself if that will be enough to suit your needs:

http://www.php.net/manual/en/ref.pdf.php

Let us know if you have further questions.

Thanks chrelad
For your reply i am new to php igot that link for multiple sites but i am unable to configure php for pdflib library and its use.

i am able to read from html replace the text according to requirement and generate a pdf.
but i want to read from pdf instead oh html and then replace the the text and generate the pdf again

i also want to do url rewriting dynamically is it possible

Thanks again

hi,
i want to read file pdf with php
i have this problem and i don't find
in the web
you can help me
thanks

To re write url dynamically you need to fetch data from Db and write
echo "<script>window.location='Your URL from DataBase';</script>"
its sipmle and works or use function header("Location: URL");

Hi,
akbar ali butt did u know the method to read the text in pdf files line by line ?

Did anyone else know how to read pdf text line by line to locate specific text ?

Edited 6 Years Ago by NewToPhp: n/a

Read PDf File Using php

<?php

function pdfVersion($filename)
{
    $fp = @fopen($filename, 'rb');

    if (!$fp) {
        return 0;
    }

    /* Reset file pointer to the start */
    fseek($fp, 0);

    /* Read 20 bytes from the start of the PDF */
    preg_match('/\d\.\d/',fread($fp,20),$match);

    fclose($fp);

    if (isset($match[0])) {
        return $match[0];
    } else {
        return 0;
    }
} 

$version = pdfVersion("example.pdf");

Edited 4 Years Ago by ampere: formatted

<?php
$filename= 'sample.pdf';
  header('Content-type: application/pdf');
  header('Content-Disposition: inline; filename="' . $filename . '"');
  header('Content-Transfer-Encoding: binary');
  header('Accept-Ranges: bytes');
  @readfile($file1);
  ?>

it is work on local but i want to read pdf file on server.

Edited 1 Year Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.