views:

23

answers:

2

Hi All,

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

+1  A: 

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.

Andreas Paulsson
That does not help, but thanks.
Oakcool
Could you post some code that show us how you perform the allocation and initialization of the memory?
Andreas Paulsson
A: 

I have given up on this one, but thanks for those that tried to help.

Oakcool