简体   繁体   English

排除/阻止PDF打印机

[英]Exclude / Block PDF Printer

I wanna know if it's possible to recognize printer in Java/C# as a pdf printer and block them. 我想知道是否有可能将Java / C#中的打印机识别为pdf打印机并阻止它们。

The main reason behind this is, that i have a printing software with pictures which include copyrights. 这背后的主要原因是,我有一个带有带有版权的图片的打印软件。 Within the web its easy for me to safe these copyrights with watermarks etc, but also the user is able to print out of the application. 在网络上,我很容易通过水印等保护这些版权,但是用户也可以从应用程序中打印出来。

If an user print the image to a pdf printer, he could cut the image out of the pdf fe . 如果用户将图像打印到pdf打印机,则可以将图像切出pdf fe。 Because in the printing result, the customer dont want a watermark 因为在打印结果中,客户不需要水印

You could check the print processor of the printer and see if it's a known PDF print processor. 您可以检查打印机的打印处理器,看看它是否是已知的PDF打印处理器。 https://msdn.microsoft.com/en-us/library/system.printing.printsystemobject.propertiescollection%28v=vs.110%29.aspx https://msdn.microsoft.com/zh-cn/library/system.printing.printsystemobject.propertiescollection%28v=vs.110%29.aspx

I dont think that this is possible by only checking a property. 我认为仅通过检查属性是不可能的。 What you can do is first to get all the printers by 您要做的就是首先获得所有打印机

PrinterSettings.InstalledPrinters 打印机设置。已安装的打印机

for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++){
    pkInstalledPrinters = PrinterSettings.InstalledPrinters[i];
}

after that you can write out the printer settings with PrintSystemObject.PropertiesCollection or directly the processor name with the PrintProcessorProperty Class . 之后,您可以使用PrintSystemObject.PropertiesCollection来写出打印机设置,或者直接使用PrintProcessorProperty Class来写出处理器名称。

Then you need to look at the property if you can specify the PDF Printers with any of these properties. 然后,如果可以使用这些属性中的任何一个指定PDF打印机,则需要查看该属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM