项目作者: nickrussler

项目描述 :
Converts email files (eml, msg) to pdf
高级语言: Java
项目地址: git://github.com/nickrussler/email-to-pdf-converter.git
创建时间: 2015-04-19T02:31:06Z
项目社区:https://github.com/nickrussler/email-to-pdf-converter

开源协议:Apache License 2.0

下载


Email to PDF Converter (formely EML to PDF Converter) Actions Status

Packaging status

This software can be used to convert email files (eml or msg) to pdf files. It can be used as a library, command line tool or desktop application with its GUI.

The conversion is done by parsing (and cleaning) the mime/structure, converting it to html and then using wkhtmltopdf to convert the generated html to a pdf file.

It also handles inline images, corrupt mime headers and can use a proxy.

Prerequisites

You need :

  • a complete jre, not a headless one (on Debian, for example, you need to have openjdk-11-jre installed);
  • wkhtmltopdf needs to be in your $PATH

Download

You can download the lates binaries here.

There you can find a Windows setup.exe and a jar.

If you want to use the jar (e.g. for a non Windows OS) you need the wkhtmltopdf binary in the PATH.

Screenshot

Commandline Interface

  1. Usage: EmailToPDFConverter [options] <email-file>
  2. Options:
  3. -d, --debug
  4. Debug mode
  5. Default: false
  6. -e, --error
  7. Display only Error messages.
  8. Default: false
  9. -aa, --add-attachment-names
  10. Add the list of attachment names under the body text
  11. Default: false
  12. -a, --extract-attachments
  13. Extract Attachments.
  14. Default: false
  15. -ad, --extract-attachments-directory
  16. Extract Attachments to this Directory, if this option is not present the
  17. directory is besides the pdf as "<pdf-name>-attachments".
  18. -?, --help
  19. Print this help.
  20. -hh, --hide-headers
  21. Do not add email headers (subject, from, etc.) at the beginning of the
  22. PDF document.
  23. Default: false
  24. -o, --output-filepath
  25. Filepath of the produced PDF document. If this option is ommited the PDF
  26. will be placed alongside the email File.
  27. -s, --page-size
  28. Set wkhtmltopdf paper size to: A4, Letter, etc. (default A4)
  29. Default: A4
  30. -r, --dpi
  31. Set wkhtmltopdf DPI. (default 300)
  32. Default: 300
  33. -p, --proxy
  34. Proxy (e.g. "http://10.64.1.74:81"). If "auto" is supplied the default
  35. system proxy will be used.
  36. -q, --quiet
  37. Do not display any messages at all.
  38. Default: false
  39. -gui, --show-graphical-user-interface
  40. Show graphical user interface (other parameters are ignored when using
  41. this switch).
  42. Default: false
  43. -v, --version
  44. Print the version number.
  45. Default: false

E.g. java -jar emailconverter-2.1.1-all.jar example.eml (you need wkhtmltopdf binary in the PATH)

How to Build

You need to git clone this repository. The build will fail if you remove the .git folder (e.g. download this as zip from github).

  • gradlew shadowJar

    Creates a single self contained Jar in build/libs

  • gradlew dist

    Same as gradlew shadowJar but additionally creates windows exe launchers in build/libs for gui and console mode. This task needs the Launch4j binary in the PATH.

  • gradlew innosetup

    Creates a windows setup in build/innosetup. This task needs the Launch4j binary as well as the Inno Setup issc.exe in the PATH.

  • gradlew check

    Executes the unit tests and generates various reports (jacoco, checkstyle, findbugs, jdepend, unit test report).

Date Formatting

Dates are formatted with the default locale. You can change it, e.g. by passing the VM argument -Duser.language=en-US similar to setting the timezone e.g. -Duser.timezone="Asia/Kolkata".

License

The code is available under the terms of the Apache V2 License.