You are here

public function FillPdfBackendPluginInterface::populateWithFieldData in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/FillPdfBackendPluginInterface.php \Drupal\fillpdf\FillPdfBackendPluginInterface::populateWithFieldData()

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.

6 methods override FillPdfBackendPluginInterface::populateWithFieldData()
FillPdfServicePdfBackend::populateWithFieldData in src/Plugin/PdfBackend/FillPdfServicePdfBackend.php
JavaBridgeFillPdfBackend::populateWithFieldData in modules/fillpdf_legacy/src/Plugin/FillPdfBackend/JavaBridgeFillPdfBackend.php
Populate a FillPDF form with field data.
LegacyProviderPdfBackend::populateWithFieldData in modules/fillpdf_legacy/src/Plugin/PdfBackend/LegacyProviderPdfBackend.php
Populate a FillPDF form with field data.
LocalServerPdfBackend::populateWithFieldData in src/Plugin/PdfBackend/LocalServerPdfBackend.php
PdftkPdfBackend::populateWithFieldData in src/Plugin/PdfBackend/PdftkPdfBackend.php

... See full list

File

src/FillPdfBackendPluginInterface.php, line 65

Class

FillPdfBackendPluginInterface
Defines the required interface for all FillPDF BackendService plugins.

Namespace

Drupal\fillpdf

Code

public function populateWithFieldData(FillPdfFormInterface $fillpdf_form, array $field_mapping, array $context);