I'm trying to print a label on our Zebra printer with ZPL (Zebra Print Language). The printer has been added as a generic text printer and I'm trying to use a StreamWriter object to send the text to the printer. But I get an error "could not create CLRObject". Code looks like this:
StreamWriter sw;
;
perm.assert();
sw = new System.IO.StreamWriter(@"\\server\printer");
sw.WriteLine('Test');
sw.Flush();
sw.Close();
sw.Dispose();
CodeAccessPermission::revertAssert();
I also tried to write the text to a file and the move it to the print which worked.
StreamWriter sw;
FileName fileName = "file.txt";
;
perm.assert();
sw = new System.IO.StreamWriter(fileName);
sw.WriteLine('Test');
sw.Flush();
sw.Close();
sw.Dispose();
WinApi::move(fileName, @"\\server\printer");
CodeAccessPermission::revertAssert();
Any ideas?
*This post is locked for comments
I have the same question (0)