コード例 #1
0
 public function exportAction()
 {
     $this->controllerContext->getResponse()->setHeader('Content-Type', 'application/pdf');
     $htmlFromFluid = $this->view->render();
     $pdf = new \TYPO3\TcPdf\Pdf('A4', 'mm', 'portrait', TRUE, 'UTF-8', TRUE);
     //$pdf->SetFont('Helvetica', 'normal',  '12');
     $pdf->AddPage();
     $pdf->writeHTML($htmlFromFluid, true, false, false, false, '');
     return $pdf->Output('', 'S');
 }
コード例 #2
0
ファイル: HtmlPdfView.php プロジェクト: ngocanh1233/TcPdf
 /**
  * Renders a Fluid template and tried to put it into a pdf
  *
  * @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object
  * @return string PDF Raw Data
  * @api
  */
 public function render($actionName = NULL)
 {
     $this->controllerContext->getResponse()->setHeader('Content-Type', 'application/pdf');
     $htmlFromFluid = parent::render($actionName);
     $pdf = new \TYPO3\TcPdf\Pdf($this->settings['pageFormat'], $this->settings['sizeUnit'], $this->settings['pageOrientation'], TRUE, 'UTF-8', TRUE);
     $pdf->SetFont($this->settings['font']['family'], $this->settings['font']['style'], $this->settings['font']['size']);
     $pdf->AddPage();
     $pdf->writeHTML($htmlFromFluid, true, false, false, false, '');
     return $pdf->Output('', 'S');
 }