AccessViolationException - 尝试打印
我正在尝试从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您遇到内存分配/操作问题,可能是在为 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.