I have been successfully using the Snappy library to generate PDFs on my Windows machine. However, when attempting to generate the same PDF on a CentOS-based server, I encountered an error. This issue seems to occur specifically when dealing with large datasets, resulting in PDFs exceeding 3000 pages.
Steps Taken:
Installed CentOS 7 specific version of Snappy. Attempted to utilize Snappy via Composer library directly. Error Encountered: `Symfony\Component\Process\Exception\ProcessSignaledException The process has been signaled with signal "11".
do {
$this->checkTimeout();
$running = $this->isRunning() && ('\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen());
$this->readPipes($running, '\' !== \DIRECTORY_SEPARATOR || !$running);
} while ($running);
while ($this->isRunning()) {
$this->checkTimeout();
usleep(1000);
}
if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
throw new ProcessSignaledException($this);
}`
Additional Information:
The error occurs consistently when processing large datasets. The PDF generation process works without issue on a Windows environment. This issue impedes the functionality of the application on the CentOS server. I would appreciate any insights or suggestions on how to resolve this issue and successfully generate PDFs on the CentOS server using the Snappy library.
The code I am using to create the PDF, this works until 800 pages after that it gives the same error but only on centOS server environment.
$body = view('ENG.Reports.Bomrep.BomRepdtlallpdfBody', compact('fdatas', 'unit_detail', 'unit_code', 'unitname', 'pcode', 'userData'))->render();
$snappy = app('snappypdf'); // Use the 'snappypdf' service
$header = view('ENG.Reports.Header')->render();
$pdf = $snappy->loadHTML($body, [], [
'enable-local-file-access' => true,
'orientation' => 'portrait',
'encoding' => 'UTF-8',
'dpi' => 72,
]);
$pdf->setTimeout(100000000);
$pdf->setOption('margin-top', 12);
$pdf->setOption('header-html', $header);
$pdf->setOption('header-spacing', 2);
return $pdf->download('BOMdetail.pdf');
I tried the existing available fixes like moving to wkhtmltopdf centos version, going to vendor binary using composer and also tried to optimize the query and make it faster but nothing worked.
I am trying to find some solution that can help me solve this issue on the centOS .
The issue was my global header and the JS