PHP - 将图像文件添加到dompdf文件 - 检索文件时的空白图像

I am trying to append an image (base64) to a PDF file, save the PDF file and return it for another application to download. I am using this package for DOMPDF.

I can successfully add the image to the PDF file:

public function convertImageToPDF(Request $request)
    {
        //We receive the image content/URL from MS Flow.
        $imageContent = $request->ContentBytes;
        $imageName = $request->Name;

        $html = '<img src="data:image/jpg;base64, ' . $imageContent . '" alt="" />';

        //Generate filename
        $filename = "test";
        //create pdf document
        $pdf = PDF::loadHTML($html)->save(storage_path('app/public/doccenter/' . $filename . '.pdf'));

    }

OK so above will create a PDF file in app/public/doccenter folder. It will add the file test.pdf.

Now if I open the test.pdf file, the image is added like below:

test.pdf file

So far so good. Now, I need this newly created PDF file in another application, so I want to return the PDF content to my other application.

To do that, I replace the last line $pdf = PDF:: ... with:

return PDF::loadHTML($html)->save(storage_path('app/public/doccenter/' . $filename . '.pdf'))->stream();

Now if I just run this function again, I can see that the content is returned and I am prompted to download the PDF file. But when I open it, it's empty:

enter image description here

What am I doing wrong?