0
votes

Is it possible to convert a tex/latex file into pdf in a C# Windows Form Application with an embedded translator?

I would like to be able to create pdf file from (la)tex file even when pdflatex is not installed on the computer.

Currently, I use MigraDoc for creating pdf files, but I consider latex more powerful.

2
(La)Tex works in way like a compiler. Can you compile c# code on a computer where the C# compiler is not installed? (well, actually yes since you can use the compiler suite - but you get the idea) You'll need at least some external app that is capable of rendering latex code into pdf, it doesn't necessarily have to be pdflatex. Reinventing the wheel and writing all that yourself will probably be way to much.Fildor

2 Answers

1
votes

You can use Pandoc as an external program in your windows app. Please ref to http://pandoc.org/index.html. This is a tool for converting text file, like Markdown to Http.

0
votes

You can do this by using Aspose.Pdf nuget package. Here is the code to do so:

string dataDir = @"PATH TO LATEX FILE";
LatexLoadOptions Latexoptions = new LatexLoadOptions();
Document doc = new Document(dataDir + "sample.tex", Latexoptions);
doc.Save(dataDir + "TeXToPDF_out.pdf");