Pdf-to-text-via-PHP icon indicating copy to clipboard operation
Pdf-to-text-via-PHP copied to clipboard

Strict standards: Only variables should be passed by reference

Open ghost opened this issue 8 years ago • 3 comments

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?

ghost avatar Oct 17 '15 06:10 ghost

I have same problem

alikianinejad avatar Aug 22 '17 19:08 alikianinejad

My changes for fix


commit 59e281f381a3489aa1f01e9f72c5f2d66a2338e9 (HEAD -> fix-passed-by-reference)
Author: AskerTV <[email protected]>
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 avatar Apr 06 '21 18:04 askertv

$ 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

изображение

askertv avatar Apr 06 '21 18:04 askertv