public function FillPdfServicePdfBackend::parseFile in FillPDF 8.4
Same name and namespace in other branches
- 5.0.x src/Plugin/PdfBackend/FillPdfServicePdfBackend.php \Drupal\fillpdf\Plugin\PdfBackend\FillPdfServicePdfBackend::parseFile()
Parse a PDF and return a list of its fields.
@todo Replace output array by a value object.
Parameters
\Drupal\file\FileInterface $template_file: The PDF template whose fields are to be parsed.
Return value
string[][] An array of associative arrays. Each sub-array contains a 'name' key with the name of the field and a 'type' key with the type. These can be iterated over and saved by the caller.
Overrides PdfBackendInterface::parseFile
See also
\Drupal\fillpdf\Plugin\PdfBackendInterface::parseStream()
1 call to FillPdfServicePdfBackend::parseFile()
- FillPdfServicePdfBackend::parse in src/
Plugin/ PdfBackend/ FillPdfServicePdfBackend.php
File
- src/
Plugin/ PdfBackend/ FillPdfServicePdfBackend.php, line 47
Class
- FillPdfServicePdfBackend
- FillPDF Service PdfBackend plugin.
Namespace
Drupal\fillpdf\Plugin\PdfBackendCode
public function parseFile(FileInterface $template_file) {
$pdf_content = file_get_contents($template_file
->getFileUri());
return $this
->parseStream($pdf_content);
}