I'm using the basic code from bundle to generate pdf and the browser-output works. (Controller)
public function fileAction($name, Request $request)
{
$format = $this->get('request')->get('_format');
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('TestBundle:Kunden')->find($name);
return $this->render(sprintf('TestBundle:Kunden:file.%s.twig', $format), array(
'name' => $name,
'entity' => $entity,
));
I want to save the file in upload folder, so I tried the code I found in documentation or other posts. (Controller)
public function pdfAction($name)
{
$format = $this->get('request')->get('_format');
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('TestBundle:Kunden')->find($name);
$facade = $this->get('ps_pdf.facade');
$response = new Response();
$this->render(sprintf('TestBundle:Kunden:file.%s.twig', $format), array('entity' => $entity,'name' => $name,), $response);
$xml = $response->getContent();
$content = $facade->render($xml);
return new Response($content, 200, array('content-type' => 'application/pdf'));
}
I know that I missed something, but I don't know where I can define the path or filename. How could I save the generated pdf from fileAction() in upload folder?