Это мой метод:
Код: Выделить всё
public async Task ToPdf()
{
var loader = new CustomAssemblyLoader();
var assemblyPath = Directory.GetCurrentDirectory();
loader.LoadUnmanagedLibrary($@"{assemblyPath}/libwkhtmltox");
var doc = new HtmlToPdfDocument()
{
GlobalSettings = {
Orientation = Orientation.Landscape,
PaperSize = PaperKind.A4,
Out = "wwwroot/test.pdf"
},
Objects = {
new ObjectSettings() {
PagesCount = true,
HtmlContent = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur mauris eget ultrices iaculis. Utodio viverra, molestie lectus nec, venenatis turpis.",
WebSettings = { DefaultEncoding = "utf-8" },
HeaderSettings = { FontSize = 9, Right = "Page [page] of [toPage]", Line = true, Spacing = 2.812 }
}
}
};
_pdfConverter.Convert(doc);
}
Код: Выделить всё
sudo apt-get install libgdiplus
Код: Выделить всё
DllNotFoundException: Unable to load shared library '/var/www/webapi/webapi/libwkhtmltox' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: /var/www/webapi/webapi/libwkhtmltox: cannot open shared object file: No such file or directoryЗаранее спасибо!
Подробнее здесь: https://stackoverflow.com/questions/551 ... -in-ubuntu
Мобильная версия