jonaswinkler / paperless-ng

A supercharged version of paperless: scan, index and archive all your physical documents
https://paperless-ng.readthedocs.io/en/latest/
GNU General Public License v3.0
5.37k stars 356 forks source link

Convert text files to PDF #338

Open andbez opened 3 years ago

andbez commented 3 years ago

Txt-Files can be uploaded to paperless-ng via Webfrontend and will be consumed.

  1. This Files won't be converted to pdfs
  2. If you would like to edit (in paperless) the document, it is not shown in preview
  3. Show Document works.
jonaswinkler commented 3 years ago
  1. That's true, I couldn't find an easy way to convert text documents into PDF documents yet. enscript has some issues with UTF-8 encoded files.
  2. Editing files isn't supported by paperless at all right now. I'll add support for showing text documents in the preview, But that'll really just show the same text that's also available in the content field right now.
andbez commented 3 years ago

Sorry, did not mean "editing the document", but the edit-view in paperless with the preview-frame of the document. The Preview-Frame is empty. Please see attached Screenshot.

Bildschirmfoto 2021-01-14 um 13 58 35
jonaswinkler commented 3 years ago

Ah, okay. For some reason I though you want to edit the actual .txt document with paperless.

Preview for all file types will be there, eventually.

jovandeginste commented 3 years ago

Gotenberg supports txt files; we could add it there. Alternatively, we could create a txt2pdf converter using what's already present.

jonaswinkler commented 3 years ago

This is a basic feature and I don't want to use an optional service to provide that.

jovandeginste commented 3 years ago

Would you find it reasonable to install a2ps inside the image? (It's available in the default repos).

A test with a LICENSE.txt I had laying around, gave this:

LICENSE.txt

$ a2ps LICENSE.txt -R -=book --header="Generated by Paperless-ng" -o LICENSE.ps
[LICENSE.txt (plain): 3 pages on 3 sheets]
[Total: 3 pages on 3 sheets] saved into the file `LICENSE.ps'
$ ps2pdf LICENSE.ps LICENSE.pdf

Result:

LICENSE.pdf

(NB: ps2pdf is already installed)

jonaswinkler commented 3 years ago

Sure, either that or enscript.

I'm just having issues with different file encodings when special characters are used (äöüßèéê etc)

jovandeginste commented 3 years ago

You're right; I now tried this tool, and it seems to work: txt2pdf

It's also written in Python.