Solved

API Printing - Orientation (Again)

Posted on 2004-09-07
3
337 Views
Last Modified: 2006-11-17
Ok, after trashing my system and the computer, I'm ready to try again.

A while ago I asked for code to change the page orientation.  I was given some code here:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21113934.html

I tested the above code on an HP and it worked fine (so I awarded points).  After which I tried it on the actual printer I would use (a Zebra Label printer) and the code trashed everything so bad I had to remove and reinstall the printer in the Start/Settings/Printers list.

The Zebra Label printer does support landscape printing.  I can change the orientation in the printer's properties and print a test page and everything works well.  But I need to do this within code.

As before I can't using the Printers collection because I cannot gaurantee that the target machine(s) will have the Zebra printer in their collection.

Any ideas on some working code?
0
Comment
Question by:Clif
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 12000312
Can you make the printer object work reliably when the zebra printer is added (via Add Printer)?
If so, then is it possible for your users to be required to add the printer before using your application?

If not, have you had any success with using the printing API's - that is, do you only need help with the orientation part, or are you looking for a complete solution?

Finally, does your application open a print dialog, or is the printing taking place unattended or automatically?

Sorry for so many questions :]
0
 
LVL 10

Author Comment

by:Clif
ID: 12005093
As part of the customer's requirements, I cannot force the users to add the printer.

I have had success using the API's for printing.  I can OpenPrinter() and ClosePrinter().  More importantly (for fonts) I can CreateDC(), send a font to the printer ant TextOut().  All the API's seem to work except for changing the orientation.

The application does not open a print dialog per se.  There is a printer selection screen that pops up, but I create that screen.  A print dialog screen would only have those printers which are in the collection or present a list of the hundreds of printers in the company's network.  The customer only wants the users presented with the list of printers specific to the job at hand, in this specific case, the label printers.
0
 
LVL 10

Author Comment

by:Clif
ID: 12101885
I discovered how to add (and remove) a printer on the fly.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now