- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经创建了一个用于 pdf 生成的 C# Azure 函数,并且正在使用 NReco pdf 生成器,但它无法在 Aazure 上运行。
您能否建议一种让它在 azure 中运行的方法?
我已通过 NuGet Package Manager Console 安装了 NReco Pdf 生成器,但收到以下错误:
"Access to the path 'D:\Program Files (x86)\SiteExtensions\Functions\1.0.12599\wkhtmltopdf' is denied.
这是抛出异常的堆栈跟踪:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at System.IO.Directory.CreateDirectory(String path)
at NReco.PdfGenerator.HtmlToPdfConverter.EnsureWkHtmlLibs()
at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(WkHtmlInput[] htmlFiles, String inputContent, String coverHtml, String outputPdfFilePath, Stream outputStream)
at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfFromFile(String htmlFilePath, String coverHtml)
at VRProductions.Repository.PdfGenerationRepository.<SendMail>d__1.MoveNext()
这是用于生成 pdf 的代码:
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
var pdfBytes = htmlToPdf.GeneratePdfFromFile(blockBlob.Uri.AbsoluteUri, "");
最佳答案
我能够使用以下函数代码生成 pdf..看看这是否有任何帮助..Azure 函数 V1
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp41
{
public static class Function1
{
[FunctionName("Function1")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
var pdfBytes = htmlToPdf.GeneratePdfFromFile("<file_path_including_sas_token>", "");
var response = req.CreateResponse(HttpStatusCode.OK);
response.Content = new StreamContent(new MemoryStream(pdfBytes));
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
return response;
}
}
}
如果您从 Visual Studio 本地运行此函数..将生成文件,并将 pdf 加载到浏览器中或要求保存。
http://localhost:7071/api/Function1
关于c# - Azure 是否支持 NReco pdf 生成器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55789672/
如何将视频转换为一系列位图?我需要一帧一帧并在内存中处理它们(无磁盘输出)。 我选择了NReco.VideoConverter但不确定哪种方法可以做到这一点。我了解 FFMpegConverter.G
尝试将原始图像写入 ConvertLiveMedia 时出现异常: System.IO.IOException: "Канал был закрыт. System.IO.IOException: "
我已使用以下代码将图像转换为视频 NReco.VideoConverter.ConvertSettings setting = new NReco.VideoConverter.ConvertSett
我正在使用 Nreco PdfGenerator 从 HTML 生成 pdf。一切都很好,但字符彼此靠得很近,不容易阅读。 有什么办法可以解决这个问题吗? HTML 版本 PDF版本 这是我的CSS
我已经使用这个工具大约一个星期了,现在,今天,它刚刚停止工作。我已将其余代码恢复到以前的状态,但我不断收到相同的错误。 我从抛出的异常中得到的是: An exception of type 'Syst
我正在使用 NReco.PdfGenerator 库从 html 生成 pdf。它适用于英语。我还需要包括 non-english language(marathi) ,在那种情况下不能像预期的那样工
如何在使用 nreco.videoconverter 转换后获取结果文件名我的要求是将文件路径保存到数据库 var converter = ne
我正在尝试将 HTML 代码转换为 JPEG 图像。它有点管用,但当我尝试使用条形码时却不行。 服务器端,我正在使用: 我正在使用 CODE128 协议(protocol)对 EAN133 条码进行编
我正在尝试使用 Nreco.VideoConverter 在 C# 中编写一个转换器。我以前从未有过这些经验。我开始研究这个领域是因为我在工作中被问到。我的问题是;我可以更改视频转换器中的比特率值。如
如何使用 C# 在 NReco PdfGenerator 中使用 HTML 强制创建新页面? 也许是特定的类或 id,就像这样适用于分页: Seite von 谢谢。 最佳答案 可以使用以下 cs
我将 NReco.VideoConverter 用于视频转换应用程序。现在我正在尝试将源视频中的音频替换为 mp3 音轨。我正在使用来自官方网站的这个片段:http://www.nrecosite.c
需要帮助解决后续问题。 我从 youtube 下载了 3 个视频,并使用 NReco.VideoConverter.FFMpegConverter.ConvertMedia 将其剪切成小块,并使用以下
我有一个作为 Azure Web 角色运行的应用程序,我想在 Wowza 服务器上截取实时 RTSP 视频流的屏幕截图。我正在使用 NReco FFMpegConverter 包装器。我遇到了一致性问
我正在开发一个用于实时流媒体的应用程序。 从视频设备捕获帧并使用名为 nreco 的 ffmpeg 包装器进行编码。 问题是,如果我尝试通过 red5 服务器上的 rtmp 将编码视频流式传输到 re
我将“NReco.PdfGenerator.dll”用于我的网络项目(Visual Studio 2012,c#),并且它可以成功地从互联网网址(如 http://google.com.tw)导出但是
在 NReco - wkhtmltopdf 的 html 到 pdf 包装器中,有没有办法以毫米为单位设置打印页面大小,就像您可以使用边框一样?在 docs 中找到了指定四种页面大小之一的方法,这不够
以下代码: string pathToVideoFile = "O:\\Byblioteka\\MAH01238.MP4"; var ffMpeg = new NReco.VideoConverter
我正在使用 Nreco Video Converter 在我的 MVC 项目中拍摄视频缩略图。应用程序在本地正常运行,但在实时主机上显示错误 错误是 拒绝访问路径“C:\Inetpub\vhosts*
我正在使用 Nreco PDFGenerator使用以下 PowerShell 脚本生成 PDF: $PdfGenerator = "$((Get-Location).Path)\lib\NReco.
我已经创建了一个用于 pdf 生成的 C# Azure 函数,并且正在使用 NReco pdf 生成器,但它无法在 Aazure 上运行。 您能否建议一种让它在 azure 中运行的方法? 我已通过
我是一名优秀的程序员,十分优秀!