VeloEml2Pdf converts emails from ".eml" format to PDF (Portable Document Format) using Apache-Velocity and flying-saucer-pdf library.
String velocityTemplateFilePath = "src/main/resources/emlTemplateV2.html";
String inputFileEmlPath = "src/main/resources/example-eml-files/example_mail_200520013502983.eml";
String outputFilePdfPath = FilenameUtils.getBaseName(inputFileEmlPath) + "_" + new SimpleDateFormat("yyyyMMdd_HH-mm-ss").format(new Date()) + ".pdf";
Boolean ok = VeloEml2Pdf.convertEml2Pdf(velocityTemplateFilePath, inputFileEmlPath, outputFilePdfPath);
for command-line usage you have to add 3 parameters:
-
-t or -velocityTemplateFilePath
-
-i or -inputFileEmlPath
-
-o or -outputFilePdfPath
java -jar veloEml2Pdf-1.0-SNAPSHOT.jar -velocityTemplateFilePath "src/main/resources/emlTemplateV2.html" -inputFileEmlPath "src/main/resources/example-eml-files/mail.eml" -outputFilePdfPath "Test_1.pdf"