Dec 4, 2009 at 4:08 PM
Edited Dec 4, 2009 at 4:12 PM
I am creating a small printer monitor app with your fabulous component to capture some info from user's print jobs and write it to a database. I am just importing the dll and calling functions as I am not that well versed in vb.net.
The basic functionality is that when a user prints a job a form pops up with all the data fields populated except a project number that they get from a combo pulldown and then they click an ok button. My task is to make this as no-brainer for the users as
My program triggers just fine, gets almost all the fields it's supposed to, and writes them to the DB just fine when the users click ok. The problem I am having is with the values printjob.paperlength and printjob.paperwidth. I convert these values
to inches later in the code and calculate square feet for billing purposes.
I nearly always get 2794 x 2159 (8.5 x 11 inches) no matter what size is set in the printer dialog. I can capture the printjob.paperkind field just fine and get the named paper sizes but I need to be able to get the size of custom paper sizes as we
do engineering drawings and bill by the square foot. I am told by those who pay me that having the users fill in the size themselves, even for just the custom paper size, is not acceptable.
The odd thing is that sometimes it will return a correct value for the previous print job if I change the setup in the printer dialog for a current job. This leads me to believe that the data must be there somplece, I just can't get it to work.
Here is the code that gets the fields. I have moved it around from the job added, deleted, written, and set events and used a .spooling loop to make sure it's finished before getting the data. It works best in the .deleted event but still no joy with the
paper dimensions. Thanks in advance for any help.
With CType(e, PrintJobEventArgs)
uname = e.PrintJob.UserName
fname = e.PrintJob.Document
printername = e.PrintJob.PrinterName
mname = e.PrintJob.MachineName
jdate = e.PrintJob.Submitted
col = e.PrintJob.Color
numpages = e.PrintJob.TotalPages
copies = e.PrintJob.Copies
papersizel = e.PrintJob.PaperLength
papersizew = e.PrintJob.PaperWidth