D
D
Dmitry Kuznetsov2021-06-04 14:19:08
PHP
Dmitry Kuznetsov, 2021-06-04 14:19:08

Why do images in a spreadsheet (PhpSpreadsheet) have a dotted background?

I have an image with a transparent background. If you print only it, then the background remains transparent (nothing is filled). And if you throw it into a document (PhpSpreadsheet) and convert it to PDF, then it has a lot of dots in the background with the same interval.

The image is inserted quite simply:

$img = new Drawing();
$img->setPath($imagePath);
$img->setOffsetX(0);
$img->setOffsetY(0);
$img->setCoordinates('A' . $this->row);
$img->setWidth(940);
$img->setWorksheet($sheet);

The image itself on the PDF is visible and it displays correctly (without dots)

After the entire document is generated in PDF:
$this->savePdf($Excel);
if ($this->returnFile) {
    return $this->fileName;
}
$file = Storage::disk('local')->get("temp/$this->fileName.pdf");
$response = Response::make($file, 200);
$response->header("Content-Type", "application/pdf");
return $response;


Tell me how to fix this if you are faced with this. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question