php - Parsing multiple PDFs from text input with PDF Parser library -
i'm attempting use pdf parser php library parse text multiple pdfs submitted through form textarea (one pdf url per line).
the code i'm using is:
<?php include 'vendor/autoload.php'; $ids = $_post["textarea"]; foreach(explode("\n", $ids) $line) { $parser = new \smalot\pdfparser\parser(); $pdf = $parser->parsefile($line); $text = $pdf->gettext(); echo $text . '<br />'; ?>
note: 'vendor/autoload.php' composer file.
this works expected when put 1 url textarea, if put more 1 returns nothing. i'm not sure if there's wrong foreach loop or if library not support parsing multiple pdfs in loop... advice appreciated!
Comments
Post a Comment