printed total pages in C# not return correct value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • delei007
    New Member
    • Sep 2015
    • 2

    printed total pages in C# not return correct value

    hello friend saw some topics their on the internet and would like a help from you, I'm trying to collect the total pages printed, for example a file from a page to print two copies, the total is 2, use the following form but does not bring the value correct. I appreciate any clarification

    Code:
    string searchQuery = "SELECT * FROM Win32_PrintJob";
    ManagementObjectSearcher searchPrintJobs = new ManagementObjectSearcher(searchQuery);
    ManagementObjectCollection prntJobCollection = null;
    prntJobCollection = searchPrintJobs.Get();
    foreach (ManagementObject prntJob in prntJobCollection)
    {
    	jobs.PagesPrinted = prntJob.Properties["PagesPrinted"].Value.ToString();
    
    	jobs.TotalPages = prntJob.Properties["TotalPages"].Value.ToString();
    }
    Last edited by Rabbit; Sep 26 '15, 04:16 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • delei007
    New Member
    • Sep 2015
    • 2

    #2
    I found a great solution to this problem, I use windows logs collection system, simple and functional in the windows event viewer simply enable the option logs "printing services" ready, each print generates 3 informções files where you can collect all the information including the correct number of copies and prints made, enjoy.

    Comment

    Working...