473,379 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

Expand|Select|Wrap|Line Numbers
  1. string searchQuery = "SELECT * FROM Win32_PrintJob";
  2. ManagementObjectSearcher searchPrintJobs = new ManagementObjectSearcher(searchQuery);
  3. ManagementObjectCollection prntJobCollection = null;
  4. prntJobCollection = searchPrintJobs.Get();
  5. foreach (ManagementObject prntJob in prntJobCollection)
  6. {
  7.     jobs.PagesPrinted = prntJob.Properties["PagesPrinted"].Value.ToString();
  8.  
  9.     jobs.TotalPages = prntJob.Properties["TotalPages"].Value.ToString();
  10. }
Sep 21 '15 #1
1 1724
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.
Sep 26 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: eight02645999 | last post by:
hi i use odbc to update a table in a database but i always get return value of -1 even though i tried to return an integer. the table is updated though .... sql = """ update table set column =...
4
by: OutdoorGuy | last post by:
Greetings, I am attempting to compile the code below, but I am receiving an error message when I do so. The error message is: "CSO161: 'Forloop.CalcAvg(int)': Not all code paths return a...
6
by: Hardy Wang | last post by:
Hi all, I have the following codes, but SCOPE_IDENTITY() just returns NULL to me. If I comment out SCOPE_IDENTITY() line and run @@IDENTITY line, it works fine!! Since I have a trigger on the...
1
by: fbouabcha | last post by:
Hi, My pb is to know the total pages to print, because I want to print each pages this format "page n of M". Thanks. Nass
4
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i have a gridview of records and i'm trying to display the total pages with 10 records per page. int totalpages; totalpages = 1148 / 10; totalpages = 114; there's actually 115...
7
by: Ryan Le Piane | last post by:
Hi everyone, I am trying to program a Form Pay Estimator and it calculates the gross pay, taxes owed, and net pay for an individual employee. For some reason my CalculateTaxes method in my Pay()...
1
by: Brian Connelly | last post by:
I have this code that I used to reset the page numbers based on the grouping value change and it executes as it should. Shared offset as Integer Shared currentgroup as Object Public Function...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.