简体   繁体   English

在 C# Windows 窗体应用程序中将 LaTeX 文件转换为 Pdf

[英]Convert LaTeX file to Pdf in C# Windows Form Application

Is it possible to convert a tex/latex file into pdf in a C# Windows Form Application with an embedded translator?是否可以在带有嵌入式翻译器的 C# Windows 窗体应用程序中将 tex/latex 文件转换为 pdf?

I would like to be able to create pdf file from (la)tex file even when pdflatex is not installed on the computer.即使计算机上未安装 pdflatex,我也希望能够从 (la)tex 文件创建 pdf 文件。

Currently, I use MigraDoc for creating pdf files, but I consider latex more powerful.目前,我使用 MigraDoc 创建 pdf 文件,但我认为 Latex 更强大。

You can use Pandoc as an external program in your windows app.您可以在 Windows 应用程序中将Pandoc用作外部程序。 Please ref to http://pandoc.org/index.html .请参考http://pandoc.org/index.html This is a tool for converting text file, like Markdown to Http.这是一个转换文本文件的工具,比如 Markdown 到 Http。

You can do this by using Aspose.Pdf nuget package.你可以通过使用Aspose.Pdf nuget 包来做到这一点。 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");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM