You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My environment is php5.3. I have encountered many problems when converting PDFS to images.
The first problem is that the text in the transferred pictures is not clear and cannot be seen at all
The second issue is that although the total number of pages of a pdf file can be obtained, the output is always the first image
The code is as follows:
$pdf = new \Spatie\PdfToImage\Pdf($pdfPath);
This discussion was converted from issue #262 on April 27, 2026 15:56.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
My environment is php5.3. I have encountered many problems when converting PDFS to images.
The first problem is that the text in the transferred pictures is not clear and cannot be seen at all
The second issue is that although the total number of pages of a pdf file can be obtained, the output is always the first image
The code is as follows:
$pdf = new \Spatie\PdfToImage\Pdf($pdfPath);
// 获取总页数
$numberOfPages = $pdf->getNumberOfPages();
echo "PDF 总页数:" . $numberOfPages . "
";
// 逐页转换
for ($i = 1; $i <= $numberOfPages; $i++) {
$outputPath = $outputDir . 'page_' . $i . '.png';
// 选择当前页
$pdf->setPage($i)
->setOutputFormat('png')
->setCompressionQuality(90)
->setResolution(300)
->saveImage($outputPath);
}
All reactions