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

Copy file(directory) to clipboard after exporting to pdf

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

有什么想法吗?

'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.

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