[英]How to save latex formula image to a folder in Asp.net
I am using latex for using formula in my project. 我正在使用乳胶在项目中使用公式。 Here is my code
这是我的代码
EqEditor.embed('editor', ''); var a = new EqTextArea('equation', 'testbox'); EqEditor.add(a, false);
<link rel="stylesheet" type="text/css" href="http://latex.codecogs.com/css/equation-embed.css" />
<script type="text/javascript" src="http://latex.codecogs.com/js/eq_config.js"></script> <div id="editor"></div> <br /> <br /> <textarea id="testbox" rows="3" cols="40"></textarea> <br /> <br /> <img id="equation" />
Now I want, after making formula When I click submit button, the formula should be save to a folder in my project with some name such as formula.png 现在,我要创建公式后单击“提交”按钮时,应将公式保存到项目中的某个文件夹中,并使用诸如Formula.png之类的名称
Please help me, either using javascript or c# 请使用javascript或c#帮助我
I found a quick solution. 我找到了快速解决方案。 It uses an URL and takes param and produces image.
它使用URL并获取参数并生成图像。
Eg If I want to save "A + B = C", then you can follow these steps to produce image programatically. 例如,如果要保存“ A + B = C”,则可以按照以下步骤以编程方式生成图像。
var k = encodeURI("a + b = c");
var k = encodeURI("a + b = c");
. a%20+%20b%20=%20c
. a%20+%20b%20=%20c
。 k
in url = "http://latex.codecogs.com/gif.latex?" + k
url = "http://latex.codecogs.com/gif.latex?" + k
使用该k
url = "http://latex.codecogs.com/gif.latex?" + k
. url = "http://latex.codecogs.com/gif.latex?" + k
。 So that will equal to http://latex.codecogs.com/gif.latex?a%20+%20b%20=%20c
. http://latex.codecogs.com/gif.latex?a%20+%20b%20=%20c
。 You can save that remote URL image to server using following code - 您可以使用以下代码将该远程URL图像保存到服务器-
using( System.Net.WebClient wc = new System.Net.WebClient()) { wc.DownloadFile("http://latex.codecogs.com/gif.latex?a%20+%20b%20=%20c", @"D:\\a.gif"); // replace a.gif with actual file path, that will saved in server. }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.