public function BackendServiceInterface::merge in FillPDF 8.4
Populate a PDF file with field data.
Parameters
string $pdf_content: The PDF into which to merge the field values specified in the mapping.
\Drupal\fillpdf\FieldMapping[] $field_mappings: An array of FieldMapping-derived objects mapping PDF field keys to the values with which they should be replaced. Strings are also acceptable and converted to TextFieldMapping objects. Example array:
[
'Foo' => new TextFieldMapping('bar'),
'Foo2' => new TextFieldMapping('bar2'),
'Image1' => new ImageFieldMapping(base64_encode(file_get_contents($image)), 'jpg'),
];
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 merging failed. The caller has to handle saving or serving the file accordingly.
See also
\Drupal\fillpdf\FieldMapping\TextFieldMapping
\Drupal\fillpdf\FieldMapping\ImageFieldMapping
\Drupal\fillpdf\FillPdfLinkManipulatorInterface::parseLink()
1 method overrides BackendServiceInterface::merge()
- Test::merge in tests/
modules/ fillpdf_test/ src/ Plugin/ BackendService/ Test.php - Populate a PDF file with field data.
File
- modules/
fillpdf_legacy/ src/ Plugin/ BackendServiceInterface.php, line 60
Class
- BackendServiceInterface
- Defines an interface for FillPDF BackendService plugins.
Namespace
Drupal\fillpdf_legacy\PluginCode
public function merge($pdf_content, array $field_mappings, array $context);