milad reisi

milad reisi

  • NA
  • 5
  • 9k

problem with generating xps document

Aug 23 2012 5:56 PM

i want to create a virtual printer,then get data from virtual printer and process data

i use Passthrough XPS driver to get data in xps type

then i install redmon to redirect the virtual printer to my c# program

my c# program get data and save it in a file,but i can't open file with xps viewer

this is my c# code

static void Main()
   
{
       
string fname = Environment.GetEnvironmentVariable("TEMP") + @"\";
        fname
+= "1.xps";
       
FileStream fs = new FileStream(fname, FileMode.Create);
       
StreamWriter sw = new StreamWriter(fs);
       
StreamReader sr = new StreamReader(Console.OpenStandardInput());
        sw
.Write(sr.ReadToEnd());
        sw
.Flush();
        sw
.Close();
        sr
.Close();
   
}

thanks