2012-01-05 4 views

답변

2

PHP의 출력 버퍼링을 시작한 다음 HTML 코드를 생성하는 것처럼 LaTeX 코드를 생성합니다. 그 다음에 버퍼를 꺼내 LaTeX 생성기에 공급합니다. 예 :

<?php ob_start(); ?> 
\documentclass{article} 
\begin{document} 
\section{Title} 
\subsection{Subtitle} 
Plain text. 
\subsection{Another subtitle} 
More plain text. :-P 
\end{document} 
<?php 
    $latex = ob_get_clean(); 
    $file = tmpnam('/tmp'); 
    file_put_contents($file, $latex); 
    exec('latex --output /path/to/your/result.pdf '.escapeshellarg($file)); 
    unlink($file); 
?> 

위의 코드에는 의사 코드 상태가 있습니다. 방금 추억을 남기고 교육받은 추측을 썼습니다. 아무것도 테스트하지 않았습니다. 그러나 원리는 효과가있다.

관련 문제