Good morning,
I'm trying to generate pdf files with Tuespechkin, using html. It works perfectly locally, however not in production.
public static bool GeneratePDFFromHTMLPaysage(String full_path, String htmlContent, String baseUrl)
{
try
{
String content = "<!DOCTYPE html><html><head><meta http-equiv='X-UA-Compatible' content='IE=edge'><meta charset='UTF-8' name='viewport' content='width=device-width, initial-scale=1'><title>Titre</title><link rel='stylesheet' type='text/css' href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'><script type='text/javascript' src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js'></script></head><body><div class='container'>";
content = content + htmlContent;
content = content + "</div></body></html>";
full_path = full_path + ".pdf";
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
ProduceOutline = true,
PaperSize = System.Drawing.Printing.PaperKind.A4, // Implicit conversion to PechkinPaperSize
Margins =
{
All = 0,
Unit = Unit.Centimeters
},
Orientation = GlobalSettings.PaperOrientation.Landscape
},
Objects = {
new ObjectSettings { HtmlText = content }
}
};
IConverter convert = new StandardConverter(
new PdfToolset(
new Win64EmbeddedDeployment(
new TempFolderDeployment())));
byte[] test = convert.Convert(document);
System.IO.File.WriteAllBytes(full_path, test);
return true;
}
catch (Exception e)
{
ErrorManager.Log(e.Message + "\n" + e.InnerException + "\n" + e.StackTrace);
return false;
}
}
Basically, I tried to replace 64 bits with 32 bits, specified a static path for deployment as advised in documentation (doing so create a folder in which the missing DLL is placed, it has the same behavior in local than in production, but only work locally).
my application is a basic windows application, I simply copy files from Debug or Release folder to deploy it :
as you can see, I included wkhtmltox.dll so it automaticaly deploy in the root folder of the project, but no results as well
**Summary : ** .NET 4 framework, windows application, trying to use Tuespechkin, had installated visual C++ 2013 on production trying to solve missing dll, and a lot of stuff with the code
Thanks for your attention, hoping for a solution
Well, seems like my production server is just too old (windows server 2003), and that it might explain the problem