AccessViolationException - 尝试打印

发布于 2024-09-24 13:31:13 字数 446 浏览 2 评论 0原文

我正在尝试从 Reporting Services 打印报告,我采取的方法是:

渲染报告以获取 Byte[] 在客户端中创建一个文件(Something.pdf) 以读取模式将该文件加载到 FileStream 然后我尝试调用 http://support.microsoft.com 中描述的过程/kb/322091/en-us

如果您在方法 SendBytesToPrinter 中,有一行: bSuccess = WritePrinter(hPrinter, pBytes, dwCount, out dwWritten);

这一行给了我 AccessVilationException。

有谁知道如何解决这个问题,有没有更好的方法?

提前致谢

I am trying to print a report from Reporting Services, the approach I am taking is:

Render the report to get the Byte[]
Create a file in the client (Something.pdf)
Load that file in Read Mode to a FileStream
Then I try to make a call to the procedures described in http://support.microsoft.com/kb/322091/en-us

If you in method SendBytesToPrinter, there is a line:
bSuccess = WritePrinter(hPrinter, pBytes, dwCount, out dwWritten);

This line gives me the AccessVilationException.

Does anyone know how to solve this, and is there any better way of doing this?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何处潇湘 2024-10-01 13:31:13

您遇到内存分配/操作问题,可能是在为 pBytes 数组分配内存时。请参阅 http://social。 msdn.microsoft.com/forums/en-US/csharpgeneral/thread/cf744c83-fd7e-434c-b160-3f076d7491bf 用于该线程中解决的类似问题。

You have memory allocation/manipulation problems, problably when allocating memory for the pBytes array. See http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/cf744c83-fd7e-434c-b160-3f076d7491bf for a similar problem that is solved in that thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文