Can I reprint a spool file?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 04:26:25

问题


Is there a way to reprint a spool file?

I can't find any example or article to say if there is a way or not.

edit: when i say reprint it, i mean to the same printer


回答1:


Yes you can. Read the complete SPL file into a byte array and have a look at this article:

http://support.microsoft.com/kb/322090/en-us

It shows you how to send raw data to a printer. Use that to send your byte array to the printer. Beware: a SPL file can actually contain various data types, such as EMF, PCL, ESC-P etc. Your must make sure that the format of the SPL file you have is appropriate for your specific printer.




回答2:


For EMF I would consider using the PrintDocument class and the Metafile class. PrintDocument's OnPrintPage event handler exposes a Graphics object that will allow you to render EMF files like such:

    void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
    {
        Metafile metafile = new Metafile("SampleMetafile.emf");
        e.Graphics.DrawImage(metafile, 10, 10);
    }

As for plain text you could just draw it to the Graphics object on the print document, but you would need to take into account text wrapping & lines, it may not be worth the effort. I would also suspect that with almost all devices if you send plain text down port 9100 to the printer that it would print reasonably well too.



来源:https://stackoverflow.com/questions/10313063/can-i-reprint-a-spool-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!