【问题标题】:Rotating an Image Using PHP and PDFLib使用 PHP 和 PDFLib 旋转图像
【发布时间】:2012-06-19 09:05:15
【问题描述】:

我正在使用此代码在我使用 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");

知道为什么会这样吗?

【问题讨论】:

    标签: php image-rotation pdflib


    【解决方案1】:

    试试这样。我认为它可能会帮助你,但不确定

    $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 )
    

    【讨论】:

      【解决方案2】:

      您缺少旋转的 = 符号

      应该是rotate=15

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-12-09
        • 2011-01-03
        • 2018-09-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-02-18
        • 1970-01-01
        相关资源
        最近更新 更多