Hello,
When using the GroupDocs Viewer, I’m currently unable to to render MSG type files into PDF ones.
All other tested file types work.
Regards,
Hello,
When using the GroupDocs Viewer, I’m currently unable to to render MSG type files into PDF ones.
All other tested file types work.
Regards,
Could you please share the problematic MSG file and the exact app link that you are using to render it?
Good Morning,
Using:
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-viewer</artifactId>
<version>25.6</version>
</dependency>
I cannot attach a *.msg file here as its restricted but I created the msg file by right clicking an outlook email and “save as” => “save as MSG”
Regards,
Hello @leokwong ,
Unfortunately, we were not able to reproduce this issue on our side.
Could you please share the code sample you’re using to render the MSG file to PDF?
For reference, the following code works correctly on our side:
PdfViewOptions viewOptions = new PdfViewOptions("output_msg.pdf");
try (Viewer viewer = new Viewer("input.msg")) {
viewer.view(viewOptions);
}
If you are using the same approach but are still encountering the issue with your MSG files, we would appreciate it if you could share a sample file to help us reproduce the problem.
You can either attach it to this post in a ZIP archive or share a download link (e.g., via Google Drive).
Additionally, we recommend using the latest available version of GroupDocs.Viewer for Java 25.7.
Hello,
I have updated to the latest library version 25.7 and issue still persists. I am using a similar approach however I am loading the content from a stream following the GroupDocs “GetPdfStream” example.
// Code Snippet of retrieving Binary content from a stream
InputStream stream = content.stream();
try(Viewer viewer = new Viewer(stream);
MemoryFileStreamFactory streamFactory = new MemoryFileStreamFactory()) {
PdfViewOptions options = new PdfViewOptions(streamFactory);
Security security = new Security();
security.setPermissions(Permissions.DENY_ALL);
options.setSecurity(security);
viewer.view(options);
stream = streamFactory.getStream();
}
catch(Exception e) {
LogMessage msg = Message.Exception.VIEWER_CONTENT_RENDER_EX.message(content.contentName());
Log.error(msg);
return ResponseEntity.internalServerError()
.body(new InputStreamResource(new ByteArrayInputStream(msg.formattedMessage().getBytes())));
}
private static class MemoryFileStreamFactory implements FileStreamFactory, Closeable {
private final ByteArrayOutputStream mArrayOutputStream;
public MemoryFileStreamFactory() {
this.mArrayOutputStream = new ByteArrayOutputStream();
}
@Override
public OutputStream createFileStream() {
return mArrayOutputStream;
}
@Override
public void closeFileStream(OutputStream outputStream) {
//Do not dispose stream here
}
public InputStream getStream() {
return new ByteArrayInputStream(mArrayOutputStream.toByteArray());
}
@Override
public void close() throws IOException {
mArrayOutputStream.close();
}
}
Have also noticed that EML type files also fails to render in this manner but all other tested files work including DOC, CSV, PPT, XLS, PNG, JPG, TIFF, DWG, etc…
Also attaching tested files in ZIP
EmlMsgTestFiles.zip (40.2 KB)
Hello @leokwong ,
Unfortunately, we still cannot reproduce this issue on our side.
We also tested the “GetPdfStream” example, modifying it to load the .eml
document from a stream — but we are still getting the correct result .
Have you tried explicitly specifying the file type using LoadOptions.setFileType(FileType.EML)
?
There might be an issue with detecting the file type when loading from a stream.
Could you also please let us know exactly which Java version and operating system you are using?
And if possible, would you be able to share a small demo project that reproduces the issue? That would help us run it on our side and investigate further.
We’re looking forward to your response so we can assist you as quickly as possible.
Hi Leo, to resolve the issue with MSG files not rendering to PDF using GroupDocs.Viewer, ensure that the necessary email rendering dependencies (like Aspose.Email) are correctly referenced in your project, and that you’re using the latest version of GroupDocs.Viewer — as older versions may lack full MSG support; also verify the MSG file isn’t corrupted and try setting ViewOptions with RenderEmailAttachments = true to handle embedded content properly.