public function LegacyProviderPdfBackend::populateWithFieldData in FillPDF 8.4
Populate a FillPDF form with field data.
Formerly known as merging. Accept an array of PDF field keys and field values and populate the PDF using them.
Parameters
\Drupal\fillpdf\FillPdfFormInterface $fillpdf_form: The FillPdfForm referencing the file whose field values are going to be populated.
array $field_mapping: An array of fields mapping PDF field keys to the values with which they should be replaced. Example array:
[
'values' => [
'Field 1' => 'value',
'Checkbox Field' => 'On',
],
'images' => [
'Image Field 1' => [
'data' => base64_encode($file_data),
'filenamehash' => md5($image_path_info['filename']) . '.' . $image_path_info['extension'],
],
],
];
array $context: The request context as returned by FillPdfLinkManipulatorInterface::parseLink().
Return value
string|null The raw file contents of the new PDF, or NULL if populating failed. The caller has to handle saving or serving the file accordingly.
Overrides FillPdfBackendPluginInterface::populateWithFieldData
File
- modules/
fillpdf_legacy/ src/ Plugin/ PdfBackend/ LegacyProviderPdfBackend.php, line 96
Class
- LegacyProviderPdfBackend
- Legacy provider PdfBackend plugin.
Namespace
Drupal\fillpdf_legacy\Plugin\PdfBackendCode
public function populateWithFieldData(FillPdfFormInterface $fillpdf_form, array $field_mapping, array $context) {
return $this->legacyBackend
->populateWithFieldData($fillpdf_form, $field_mapping, $context);
}