mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Allow to convert html->pdf via weasyprint
This commit is contained in:
@ -551,6 +551,10 @@ Docpell Update Check
|
||||
"""
|
||||
}
|
||||
|
||||
# Which HTML->PDF converter command to use. One of: wkhtmlpdf,
|
||||
# weasyprint.
|
||||
html-converter = "wkhtmlpdf"
|
||||
|
||||
# To convert HTML files into PDF files, the external tool
|
||||
# wkhtmltopdf is used.
|
||||
wkhtmlpdf {
|
||||
@ -568,7 +572,22 @@ Docpell Update Check
|
||||
]
|
||||
timeout = "2 minutes"
|
||||
}
|
||||
working-dir = ${java.io.tmpdir}"/docspell-convert"
|
||||
working-dir = ${java.io.tmpdir}"/docspell-wkhtmltopdf"
|
||||
}
|
||||
|
||||
# An alternative to wkhtmltopdf is weasyprint.
|
||||
weasyprint {
|
||||
command = {
|
||||
program = "weasyprint"
|
||||
args = [
|
||||
"--optimize-size", "all",
|
||||
"--encoding", "{{encoding}}",
|
||||
"-",
|
||||
"{{outfile}}"
|
||||
]
|
||||
timeout = "2 minutes"
|
||||
}
|
||||
working-dir = ${java.io.tmpdir}"/docspell-weasyprint"
|
||||
}
|
||||
|
||||
# To convert image files to PDF files, tesseract is used. This
|
||||
|
@ -10,6 +10,7 @@ import cats.effect.Async
|
||||
|
||||
import docspell.config.Implicits._
|
||||
import docspell.config.{ConfigFactory, FtsType, Validation}
|
||||
import docspell.convert.ConvertConfig.HtmlConverter
|
||||
import docspell.scheduler.CountingScheme
|
||||
import docspell.store.Db
|
||||
|
||||
@ -38,6 +39,9 @@ object ConfigFile {
|
||||
|
||||
implicit val mailAddressReader: ConfigReader[MailAddress] =
|
||||
ConfigReader[String].emap(reason(MailAddress.parse))
|
||||
|
||||
implicit val htmlConverterReader: ConfigReader[HtmlConverter] =
|
||||
ConfigReader[String].emap(reason(HtmlConverter.fromString))
|
||||
}
|
||||
|
||||
def validate: Validation[Config] =
|
||||
|
Reference in New Issue
Block a user