使用pdflib从PDF创建PNG时指定图像尺寸

时间:2018-03-07 19:51:40

标签: php pdflib

是否可以设置从此脚本创建的PNG的尺寸?

e.g。 setImageWidth ='200',setImageHeight ='500'

这可以用pdflib来实现,还是应该在创建初始图像后使用GD?

使用pdflib在SO或Google上找不到任何答案。

$pdflib = new ImalH\PDFLib\PDFLib();
$pdflib->setPdfPath($pdf_file_path);
$pdflib->setOutputPath($folder_path_for_images);
$pdfLib->setImageFormat(\ImalH\PDFLib\PDFLib::$IMAGE_FORMAT_PNG);   
$pdflib->setDPI(50);
$pdflib->setPageRange(1,$pdflib->getNumberOfPages());
$pdflib->convert(); 

1 个答案:

答案 0 :(得分:0)

他们有一个imagecropauto函数,它看起来就像是最接近的东西:

resource imagecropauto ( resource $image [, int $mode = -1 [, float $threshold = .5 [, int $color = -1 ]]] )