发票的默认徽标尺寸为200*50.如果我上传图像216*100.如何在代码中设置大小。那么,我尝试更改

protected function insertLogo(&$page, $store = null)
    {
        $image = Mage::getStoreConfig('sales/identity/logo', $store);
        if ($image) {
            $image = Mage::getBaseDir('media') . '/sales/store/logo/' . $image;
            if (is_file($image)) {
                $image = Zend_Pdf_Image::imageWithPath($image);
                $page->drawImage($image, 25, 820, 125, 900);
            }
        }
        //return $page;
    }

这似乎不起作用。

有帮助吗?

解决方案

您将希望内容框参数为[25,775,133,825]。

使用的单元似乎是像素的两倍,垂直尺寸从页面的底部开始。足以花费数小时尝试对PDF打印出口进行小改动。

另外,您必须将页面的其余部分稍微下降一点,因为新图像要高一点。

整体 insertLogo() 功能看起来像这样:

protected function insertLogo(&$page, $store = null)
{
    $image = Mage::getStoreConfig('sales/identity/logo', $store);
    if ($image) {
        $image = Mage::getBaseDir('media') . '/sales/store/logo/' . $image;
        if (is_file($image)) {
            $image = Zend_Pdf_Image::imageWithPath($image);
            $page->drawImage($image, 25, 775, 133, 825);
            $this->y = 760;
        }
    }
    //return $page;
}

也就是说,您可能需要考虑从Magento 1.7中向后移植该函数,其中所有这些都是根据实际图像的维度自动计算的。

许可以下: CC-BY-SA归因
scroll top