导出为pdf后将文件(目录)复制到剪贴板

我想将导出的pdf文件存储到剪贴板,以便能够作为附件粘贴到Outlook中。我正在使用asp.net / vb,并且尝试在我的Web应用程序中导入system.windows.forms以使用剪贴板类。

有什么主意吗?

'here's my code:
Clipboard.SetDataObject(System.IO.Path.Combine("C:/Temp/",HttpContext.Current.Session("fileName")),True)

'this is the error after this process:
Exception thrown: 'System.Threading.ThreadStateException' in System.Windows.Forms.dll
An exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll but was not handled in user code
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
wwz1989 回答:导出为pdf后将文件(目录)复制到剪贴板

ASP.NET代码在后端(即服务器)上运行。因此,访问服务器上的剪贴板没有任何意义。相反,您可以找到可以在客户端浏览器上运行的JavaScript代码/组件。

本文链接:https://www.f2er.com/3146963.html

大家都在问