PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.25k stars 2.69k forks source link

Issue with header in PHPWord #2658

Open Devika1698 opened 2 months ago

Devika1698 commented 2 months ago

Describe the bug and add attachments

When adding an image as a header, the image gets blurred in the document page. Screenshot 2024-08-23 172232

Expected behavior

Want the image to be not blurred and should appear as it is in the document page when adding as header also.

Steps to reproduce

  $border_src = file_get_contents(public_path() . '/assets/images/workbook_images/border.png');
 $header = $section->addHeader();
        $header->addImage(
            $border_src,
            [
                'alignment' => 'center',
                'width' => '850',
                'height' => '600',
                'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
                'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
                'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
                'marginTop' => -73,
                'wrappingStyle' => 'infront',
                'marginLeft' => -425,
            ]
        );

PHPWord version(s) where the bug happened

^0.18.3

PHP version(s) where the bug happened

^7.3|^8.0

Priority

Progi1984 commented 2 months ago

@Devika1698 Have you got a sample file where the header is not blurred ? And an other sample file where the header is blurred ? Which writer do you use ?

It's for analysis

Devika1698 commented 2 months ago

@Devika1698 Have you got a sample file where the header is not blurred ? And an other sample file where the header is blurred ? Which writer do you use ?

It's for analysis

The image always gets blurred when adding as a header. Please refer the attachment where I have added an image as a border for the page and it is blurred or image colour gets dull. Is there any way to get the original image as a header without blur? I have used PhpWord to generate a document using Laravel framework.

Progi1984 commented 2 months ago

@Devika1698 I would like a MSWord file where the header is not blurred. Have you got a sample file please ?

Devika1698 commented 2 months ago

@Devika1698 I would like a MSWord file where the header is not blurred. Have you got a sample file please ?

I don't have a sample file, and the header is also blurred in MS Word. However, the requirement is to use the original image as the header. Please provide a solution for this.

Progi1984 commented 2 months ago

@Devika1698 It's an open source that I maintain alone on my personal time. So it will be prioritized after PRs and crowdfunded issues.