[英]How to save latex formula image to a folder in Asp.net
我正在使用乳膠在項目中使用公式。 這是我的代碼
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" />
現在,我要創建公式后單擊“提交”按鈕時,應將公式保存到項目中的某個文件夾中,並使用諸如Formula.png之類的名稱
請使用javascript或c#幫助我
我找到了快速解決方案。 它使用URL並獲取參數並生成圖像。
例如,如果要保存“ A + B = C”,則可以按照以下步驟以編程方式生成圖像。
var k = encodeURI("a + b = c");
。 k的值將等於a%20+%20b%20=%20c
。 url = "http://latex.codecogs.com/gif.latex?" + k
使用該k
url = "http://latex.codecogs.com/gif.latex?" + k
。 因此等於http://latex.codecogs.com/gif.latex?a%20+%20b%20=%20c
。 您可以使用以下代碼將該遠程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.