Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: escapeshellarg(): Input string contains NULL bytes #187

Open
huzjakd opened this issue Feb 21, 2018 · 1 comment
Open

Fatal error: escapeshellarg(): Input string contains NULL bytes #187

huzjakd opened this issue Feb 21, 2018 · 1 comment

Comments

@huzjakd
Copy link

huzjakd commented Feb 21, 2018

This is maybe more of a PHP question than pdfparser one but here it goes anyway:
Important part of my code:

$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile($file_path);
$pages  = $pdf->getPages();
foreach ($pages as $page) {
  $text = $page->getText();
  $stringWithoutNewLine = str_replace("\n"," ",escapeshellarg($text));
  //some more code
}

And this returns the error in the title. Sure enoguh, I think some of the pages in my .pdf have only images, no text.
I would like to get an empty string if there is no text on the page.

@huzjakd
Copy link
Author

huzjakd commented Feb 27, 2018

This can be closed. I found a solution. Removed all NULL characters from the string and serialized the string to json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant