John Davidson

php - PDF Laravel snappy : Text is broken


so, this issues has occurred when I downloaded my multiple PDF files. There are some broken text :

in this case, I'm using merge command :

$mergeCommand = "gs -q -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dNumRenderingThreads=1 -dNOGC - 
dBandBufferSpace=500000000 -dBufferSpace=1000000000 -sOutputFile={$storagePath}/{$uuidSession}.pdf

$process = Process::fromShellCommandline($mergeCommand);

but when I tried to download a single file the text is not broken, has anyone ever experienced it like me? thank you in advance.

My Answer:
$snappy->getCommand('merge', [$pdfFiles])->setOutput($outputFile);

This issue may occur due to the font embedding or encoding issues in the PDF files. You can try to specify the font options in the snappy configuration to ensure proper font embedding. Additionally, make sure that the text in the original PDF files is not too close to the edges of the page, as this can also cause text to break when merging multiple PDF files.

If the issue persists, you may need to further investigate the source PDF files and the snappy configuration to identify the root cause of the broken text issue.

Rate this post

3 of 5 based on 6609 votes


© 2024 - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us