Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, October 9, 2009 11:07:16 PM(UTC)

neohope  
neohope

Groups: Registered
Posts: 3


HI:

I got some problems with LPrint, please help me.

I have three printers on my WinXPsp3(HP LaserJet,PDF Virtual Printer,MS Office XPS Virtual Printer).
VS2008 and LeadTools v16.5.

When I tried LPrint in a testing application, it worked very well.
Some small problems are:
1.I have to use loops when CopyNumber > 1.
2.I donnot know how to change the default name of the document(LEAD GRAPHIC).
3.Is there any way to select a printer rather than the default one?

And when I used LPrint in a service program(interact with desktop), LPrint::GetPrinterDC can just get the handel of MS Office XPS Virtual Printer no mater which printer is default.
After I deleted MS Office XPS Virtual Printer, LPrint::GetPrinterDC get NULL.

I found a work aroud for the problem above:
Change the service "print spooler", uncheck "Allow service to interact with desktop", then LPrint can work again.
That's stange. Can you tell me why?  Thank you!

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, October 12, 2009 4:20:10 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

The LPrint class gives you the ability to simplify printing to the default printer. If you want to have more control, you can use Windows API functions (or MFC functions) to create your own printer device context handle (HDC) and then pass that HDC to our LEADTOOLS printing functions instead of having our LPrint class create the HDC for you.

To do that, use the following functions (or other functions if you know any):

1. To create a DC for any printer even if it's not the default, you can use the ::CreateDC function.
2. To specify multiple copies for printers that support this feature, use the dmCopies member of the DEVMODE structure with the ::CreateDC function.
3. To give the print job a tile of your own, use the ::StartDoc function and pass the print job title in the lpszDocName member of the DOCINFO structure.
4. After you start the print job, pass the same HDC to our LPrint::Print function. If you give our function a valid HDC, it will not create a new print job, and instead will use your DC.

About printing from a service, LEADTOOLS does not have any limitations, but your Windows system might have such limitations.

If you manage to create a valid printer HDC using Windows API functions, you should be able to pass that DC to our functions.
If other issues prevent you from creating the DC, such as permissions or service attributes, LEADTOOLS will not be able to do anything about it.
 
#3 Posted : Tuesday, October 13, 2009 12:13:08 AM(UTC)

neohope  
neohope

Groups: Registered
Posts: 3


Thank you so much Basel!

Acactually I tried CreateDC and DEVMODE, but I missed StartDoc.
I will try it right now!

Thank you again!
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.066 seconds.