Solved

API Printing - Orientation (Again)

Posted on 2004-09-07
3
344 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 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