.net 如何将.MSG打印成PDF
我有1000封.msg格式的电子邮件,我想把它们转换成PDF文件。 已请求读取.MSG文件 但对我来说,问题是如何像从文件->打印一样打印.msg电子邮件.net 如何将.MSG打印成PDF,.net,pdf,printing,outlook,msg,.net,Pdf,Printing,Outlook,Msg,我有1000封.msg格式的电子邮件,我想把它们转换成PDF文件。 已请求读取.MSG文件 但对我来说,问题是如何像从文件->打印一样打印.msg电子邮件 是否有一种将.msg电子邮件打印为PDF的简单方法?您可以使用类似的应用程序 它有一个“从命令行打印”功能,可以在批处理模式下使用 注意:我没有使用这个查看器,但我认为这可能是一个很好的建议。您可以使用类似的应用程序 它有一个“从命令行打印”功能,可以在批处理模式下使用 注意:我没有使用这个查看器,但我认为这是一个很好的建议。如果你想用一个编
是否有一种将.msg电子邮件打印为PDF的简单方法?您可以使用类似的应用程序 它有一个“从命令行打印”功能,可以在批处理模式下使用
注意:我没有使用这个查看器,但我认为这可能是一个很好的建议。您可以使用类似的应用程序 它有一个“从命令行打印”功能,可以在批处理模式下使用
注意:我没有使用这个查看器,但我认为这是一个很好的建议。
如果你想用一个编程语言实现一个解决方案,而不是手工打印每个消息,你可以考虑使用aspsith.Network和asPosits。NET组件的单词。他们一起将MSG文件转换为PDF
Aspose.Network for.NET,用于加载MSG并另存为MHTML格式 Aspose.Words for.NET,用于加载MHTML并生成PDF或任何其他受支持的格式请查看位于的示例代码。它可以对TIFF进行MSG,但是您可以稍稍修改并给出任何支持的格式,包括PDF、DOC、DOX等。 < P>如果您希望用编程语言实现的解决方案,而不是手动打印每个消息,则可以考虑使用ASSputs.Network和asPosits。他们一起将MSG文件转换为PDF
Dim objItem, objFSO, strFile, input, fileExt, strHtml, strPdf, msg, wordDoc, wordApp, tempFileFolder
Const olFormatHTML = 5
Const wdFormatPDF = 17
input = Wscript.Arguments(0)
' Create a File System object
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
' Check if the Word document exists
If objFSO.FileExists(input) Then
Set objItem = objFSO.GetFile(input)
strFile = objItem.Path
Else
WScript.Echo "FILE OPEN ERROR: The file does not exist" & vbCrLf
WScript.Quit
End If
fileExt = Right(strFile,3)
If fileExt <> "msg" Then
WScript.Echo "FILE ERROR: The file extension is not .msg" & vbCrLf
WScript.Quit
End If
strHtml = objItem.Path + ".html"
strPdf = objItem.Path + ".pdf"
Set Outlook = CreateObject("Outlook.Application")
Set msg = Outlook.CreateItemFromTemplate(objItem.Path)
msg.SaveAs strHtml, olFormatHTML
Outlook.Quit
Set wordApp = CreateObject( "Word.Application" )
wordApp.Documents.Open strHtml
Set wordDoc = wordApp.ActiveDocument
wordDoc.SaveAs strPdf, wdFormatPDF
wordDoc.Close
wordApp.Quit
If objFSO.FileExists(strHtml) Then
objFSO.DeleteFile(strHtml)
End If
tempFileFolder = objItem.Path & "_files"
If objFSO.FolderExists(tempFileFolder) Then
objFSO.DeleteFolder(tempFileFolder)
End If
Aspose.Network for.NET,用于加载MSG并另存为MHTML格式
Aspose.Words for.NET,用于加载MHTML并生成PDF或任何其他受支持的格式
请查看位于的示例代码。它向TIFF发送消息,但您可以稍微修改并提供任何支持的格式,包括PDF、DOC、DOCX等。我会考虑使用。通过这些示例,创建基本的PDF文件非常容易。我想你真正需要的就是做这种工作。使用Outlook Redemption获取数据,使用PDFSharp创建pdf。我会考虑使用。通过这些示例,创建基本的PDF文件非常容易。我想你真正需要的就是做这种工作。使用Outlook Redemption获取数据,使用PDFSharp创建pdf。
Dim objItem, objFSO, strFile, input, fileExt, strHtml, strPdf, msg, wordDoc, wordApp, tempFileFolder
Const olFormatHTML = 5
Const wdFormatPDF = 17
input = Wscript.Arguments(0)
' Create a File System object
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
' Check if the Word document exists
If objFSO.FileExists(input) Then
Set objItem = objFSO.GetFile(input)
strFile = objItem.Path
Else
WScript.Echo "FILE OPEN ERROR: The file does not exist" & vbCrLf
WScript.Quit
End If
fileExt = Right(strFile,3)
If fileExt <> "msg" Then
WScript.Echo "FILE ERROR: The file extension is not .msg" & vbCrLf
WScript.Quit
End If
strHtml = objItem.Path + ".html"
strPdf = objItem.Path + ".pdf"
Set Outlook = CreateObject("Outlook.Application")
Set msg = Outlook.CreateItemFromTemplate(objItem.Path)
msg.SaveAs strHtml, olFormatHTML
Outlook.Quit
Set wordApp = CreateObject( "Word.Application" )
wordApp.Documents.Open strHtml
Set wordDoc = wordApp.ActiveDocument
wordDoc.SaveAs strPdf, wdFormatPDF
wordDoc.Close
wordApp.Quit
If objFSO.FileExists(strHtml) Then
objFSO.DeleteFile(strHtml)
End If
tempFileFolder = objItem.Path & "_files"
If objFSO.FolderExists(tempFileFolder) Then
objFSO.DeleteFolder(tempFileFolder)
End If