Closed krlosmederos closed 4 years ago
Updated: If you execute wkhtmltopdf command inside container then styles and images are render ok. I tried sending multiple arguments to wkhtmltopdf from .net but i don't resolve the problem.
Hi!, What is the command you ran on the console? Have you checked if is not a path issue? Can you upload an example?
You say that with 3.1 is not working, with a previous version it worked correctly? if yes, which one?
Hi, not is a path issue, is a problem with ssl libraries and net core 3.1, betwen the breaking changes in net core 3.1 is change openssl 1.0 by openssl 1.1
If i install latest wkhtmltopdf version (0.12.5)
sudo apt-get install xvfb libfontconfig wkhtmltopdf
in the container and execute wkhtmltopdf then generate pdf ok, but with the generic build wkhtmltopdf i get error.
The problem is with files in https.
In the site official de wkhtmltopdf says:
Where are the “generic” Linux builds? The above binaries depend on packages provided by your distribution. Due to incompatibilities between library versions (specifically OpenSSL) provided by each distribution, the only option is to use static linking which isn’t recommended for OpenSSL – hence removed for now.
Sorry for my english :(
This is a snapshot with the error
I added this in WkhtmltopdfDriver class
string error = proc.StandardError.ReadToEnd();
ILogger _logger = Log.ForContext(typeof(WkhtmltopdfDriverPersonalized));
_logger.Warning(error);
if (ms.Length == 0)
{
throw new Exception(error);
}
I solved the problem, not calling the generic, i calling the wkhtmltopdf that I installed with apt-get
proc.StartInfo = new ProcessStartInfo
{
FileName = "wkhtmltopdf",
Arguments = switches,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardInput = true,
CreateNoWindow = true
};
Veo que te llamas carlos y sos de chile, asi que asumo que hablas español jaja
Que raro que sea un tema de ssl, lo corri pidiendo cosas de ssl y por ahora no me rompio...voy a hacer un par de pruebas, el tema de instalar la libreria por apt-get era que no era headless (o habia un problema con eso, hace tanto lo hice que ya ni me acuerdo jaja)
hago un par de pruebas y te comento
bueno...basicamente arme una vista de prueba de una imagen, y le puse bootstrap y una imagen sacada de un server con https...
Desde windows
Desde linux
Asi que confirmo el error
Arreglado para que funcione dentro del container
Basicamente actualizando la libreria te funciona (ahora las subo actualizadas), por otro lado voy a meter un par de mejoras cuando le envias por parametro que libreria de wkhtml queres usar
Ahi hice el push al proyecto de ejemplo el update https://github.com/fpanaccia/Wkhtmltopdf.NetCore.Example
Despues meto los otros cambios que te comente,
Saludos!
Pd: si tenes algun problema avisame por aca o levanta otro caso
Buena, te pasaste, menos mal que pasamos al español, revisaré su actualización, lo probaré y le comento por aquí. Muchas gracias por la rápida respuesta. Saludos.
Update: Solucionado el issue. Muchas gracias
por nada!
I get images and css by urls in the html, I use method GetByteArrayViewInHtml, when I run my application in localhost (windows) all is fine, but when I execute from container only show text in pdf without style and without images. My dockerfile copy the binaries and I give permisions chmod 755 to this files.
RUN chmod 755 ./wkhtmltopdf/Linux/wkhtmltopdf
RUN chmod 755 ./wkhtmltopdf/Linux/wkhtmltoimage
I use asp.net core 3.1
My images and css are stored in Azure Storage.