Closed barnabaskecskes closed 8 years ago
Hi,
I know its a year afterwards but im having issues with this, please se below:
// initiate
include 'vendor/autoload.php';
$pdf = new \TonchikTm\PdfToHtml\Pdf(BASE_PATH . 'uploads/pdf/test.pdf', [
'pdftohtml_path' => '/usr/bin/pdftohtml',
'pdfinfo_path' => '/usr/bin/pdfinfo'
]);
// get pdf info
$pdfInfo = $pdf->getInfo();
// get count pages
$countPages = $pdf->countPages();
// get content from one page
$contentFirstPage = $pdf->getHtml()->getPage(1);
// get content from all pages and loop for they
foreach ($pdf->getHtml()->getAllPages() as $page) {
echo $page . '<br/>';
}
And this is the output i am getting:
Notice: Undefined index: pages in /Users/Tin/Documents/Work/flipswitch-framework/vendor/tonchik-tm/pdf-to-html/src/Pdf.php on line 81
Strict Standards: Only variables should be passed by reference in /Users/Tin/Documents/Work/flipswitch-framework/vendor/tonchik-tm/pdf-to-html/src/Pdf.php on line 178
Notice: Undefined index: pages in /Users/Tin/Documents/Work/flipswitch-framework/vendor/tonchik-tm/pdf-to-html/src/Pdf.php on line 81
Strict Standards: Only variables should be passed by reference in /Users/Tin/Documents/Work/flipswitch-framework/vendor/tonchik-tm/pdf-to-html/src/Pdf.php on line 178
Notice: Undefined index: pages in /Users/Tin/Documents/Work/flipswitch-framework/vendor/tonchik-tm/pdf-to-html/src/Pdf.php on line 81
This is really really urgent as I need to get this done by today, please advise asap 👍
Ok, I had this issue and after a bit of research I have found the answer: Under strict conditions the first variable in the array_walk function is not actually a variable. so to fix change the following line(s) of code in the Pdf class: "array_walk($this->getOptions('generate'), function ($value, $key) use (&$generated) {"
to
"$getOptions = $this->getOptions('generate'); array_walk($getOptions, function ($value, $key) use (&$generated) {"
Done
I am still getting this issue and no html is generated:
Undefined index: pages in F:\wamp\www\pdf2htmltonchik\vendor\tonchik-tm\pdf-to-html\src\Pdf.php on line 81
I'm having an issue when calling the
getHtml()
method. See image below - help would be appreciated. :)