mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 17:55:06 +00:00
Fix converted filename
Mark it by default with a string from the config file. Issue: 397
This commit is contained in:
parent
ef7cb4e779
commit
6db5c39d78
@ -6,6 +6,7 @@ import docspell.convert.flexmark.MarkdownConfig
|
|||||||
|
|
||||||
case class ConvertConfig(
|
case class ConvertConfig(
|
||||||
chunkSize: Int,
|
chunkSize: Int,
|
||||||
|
convertedFilenamePart: String,
|
||||||
maxImageSize: Int,
|
maxImageSize: Int,
|
||||||
markdown: MarkdownConfig,
|
markdown: MarkdownConfig,
|
||||||
wkhtmlpdf: WkHtmlPdfConfig,
|
wkhtmlpdf: WkHtmlPdfConfig,
|
||||||
|
@ -23,6 +23,7 @@ object ConversionTest extends SimpleTestSuite with FileChecks {
|
|||||||
|
|
||||||
val convertConfig = ConvertConfig(
|
val convertConfig = ConvertConfig(
|
||||||
8192,
|
8192,
|
||||||
|
"converted",
|
||||||
3000 * 3000,
|
3000 * 3000,
|
||||||
MarkdownConfig("body { padding: 2em 5em; }"),
|
MarkdownConfig("body { padding: 2em 5em; }"),
|
||||||
WkHtmlPdfConfig(
|
WkHtmlPdfConfig(
|
||||||
|
@ -328,6 +328,11 @@ docspell.joex {
|
|||||||
# as used with the rest server.
|
# as used with the rest server.
|
||||||
chunk-size = 524288
|
chunk-size = 524288
|
||||||
|
|
||||||
|
# A string used to change the filename of the converted pdf file.
|
||||||
|
# If empty, the original file name is used for the pdf file ( the
|
||||||
|
# extension is always replaced with `pdf`).
|
||||||
|
converted-filename-part = "converted"
|
||||||
|
|
||||||
# When reading images, this is the maximum size. Images that are
|
# When reading images, this is the maximum size. Images that are
|
||||||
# larger are not processed.
|
# larger are not processed.
|
||||||
max-image-size = ${docspell.joex.extraction.ocr.max-image-size}
|
max-image-size = ${docspell.joex.extraction.ocr.max-image-size}
|
||||||
|
@ -135,7 +135,11 @@ object ConvertPdf {
|
|||||||
) = {
|
) = {
|
||||||
val hint =
|
val hint =
|
||||||
MimeTypeHint.advertised(MimeType.pdf).withName(ra.name.getOrElse("file.pdf"))
|
MimeTypeHint.advertised(MimeType.pdf).withName(ra.name.getOrElse("file.pdf"))
|
||||||
val newName = ra.name.map(n => s"$n.pdf")
|
val newName =
|
||||||
|
ra.name
|
||||||
|
.map(FileName.apply)
|
||||||
|
.map(_.withExtension("pdf").withPart(cfg.convertedFilenamePart, '.'))
|
||||||
|
.map(_.fullName)
|
||||||
ctx.store.bitpeace
|
ctx.store.bitpeace
|
||||||
.saveNew(pdf, cfg.chunkSize, MimetypeHint(hint.filename, hint.advertised))
|
.saveNew(pdf, cfg.chunkSize, MimetypeHint(hint.filename, hint.advertised))
|
||||||
.compile
|
.compile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user