7
나는 Symfony 2.1과 함께 Snappy Bundle을 사용하고 있습니다.KnpSnappyBundle을 사용하여 orientation = landscape 설정하는 방법?
- 어떻게 방향을 설정 : 내가이 번들의 문서에서 찾을 수 없습니다 몇 가지 질문이 있습니다 ?
- 페이지 번호를 표시하는 방법이 있습니까?
public function exampleAction() { $html = $this->renderView('MyBundle:Example:test.pdf.twig', $this->param); return new Response($this->get('knp_snappy.pdf')->getOutputFromHtml($html),200, array( 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="Test.pdf"')); }
도와 주셔서 감사합니다 많은 : 여기
knp_snappy: pdf: enabled: true binary: /home/wkhtmltopdf-i386 options: []
이 PDF를 생성하기 위해 내 컨트롤러 중 하나입니다 :
다음은 번들 내 config.yml입니다!
답변 주셔서 감사하지만 오류가로 문제가 해결되지 않습니다 "치명적인 오류 : 정의되지 않은 메서드 KNP \ 번들 \ SnappyBundle \ 뭐 이따위 \ LoggableGenerator에 전화 ::에서 SetOption()"를 – Reveclair
내가 코드를 시도하고 또한 $ default = header '=> true,'Content '=' ''Landscape '=>'Landscape ', 'default-header '=> -Type '=>'application/pdf ', 'Content-Disposition '=>'첨부 파일, filename = "Test.pdf" ')); 그러나 그것은 작동하지 않습니다 : ( – Reveclair
당신은 잘못된 위치에 매개 변수를 넣었습니다, 그것은 다음과 같아야합니다 :'return new Response ($ this-> get ('knp_snappy.pdf') -> getOutputFromHtml ($ html, array 200, array ('Content-Type'=> '응용 프로그램/pdf', 'Content-Disposition'=> '첨부 파일 이름 =>'Landscape '=>'Landscape ','default-header '=> "Test.pdf" ')));' –