1
Answer

C#-APP How to get byte/stream of printed file

Ask a question
Wahyu Hidayat

Wahyu Hidayat

15y
7.3k
1
I write the code to get stream/bytes of printed file as follow:

private PrintSystemJobInfo GetInfo()
{
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue q = LocalPrintServer.GetDefaultPrintQueue();
q.Refresh();
foreach (PrintSystemJobInfo pj in q.GetPrintJobInfoCollection())
{
return pj;
}
return null;
}
PrintSystemJobInfo pj = GetInfo();
int len = pj.JobStream.Length;

I use Windows XP Sp2
When executing len = pj.JobStream.Length an error occur "Object reference not set to an instance of an object."

Is JobStream works in XP? Because I read that it works on vista only. Is there any other solution?

Answers (1)