在工作中,我遇到了DotNet 客户端的 EvoPdf问题,由于以下异常,它实际上不会转换 html:
An error occured. Initialization failed: Insufficient data
堆栈跟踪显示以下内容:
at am.aa()
at EvoPdf.HtmlToPdfClient.HtmlToPdfConverter.ConvertHtml(String html, String baseUrl)
at evoPdfTest.Program.Main(String[] args) in D:\git\evoPdfTest\evoPdfTest\Program.cs:line 32
这当然没有意义,因为为了验证这不是我做的任何事情,我决定制作一个小型控制台应用程序,如下所示(同样的错误也出现在他们的演示代码中。
var pdfConverter = new HtmlToPdfConverter(myIpString, myPort);
var paragraphHtml = $$"<!DOCTYPE html><html> <body> The content of the body element is displayed in your browser.</body></html> "";
pdfConverter.LicenseKey = myKey;
// Set an adddional delay in seconds to wait for JavaScript or AJAX calls after page load completed
// Set this property to 0 if you don't need to wait for such asynchcronous operations to finish
pdfConverter.ConversionDelay = 2;
// set PDF page size
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
// set PDF page orientation
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Portrait;
var pdfBytes = pdfConverter.ConvertHtml(paragraphHtml, null);
我哪里错了,这只是一个写得非常糟糕的错误消息的例子吗?