use Ismaelw\LaraTeX\LaraTeX;
...
return (new LaraTeX)->dryRun();
Download Dry Run PDF
use Ismaelw\LaraTeX\LaraTeX;
...
return (new LaraTeX('latex.tex'))->with([
'Name' => 'John Doe',
'Dob' => '01/01/1990',
'SpecialCharacters' => '$ (a < b) $',
'languages' => [
'English',
'Spanish',
'Italian'
]
])->download('test.pdf');
...
\begin{center}
\item[Name :] {{ $Name }}
\item[Date of Birth :] {{ $Dob }}
\end{center}
...
\begin{tabular}{|c|l|}
\hline
\rowcolor[HTML]{E3E3E3}
\textbf{ID} & \textbf{Language} \\
\hline\renewcommand{\arraystretch}{1.5}
@foreach($languages as $key => $language)
{{ $key }} & {{ $language }} \\ \hline
@endforeach
\end{tabular}
...
\begin{center}
{!! $SpecialCharacters !!}
\end{center}
...
Download PDF with submitted data
use Ismaelw\LaraTeX\LaraTeX;
...
return (new LaraTeX('latex.tex2'))->with([
'Name' => 'John Doe',
'Dob' => '01/01/1990',
'SpecialCharacters' => '$ (a < b) $',
'languages' => [
'English',
'Spanish',
'Italian'
]
])->download('test.pdf');
...
\begin{center}
\item[Name :] @latex($Name)
\item[Date of Birth :] @latex($Dob)
\end{center}
...
\begin{tabular}{|c|l|}
\hline
\rowcolor[HTML]{E3E3E3}
\textbf{ID} & \textbf{Language} \\
\hline\renewcommand{\arraystretch}{1.5}
@foreach($languages as $key => $language)
@latex($key) & @latex($language) \\ \hline
@endforeach
\end{tabular}
...
\begin{center}
{!! $SpecialCharacters !!}
\end{center}
...
Download PDF with submitted data
use Ismaelw\LaraTeX\LaraTeX;
...
$HTMLString = '<h1>Heading 1</h1> <p>Text</p> <h2>Heading 2</h2> <p>Text</p> <h3>Heading 3</h3> <p>Text</p> <p>Normal text here with some <strong>strong</strong> and <strong>bold</strong> text.</p> <p>There is also text that could be <u>underlined</u>.</p> <p>Or of course we could have <em>em-wrapped</em> or <em>i-wrapped</em> text</p> <p>A special test could be a <u><em><strong>bold, underlined and italic</strong></em></u> text at the same time!</p> <p>For the mathematicians we also have calculations x<sup>2</sup> and chemical stuff H<sub>2</sub>O</p> <p>We also have lists that needs to be shown. For example an unordered and an ordered list.</p> <p>If there is alot of text we might also want to use a line break <br> to continue on the next line.</p> <ul> <li>UL Item 1 <ul> <li>UL Item 1.1</li> <li>UL Item 1.2</li> </ul> </li> <li>UL Item 2</li> <li>UL Item 3</li> </ul> <ol> <li>UL Item 1</li> <li>UL Item 2</li> <li>UL Item 3</li> </ol> <p>Last but not least. We have images.</p> <img src="/images/testimages/image1.png" /> <img src="/images/testimages/image2.png" >';
$Override = array(
array('tag' => 'img', 'extract' => 'src', 'replace' => '\begin{center}\includegraphics[scale=1]{$1}\end{center}'),
array('tag' => 'body', 'extract' => 'value', 'replace' => '$1 \newline '),
);
$LatexString = (new LaraTeX)->convertHtmlToLatex($HTMLString, $Override);
Convert Demo to LaTeX
If you want to try the converter with your own HTML code you can paste it in the textarea below and click on "Convert to LaTeX".
Convert to LaTeX