Fix html conversion for text files

It must honor the configuration when doing html->pdf.
This commit is contained in:
eikek
2023-01-09 18:17:23 +01:00
parent 1d39b5c74e
commit 85094cc1f6

View File

@ -82,13 +82,26 @@ object Conversion {
Chunk.byteVector(ByteVector.view(html.getBytes(StandardCharsets.UTF_8))) Chunk.byteVector(ByteVector.view(html.getBytes(StandardCharsets.UTF_8)))
) )
.covary[F] .covary[F]
WkHtmlPdf.toPDF( cfg.htmlConverter match {
cfg.wkhtmlpdf, case HtmlConverter.Wkhtmltopdf =>
cfg.chunkSize, WkHtmlPdf.toPDF(
StandardCharsets.UTF_8, cfg.wkhtmlpdf,
sanitizeHtml, cfg.chunkSize,
logger StandardCharsets.UTF_8,
)(bytes, handler) sanitizeHtml,
logger
)(bytes, handler)
case HtmlConverter.Weasyprint =>
Weasyprint.toPDF(
cfg.weasyprint,
cfg.chunkSize,
StandardCharsets.UTF_8,
sanitizeHtml,
logger
)(bytes, handler)
}
} }
case MimeType.ImageMatch(mt) => case MimeType.ImageMatch(mt) =>