Solved

API Printing - Orientation (Again)

Posted on 2004-09-07
3
343 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

726 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