While trying to deal with conversion with Aspose.TOTAL java API, from any message to PDF/A-2, we notice the below discrepancies and issues -
-
The sender from section contains only, the sender name and the sender email address does not appear in the converted PDF.
-
The time-zone gets converted from a 12-hour time format to 24-hours format while conversion to PDF.
Can you please let us know how to preserve -
- the displaying of email address also in from section, after conversion to pdf.
- preserve the same time-format while conversion to pdf. If the time format is 12 hour in the input email, then PDF should display the time in 12-hour format as well.
Thanks a lot in advance for all your feedback and support into the same.
Below is the code snippet we use for the same.
…
…
ByteArrayOutputStream stream = new ByteArrayOutputStream();
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_B);
try {
InputStream docStream = new FileInputStream(new File(“D:\temp\input.eml”));
MailMessage eml = MailMessage.load(docStream);
// Save the Message to output stream in MHTML format
ByteArrayOutputStream emlStream = new ByteArrayOutputStream();
eml.save(emlStream, com.aspose.email.SaveOptions.getDefaultMhtml());
//eml.save(emlStream, saveOptions);
//eml.save(emlStream);
// Load the stream in Word document
LoadOptions loadOptions = new LoadOptions();
// lo.setFontSettings(msDocFontsSettings);
loadOptions.setLoadFormat(LoadFormat.MHTML);
Document doc = new Document(new ByteArrayInputStream(emlStream.toByteArray()), loadOptions);
// or Save to stream
doc.save(stream, options);
} catch (Exception e) {
e.printStackTrace();
}
convertPDFToPDFA2(new ByteArrayInputStream(stream.toByteArray()));
…
…
private static void convertPDFToPDFA2(ByteArrayInputStream byteArrayInputStream) {
try {
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(byteArrayInputStream);
pdfDocument.convert(“pdfConversion_log.xml”, PdfFormat.PDF_A_2A, ConvertErrorAction.Delete);
pdfDocument.save(“D:\temp\output.pdf”);
System.out.println("conversion complete.");
} catch (Exception e) {
e.printStackTrace();
}
}<a class="attachment" href="/uploads/default/43352">AsposeEmailSMimeToPdf.zip</a> (1.4 KB)