使用 PHP 和 PDFLib 旋转图像


Rotating an Image Using PHP and PDFLib

我正在使用此代码在我使用 PDFLib 生成的 PDF 中的框中渲染图像

$p = new pdflib();
if ($p->begin_document("", "") == 0)
  throw new Exception("Error: " . $p->get_errmsg());
$p->begin_page_ext(0, 0, "width=792 height=612");
$image = $p->load_image("auto", "01.jpg", "");
$p->fit_image($image, 100,200,"boxsize={300 500} fitmethod=entire showborder");

这按预期工作。现在需要按照上述指定在框中旋转图像。

我试过这个:

$p->fit_image($image, 100,200,"boxsize={300 500} fitmethod=entire showborder rotate 15"); 

但它没有产生任何结果。

更新:当我在没有显示边框的情况下尝试上述代码时,它可以工作:

$p->fit_image($image, 100,200,"boxsize={300 500} fitmethod=entire rotate 15");

知道为什么会这样吗?

尝试这样。 我认为它可能会对您有所帮助,但不确定

$extra_pram = "boxsize={" . $int_image_w . " " . $int_image_h . "} position={left top} fitmethod=entire rotate=" . $int_image_rotation;
$this->pdflib->fit_image ( $image_obj, $int_image_x, $int_image_y, $extra_pram )

缺少用于旋转的 = 符号

应该旋转=15