by Guest » 25 Jan 2025, 15:34
Ich möchte mit Symfony und Gotenberg ein PDF wie folgt erstellen:
Code: Select all
$doc = $gotenbergPdf
->html()
->content('rechnungen/pdf/rechnung.pdf.html.twig', [])
->paperStandardSize(PaperSize::A4)
->generate()
->stream();
< /code>
Danach möchte ich es per E -Mail -Anhang senden: < /p>
$email = (new Email())
->from('[email protected]')
->to('[email protected]')
->subject('subject')
->text('text')
->addPart(new DataPart(new FileFile(stream_get_contents($dokument)),'Contract.pdf','application/pdf'));
$this->mailer->send($email);
Ergebnis ist:
Code: Select all
stream_get_contents(): Argument #1 ($stream) must be of type resource, Symfony\Component\HttpFoundation\StreamedResponse given
Was muss ich tun, um das im Speicher gespeicherte PDF an die E-Mail anzuhängen?
Ich möchte mit Symfony und Gotenberg ein PDF wie folgt erstellen:
[code]$doc = $gotenbergPdf
->html()
->content('rechnungen/pdf/rechnung.pdf.html.twig', [])
->paperStandardSize(PaperSize::A4)
->generate()
->stream();
< /code>
Danach möchte ich es per E -Mail -Anhang senden: < /p>
$email = (new Email())
->from('
[email protected]')
->to('
[email protected]')
->subject('subject')
->text('text')
->addPart(new DataPart(new FileFile(stream_get_contents($dokument)),'Contract.pdf','application/pdf'));
$this->mailer->send($email);
[/code]
Ergebnis ist:
[code]stream_get_contents(): Argument #1 ($stream) must be of type resource, Symfony\Component\HttpFoundation\StreamedResponse given
[/code]
Was muss ich tun, um das im Speicher gespeicherte PDF an die E-Mail anzuhängen?