You are here

public function PdftkPdfBackend::parseStream in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/Plugin/PdfBackend/PdftkPdfBackend.php \Drupal\fillpdf\Plugin\PdfBackend\PdftkPdfBackend::parseStream()

Parse a PDF and return a list of its fields.

@todo Replace output array by a value object.

Parameters

string $pdf_content: The PDF template whose fields are to be parsed. This should be the contents of a PDF loaded with something like file_get_contents() or equivalent.

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::parseStream

See also

\Drupal\fillpdf\Plugin\PdfBackendInterface::parseFile()

File

src/Plugin/PdfBackend/PdftkPdfBackend.php, line 112

Class

PdftkPdfBackend
Pdftk PdfBackend plugin.

Namespace

Drupal\fillpdf\Plugin\PdfBackend

Code

public function parseStream($pdf_content) {
  $template_file = file_save_data($pdf_content);
  return $this
    ->parseFile($template_file);
}