KnpSnappyBundle icon indicating copy to clipboard operation
KnpSnappyBundle copied to clipboard

Image randomly displayed in PROD when pdf is generated

Open Snowbaha opened this issue 2 years ago • 3 comments

Hello,

I have a strange issue, when I run the generation of PDF in dev, all images are fines but when I run the generation in production, sometime image si displayed, sometime not... with the same URL path : <img class="img-puce" src="{{ absolute_url(asset('images/logo.png')) }}" alt="MyLogo" width="100px" height="78px">

in the HTML genereted, the images are always ok but the issue looks to be after the PDF conversion... image --> image

Do you have any idea how to debug this?

Smyfony 5.4 // bundle 1.9 (all is up to date)

My functions:


public function renderHtml(Subscription $subscription, string $locale = 'fr')
    {
        return $this->twig->render('subscription/pdf.html.twig', [
            'subscription' => $subscription,
            'locale' => $locale,
        ]);
    }

public function createPdf(Subscription $subscription, string $locale = 'fr')
    {
        $html = $this->renderHtml($subscription, $locale);

        $options_pdf = [
            'encoding' => 'utf-8',
        ];

        try {
            $file_pdf = $this->pdf->getOutputFromHtml($html, $options_pdf);
        } catch (\Exception $exception) {
            $this->logger->error($exception->getMessage());
            throw new HttpException(400, 'Error with the generation of pdf, check log API to more information.');
        }

        return $file_pdf;
    }

Snowbaha avatar Jan 27 '22 14:01 Snowbaha

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 06:04 stale[bot]

Hello, no idea for this issue?

Snowbaha avatar Apr 17 '22 19:04 Snowbaha

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 03:07 stale[bot]