$document->
setContent($this->pdfRenderer->
render($document));
return $document;
} /**
* @param DocumentGenerateOperation[] $operations
*/
public function generate(string
$documentType, array
$operations, Context
$context): DocumentGenerationResult
{ $documentTypeId =
$this->
getDocumentTypeByName($documentType);
if ($documentTypeId === null
) { throw new InvalidDocumentRendererException($documentType);
} $rendered =
$this->rendererRegistry->
render($documentType,
$operations,
$context,
new DocumentRendererConfig());
$result =
new DocumentGenerationResult();
foreach ($rendered->
getErrors() as $orderId =>
$error) { $result->
addError($orderId,
$error);
}