cancel
Showing results for 
Search instead for 
Did you mean: 
Mariam73
New member
1 0 0 0
Message 1 of 2
71
Flag Post
HP Recommended

Printing with HP laserJet 10xx in .Net

HP laserJet 10xx
Microsoft Windows 10 (64-bit)

I am having a problem with with printing from .Net 2.0 on HP LaserJet 10xx printers.

 

Occasionally (sometimes once a month, sometimes once a day) printer gets 'blocked' in such a manner that it can not print anything from .net 2.0.

 

When printDocument.print method is invoked, it throws InvalidPrinterException, even if printer has just been selected from printDialog. Printer is online and working (everything else can be printed on it), only printing that goes through .net is blocked.

 

I have discovered that problem is in the following registry key:

HKEY_CURRENT_USER\Printers\DevModePerUser 

If this key exists, PrintDocument.PrinterSettings.IsValid reports 'false'. The moment this key is erased PrintDocument.PrinterSettings.IsValid is 'true' and printer is working. Right now I am solving this the following way: If printer is "HP" and PrinterSettings is 'false' then check if registry key exists, erase the key and then do the printing. Now, I am aware this is lame, but so far I haven't been able to discover why this happens. I emphasize that this only happens with HP LaserJet 10xx printers. Printing from .NET is completely blocked until this registry key exists.

 

Has anyone seen such error and if yes, what is the solution?

1 REPLY 1
Level 11
Level 11
3,610 3,581 223 574
Message 2 of 2
44
Flag Post
HP Recommended

Printing with HP laserJet 10xx in .Net

Interesting observations, thanks for sharing!

 

This sounds like a .net and Windows issue more than an HP printer issue.  The printer will print as long as the print commands are sent.  However, .Net is checking registry values to determine if a print job is available to send to the printer or not.  This cuts the printer out of the decision making process when .net is involved.

 

You may have better luck asking about this issue on Microsoft forums or one of the developer subs on Reddit.  Most will recommend that you update your .net to a newer version as the first troubleshooting step.

 

Otherwise I would say that your programmatic work around is a good idea.  You correctly isolated the problem down to a few variables.  Someone would need to test your code against a current printer model and driver to see if it is still an issue with newer .net and HP drivers/software.


Experts are not HP Employees. Experts are advanced users, administrators, technicians, engineers or business partners who volunteer their time to answer community questions.

Please mark anything that is helpful with a Kudo.
When you are done troubleshooting, please mark one of the responses as the Solution.
This feedback enhances the community by helping future readers choose between multiple similar responses.

Reply
0 Kudos
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation