pdfparser
pdfparser copied to clipboard
How to use PDFParser inside a Symfony Controller Action?
I use this to make my routes:
/**
* @Route("/", name="accueil_index", methods={"GET"})
*/
but I don't understand how to use pdf parser
Do you wanna read a PDF file and output its content on a HTML page?
I assume you use Symfony framework together with PDFParser installed using Composer? Then you can just use:
$pdfparser = new PDFParser();
$document = $pdfparser->parseFile($fileToParse);
$pages = $document->getPages();
foreach ($pages as $page) {
$content = $page->getText();
// ...
}
Example taken from: https://github.com/smalot/pdfparser/blob/master/tests/Integration/ParserTest.php#L51-L80
Yes I use in a page [name] .html.twig
I also wanted to know how to put the link to choose the pdf in our file as with the demonstration on the pdfParser site.
I use this way to link to my page :
and my pages look like this :
