entityProcessor = $entityProcessor; } public function print(Template $template, Collection $collection, Params $params, IdDataMap $dataMap): Contents { /** @var iterable<\Espo\ORM\Entity> $collection */ $pdf = new Tcpdf(); $pdf->setUseGroupNumbers(true); foreach ($collection as $entity) { $pdf->startPageGroup(); $data = $dataMap->get($entity->getId()) ?? Data::create(); $this->entityProcessor->process($pdf, $template, $entity, $params, $data); } return new TcpdfContents($pdf); } }