Hi, I am currently struggling with returning a docx as a stream in a symfony app.
Here is what i got
#[Route('/', name: 'app_app')] public function index(): StreamedResponse { $doc = new CreateDocx(); CreateDocx::$streamMode = true; CreateDocx::$returnDocxStructure = true; $doc->addText('This is a test'); $doc->embedHTML('<p style="font-size: 30px;">New paragraph</p>'); return new StreamedResponse(function () use ($doc) { $stream = fopen('php://output', 'wb'); stream_copy_to_stream($doc, $stream); }); }
Of course this cannot work since the $doc in my stream_copy_to_stream is not a resource. How can i transform it as a resource.