Development

HowToPrintWithLatex

You must first sign up to be able to contribute.

Version 2 (modified by skr68, 11 years ago)
--

This Latex PDF View class provides an easy way to generate PDF files from symfony templates.

Installing

Until Ticket #388 is resolved, you have to copy sfPDFView.class.php into sfConfig::get('sf_symfony_lib_dir').'/view/

Example

apps/xxx/modules/pdf/config/module.yml:

all:
  view_class: sfPDF

this template writes out a nicely formatted letter:

<?php use_helper('Latex') ?>
\documentclass[fontsize=11pt]{scrlttr2}
\renewcommand*{\raggedsignature}{\raggedright}

\KOMAoptions{paper=a4,foldmarks=false, parskip=half}
\setkomavar{signature}{<?= $sf_user->getSig() ?>}

\setkomavar{date}[]{<?= format_date($today->getTime()) ?>}
\begin{document}
\sloppy
\sffamily

\begin{letter}
<?= include_partial('adress', array('adress' => $adress1)) ?>
\opening{\textbf{Invoice}}

\closing{Mit freundlichen Grüßen}
\end{letter}

%%\newpage
\end{document}

Improvements (TODO)

  • include in symfony or make a plugin
  • use another suffix (.tex), but this breaks partials

Attachments