我目前正在我的项目中使用TuesPechkin版本2.1.1,以及TuesPechkin.Wkhtmltox.AnyCPU v0.12.4.1
这是我的一些代码:
byte[] result = null;
try
{
var globalSettings = CreateGlobalSettings(portraitMode);
var objectSettings = CreateObjectSettings(websiteUrl, urlParameters);
var document = new HtmlToPdfDocument
{
GlobalSettings = globalSettings
};
document.Objects.Add(objectSettings);
CreateEventLog.CreateInformationLog("Ready to convert PDF");
result = Converter.Convert(document);
CreateEventLog.CreateInformationLog(result == null
? "Conversion failed using the Pechkin library"
: "PDF conversion finished");我在3种不同的环境中运行这段代码:
服务器A和服务器B具有相同的设置(CPU、RAM等),在转换过程中服务器B上没有峰值增加。
有什么建议/想法吗?
发布于 2019-04-30 14:57:28
我发现了问题所在。
我试图转换的URL位于一个表示层,该层部署在一个单独的服务器上。Pechkin转换器处于业务层。
在Server A中,我可以从Business访问URL。在服务器B中,我无法从业务服务器访问URL。
这可能是需要创建的防火墙异常。
不过,如果有TuesPechkin,返回一个错误,说明它不能访问该URL,那就太好了。
发布于 2019-08-25 07:15:45
检查如何得到转换是很重要的,处理问题可能会导致问题,只需检查代码形式这里。
public static IConverter GetConverter()
{
lock (Locker)
{
if (converter != null)
{
return converter;
}
var tempFolderDeployment = new TempFolderDeployment();
var winAnyCpuEmbeddedDeployment = new WinAnyCPUEmbeddedDeployment(tempFolderDeployment);
IToolset toolSet;
if (HostingEnvironment.IsHosted)
{
toolSet = new RemotingToolset<PdfToolset>(winAnyCpuEmbeddedDeployment);
}
else
{
toolSet = new PdfToolset(winAnyCpuEmbeddedDeployment);
}
converter = new ThreadSafeConverter(toolSet);
}
return converter;
}https://stackoverflow.com/questions/55903665
复制相似问题