how to convert .msg file to PDF using perl [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this questionHow to convert .msg file to PDf using perl (or) any option to conver .msg file to html using perl
Converting to PDF is the easy part.
Reading the .msg file will be the hard part, as it's a proprietary binary format. There is a detailed description (see: http://msdn.microsoft.com/en-us/library/cc463912(v=exchg.80).aspx) but all OLE-based formats take a good bit of work to puzzle out data extraction.
The specification isn't hugely clear (most MS ones take some work to grasp) but it looks like it's based on the same compound structure as Office documents, in which case OLE::Storage_Lite
will be able to manage the low-level file management. Essentially these formats all allow multiple streams of data within a single file, and it looks like .msg files are the same.
Years back, I did have to extract stuff from MS EXchange, and the strategy I used was to write a C++ class that used the MIME API, which allows RTF to be read for a message direct from the server. You can do something similar using Win32::OLE
, but in my experience its error handling was somewhat sensitive to network performance issues. The RTF will then be easy to render into PDF, because at least you have a representation you can work with.
Did you try PDF::Writer. Probably you need to print .msg using PDF print driver.
精彩评论