我正在尝试创建一个可以将样式化HTML文件转换为PDF的Web API.
我正在使用TuesPechkin并将我的应用程序安装到IIS中(作为32位应用程序:我已将应用程序池修改为以32位模式运行).
IIS 8.5正在Windows Server 2012 R2上运行.
C#中的PDFConversion类:
using System.Drawing.Printing;
using System.IO;
using TuesPechkin;
namespace PDFApi
{
public class PDFcreator
{
public void convert(string path, string uri)
{
IConverter converter = new StandardConverter(
new RemotingToolset<PdfToolset>(
new Win64EmbeddedDeployment(
new TempFolderDelpoyment())));
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
ProduceOutline = true,
DocumentTitle = "Converted Form",
PaperSize = PaperKind.A4,
Margins =
{
All = 1.375,
Unit = Unit.Centimeters
}
},
Objects =
{
new ObjectSettings { RawData = File.ReadAllBytes(uri) } …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Jint (v2.10.4.0) 将一个任意 JSON 结构转换为另一种结构。但是,我在使用map时遇到问题。
根据 ECMA 5.1 语言规范,map应该存在于 Array.prototye 上。但是,当我尝试使用它时,出现错误:Jint.Runtime.JavaScriptException: 'Object has no method 'map''
我正在测试这个
Engine engine = new Engine();
var doubles = engine.SetValue("x", "[ 1, 2, 3, 4, 5 ]")
.Execute("x.map(function(a){ return a + a; })")
.GetCompletionValue()
.ToObject();
Console.WriteLine(doubles);
Console.ReadKey();
Run Code Online (Sandbox Code Playgroud)
理想情况下,我还想使用 find,尽管这是 ECMA6。我在使用 Array.Prototype.map 时缺少什么吗?或者有没有办法为 Jint 引入 polyfill?