How to use rich text editing with pdflatex

Posted by skr on 2007-09-19 in symfony, latex

This example shows how you can enable the processing of HTML codes in your latex document. Use a rich textbox in your template:

<?php
echo form_tag('pdf/HtmlInput');
echo textarea_tag('text', '', array (
     'size' => '80x10','rich' => true, 'tinymce_options' => 'theme:"simple"'));
echo submit_tag('Generate PDF') ?>
</form>

This is the action (pdf/actions/actions.class.php):

public function executeHtmlInput() {
            $this->text = $this->getRequestParameter('text');
            $this->getResponse()->addHttpMeta('Content-Disposition', 'attachment;
                          filename="HtmlInput.pdf"');
}

And your latex layout (HtmlInputSuccess.php):

<?php use_helper('Latex', 'Date') ?>
\documentclass[fontsize=11pt]{scrlttr2}
\LoadLetterOption{DIN}
\usepackage[latin1]{inputenc}
\usepackage[ftnhyperref]{typehtml}
 
\begin{document}
  \dohtml
    <html><?=$text ?></html>
 \end{document}

You can try it online here: