angeloskath / Pdf-to-text-via-PHP

Collection of classes that parse pdf files with the main purpose of converting a pdf to plain text
21 stars 11 forks source link

Strict standards: Only variables should be passed by reference #2

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello I am using wamp and I want to covert pdf to text now I get this error: Strict standards: Only variables should be passed by reference in C:\wamp\www\Pdf-to-text-via-PHP-master\pdfobject.php on line 54

How can I fix this issue?

alikianinejad commented 7 years ago

I have same problem

askertv commented 3 years ago

My changes for fix


commit 59e281f381a3489aa1f01e9f72c5f2d66a2338e9 (HEAD -> fix-passed-by-reference)
Author: AskerTV <askertv@gmail.com>
Date:   Tue Apr 6 21:12:12 2021 +0300

    Fix error: "PHP Notice:  Only variables should be passed by reference in pdfobject.php on line 54"

diff --git a/pdfobject.php b/pdfobject.php
index 2ef741c..56ae7ec 100644
--- a/pdfobject.php
+++ b/pdfobject.php
@@ -51,7 +51,8 @@ class PdfObject
                        $x++;
                }

-               $this->value = PdfValueParser::ParseValue(substr($this->raw_data,0,strrpos($this->raw_data,"\nendobj")),$x,$this->pdf,$this);
+        $str = substr($this->raw_data,0,strrpos($this->raw_data,"\nendobj"));
+        $this->value = PdfValueParser::ParseValue($str, $x, $this->pdf, $this);
                $this->type = PdfValueParser::getType($this->value);
        }
        public function getID() {
askertv commented 3 years ago

$ php pdf2text.php example1.pdf

This is a very simple PDF page.
No matter the font,
s
t
y
l
e,
 or language, (γλώσσα,
Mädchen,
spéciaux
, …
)
it can be converted to utf-8 text using only
PHP

изображение