.NET: How to print files w/o opening them

前端 未结 6 849
长情又很酷
长情又很酷 2021-01-05 07:53

We have an application that basically archives files and we give the user the possibility to print these files. They can be .txt, .doc, .pdf, .jpg nothing fancy. Is there a

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-05 08:34

    Some printers support sending a file to the printer using command line LPR. We have a copier that does this. This truly doesn't open the file on the computer at all. It sends the file to the printer and the printer interprets it and prints it.

    LPR -S  -P  -o l "C:\Temp\Sample.PDF"
    

    We do it with PostScript and PDF files with great success. Don't know if it works for other file types; check the printer documentation.

    For recent versions of Windows, you need to enable the "LPR Port Monitor". Control Panel > Programs and Features > Turn Windows features on or off > Print and Document Services/LPR Port Monitor

    TechNet LPR Command Line

提交回复
热议问题