【问题标题】:Remove PHPWord header image transparency删除 PHPWord 标题图像透明度
【发布时间】:2017-02-01 06:10:31
【问题描述】:

如何使用 PHPWord 库删除透明表单标题图像? 我的代码是

    $phpWord = new PhpWord();

    $phpWord->setDefaultFontName('Calibri');
    $phpWord->setDefaultFontSize(10);

    $sectionStyle = [];

    $section = $phpWord->addSection($sectionStyle);

    $header = $section->addHeader();

    $header->addImage(
        resource_path('assets/images/finlab.png'), [
            'width' => 100,
            'marginTop' => 100,
            'posHorizontal' => 'right',
            'positioning' => 'absolute',
            'align' => 'right'
        ]
    );

现在标题中的图像半透明。

【问题讨论】:

    标签: phpword


    【解决方案1】:

    当您使用 resource_path 时,您将获得图像 URL,但要消除透明度,您需要使用实际图像路径而不是图像 URL。

    $image=getcwd().'/assets/images/finlab.png'; //or whatever your image path is.
    $header->addImage(
            $image, [
                'width' => 100,
                'marginTop' => 100,
                'posHorizontal' => 'right',
                'positioning' => 'absolute',
                'align' => 'right'
            ]
        );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-14
      • 2010-10-11
      • 2011-01-28
      • 2013-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多