Mar*_*way 10 abcpdf azure-web-sites
Webforms页面代码背后
XSettings.InstallRedistributionLicense("REDACTED");
var theDoc = new Doc();
theDoc.HtmlOptions.Engine = EngineType.Gecko;
theDoc.Rect.Inset(72, 144);
theDoc.Page = theDoc.AddPage();
int theID = theDoc.AddImageUrl("http://www.woot.com/");
while (true)
{
theDoc.FrameRect(); // add a black border
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
Response.Buffer = false;
Response.AddHeader("Content-Disposition", "inline; filename=\"rept.pdf\"");
Response.ContentType = "application/pdf";
theDoc.Save(Response.OutputStream);
Response.Flush();
Run Code Online (Sandbox Code Playgroud)
应该工作得很好..但得到
Failed to add HTML: RPC to Gecko engine process failed.Remote process terminated unexpectedly.
Run Code Online (Sandbox Code Playgroud)
在bin文件夹中运行完全信任
打包/发布此项目文件夹中的所有文件
您不能在Windows Azure网站内运行外部进程,因为这会在共享基础架构中造成风险.
见这个帖子由MSFT员工或该职位,其中关于和本地API其他限制同一名员工会谈.
您可以通过不将HTML图像添加到文档来验证问题是否与外部启动的Gecko相关.对我来说,PDF的创建进一步发展但由于缺少许可证而失败.
看起来您必须找到完全托管/ .NET HTML呈现引擎(如果将网站转换为PDF是您的用例),或希望保留模式网站获得执行本机/外部进程的权限.
| 归档时间: |
|
| 查看次数: |
2077 次 |
| 最近记录: |