Print Direct
Print Direct
[structlayout(layoutkind.sequential, charset=charset.ansi)]
internal static extern bool startdocprinter( intptr hprinter, int32 level, [in,
marshalas(unmanagedtype.lpstruct)] docinfoa di);
// sendbytestoprinter()
di.pdatatype = "raw";
// start a document.
// start a page.
if( startpageprinter(hprinter) )
endpageprinter(hprinter);
}
enddocprinter(hprinter);
closeprinter(hprinter);
dwerror = getlasterror();
return bsuccess;
intptr pbytes;
int32 dwcount;
dwcount = szstring.length;
// assume that the printer is expecting ansi text, and then convert
pbytes = marshal.stringtocotaskmemansi(szstring);
marshal.freecotaskmem(pbytes);
return true;
you have make sure that you're sending the proper bytes to the printer. if you're
just sending a byte representation of the string of commands you're not actually
sending the bytes for the actual commands.