Symfony Erstellen Sie Gotenberg PDF im Speicher und senden Sie es per E -Mail aus

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Symfony Erstellen Sie Gotenberg PDF im Speicher und senden Sie es per E -Mail aus

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?

Top