You are here

public function PdfBackendInterface::mergeStream in FillPDF 8.4

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

Populate a PDF file with field data.

Parameters

string $pdf_content: The PDF template the field values specified in the mapping should be merged into.

\Drupal\fillpdf\FieldMapping[] $field_mappings: An array of FieldMapping objects mapping PDF field keys to the values they should be replaced with. Example:

[
  '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 FillPdfLinkManipulator::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\Plugin\PdfBackendInterface::mergeFile()

4 methods override PdfBackendInterface::mergeStream()
FillPdfServicePdfBackend::mergeStream in src/Plugin/PdfBackend/FillPdfServicePdfBackend.php
Populate a PDF file with field data.
LegacyProviderPdfBackend::mergeStream in modules/fillpdf_legacy/src/Plugin/PdfBackend/LegacyProviderPdfBackend.php
Populate a PDF file with field data.
LocalServerPdfBackend::mergeStream in src/Plugin/PdfBackend/LocalServerPdfBackend.php
Populate a PDF file with field data.
PdftkPdfBackend::mergeStream in src/Plugin/PdfBackend/PdftkPdfBackend.php
Populate a PDF file with field data.

File

src/Plugin/PdfBackendInterface.php, line 100

Class

PdfBackendInterface
Defines an interface for FillPDF PdfBackend plugins.

Namespace

Drupal\fillpdf\Plugin

Code

public function mergeStream($pdf_content, array $field_mappings, array $context);