简体   繁体   English

如何将乳胶配方图像保存到Asp.net中的文件夹

[英]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”,则可以按照以下步骤以编程方式生成图像。

  1. Encode that string, like this - var k = encodeURI("a + b = c"); 像这样编码该字符串var k = encodeURI("a + b = c"); . value of k will be equal to a%20+%20b%20=%20c . k的值将等于a%20+%20b%20=%20c
  2. Use that 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
  3. 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.

相关问题 如何使用javascript将图像保存在文件夹中? ASP.NET - How can I save images in a folder with javascript? ASP.NET ASP.Net MVC 5图像上传到文件夹 - ASP.Net MVC 5 image upload to folder 在ASP.NET Core中将画布另存为图像 - Save canvas as image in ASP.NET Core 将画布作为图像保存到ASP.net中的服务器 - Save a canvas as an image to the server in ASP.net 如何使数据保存 ASP.Net - How to make Data save ASP.Net 使用JavaScript与Asp.Net从其文件夹中删除图像 - Remove Image from its folder using javascript with Asp.Net 如何在javascript的帮助下将路径存储在数据库中并将图像存储在asp.net中的文件夹中 - how to store path in database and image in folder in asp.net with the help of javascript 如何在客户端(javascript)或服务器端的asp.net上将html页面的一部分保存到图像或pdf? - How to save part of an html page to an image or pdf either on client (javascript) or asp.net on the server side? 如何访问剪贴板图像并将其保存在asp.net Web应用程序的服务器位置? - How to access clipboard image and save it at server location in asp.net web application? 从Div创建图像并使用Javascript和ASP.net将其保存到服务器 - Create image from Div and save it to server with Javascript and ASP.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM