entityProcessor = $entityProcessor; } /** * @param Collection<\Espo\ORM\Entity> $collection */ public function print(Template $template, Collection $collection, Params $params, IdDataMap $dataMap): Contents { $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); } }