mitty Posted July 4, 2011 Share Posted July 4, 2011 Hello all, I read that some people have used FPDI and FPDF to generate .pdf documents written in LaTeX. I would like to do something similar... But I'm having a problem getting started. I'm used to just clicking the 'compile' button and bam, there's my sweet LaTeX pdf... How can I accomplish the same results with PHP? Ultimately, my goal is to be able to import any LaTeX package I need, the PHP script to generate the charts and graphs in LaTeX code, then the PHP script to compile the LaTeX and display it on the user's screen in PDF format. Thanks for the help.. -Mitt Quote Link to comment https://forums.phpfreaks.com/topic/241058-latex-compilation-through-php/ Share on other sites More sharing options...
mitty Posted July 5, 2011 Author Share Posted July 5, 2011 I'm still searching for a solution to this one. I searched more in-depth for solutions using FPDI and FPDF, but this doesn't look like the route I want to go because I see nothing that says I can use LaTeX. Thanks for any help. -Mitt Quote Link to comment https://forums.phpfreaks.com/topic/241058-latex-compilation-through-php/#findComment-1238720 Share on other sites More sharing options...
btherl Posted July 5, 2011 Share Posted July 5, 2011 I'm pretty sure you'll need to call latex from php, using exec or similar. The exact implementation depends a lot on the situation you need this conversion for. Is it running on a server or a desktop, and is the system running windows or linux? I don't think FPDF is going to help, as it does not appear to have any integration with latex. Quote Link to comment https://forums.phpfreaks.com/topic/241058-latex-compilation-through-php/#findComment-1238723 Share on other sites More sharing options...
mitty Posted July 5, 2011 Author Share Posted July 5, 2011 Thanks! I'm fairly new to web development.. I didn't know PHP had a function like this. I can use exec to generate the PDF (server-side). Then the only problem that I'll have is displaying the PDF on the user's computer. I might just be able to point them to the newly created file on the server, which will pull up the browser's download box.. Then they just open the PDF from there. Although I might want the PDF to be displayed in the browser's window... Hmm, I'm just thinking out loud now. I should be able to figure this part out. Appreciate the help! -Mitt Quote Link to comment https://forums.phpfreaks.com/topic/241058-latex-compilation-through-php/#findComment-1238731 Share on other sites More sharing options...
btherl Posted July 5, 2011 Share Posted July 5, 2011 You're welcome! Either of those file delivery methods can work, each requires a slightly different approach. If you point them to the created file then you need Apache to set the mime type. The big limitation here is access control is trickier if you do your authentication in PHP. If you serve the file from PHP then you need to set the mime type and headers from PHP, but you can also do access control in PHP, which can be simpler. I can provide you some code for this if you're interested, as we typically use this method. Quote Link to comment https://forums.phpfreaks.com/topic/241058-latex-compilation-through-php/#findComment-1238737 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.