src/Sulu/Bundle/Sales/OrderBundle/Controller/PdfController.php
public function orderConfirmationAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);

        $this->get('translator')->setLocale($locale);

        try {
            $orderApiEntity = $this->getOrderManager()->findByIdAndLocale($id, $locale);
            $order = $orderApiEntity->getEntity();
        } catch (OrderNotFoundException $exc) {
            throw new OrderNotFoundException($id);
        }

        $pdf = $this->getPdfManager()->createOrderConfirmation($orderApiEntity);

        $pdfName = $this->getPdfManager()->getPdfName($order);

        return new Response(
            $pdf,
            200,
            array(
                'Content-Type' => 'application/pdf',
                'Content-Disposition' => 'attachment; filename="' . $pdfName . '"'
            )
        );
    }
public function orderConfirmationAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);

        $this->get('translator')->setLocale($locale);

        try {
            $orderApiEntity = $this->getOrderManager()->findByIdAndLocale($id, $locale);
            $order = $orderApiEntity->getEntity();
        } catch (OrderNotFoundException $exc) {
            throw new OrderNotFoundException($id);
        }

        $pdf = $this->getPdfManager()->createOrderConfirmation($orderApiEntity);

        $pdfName = $this->getPdfManager()->getPdfName($order);

        return new Response(
            $pdf,
            200,
            array(
                'Content-Type' => 'application/pdf',
                'Content-Disposition' => 'attachment; filename="' . $pdfName . '"'
            )
        );
    }
public function orderConfirmationAction ( Request $ request , $ id ) { $ locale = $ this -> getLocale ( $ request ) ; $ this -> get ( 'translator' ) -> setLocale ( $ locale ) ; try { $ orderApiEntity = $ this -> getOrderManager ( ) -> findByIdAndLocale ( $ id , $ locale ) ; $ order = $ orderApiEntity -> getEntity ( ) ; } catch ( OrderNotFoundException $ exc ) { throw new OrderNotFoundException ( $ id ) ; } $ pdf = $ this -> getPdfManager ( ) -> createOrderConfirmation ( $ orderApiEntity ) ; $ pdfName = $ this -> getPdfManager ( ) -> getPdfName ( $ order ) ; return new Response ( $ pdf , 200 , array ( 'Content-Type' => 'application/pdf' , 'Content-Disposition' => 'attachment; filename="' . $ pdfName . '"' ) ) ; }
Finds a order object by a given id from the url
and returns a rendered pdf in a download window

@param Request $request
@param $id

@throws OrderNotFoundException

@return Response
Finds a order object by a given id from the url and returns a rendered pdf in a download window