[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

API Printing - Orientation (Again)

Posted on 2004-09-07
3
Medium Priority
?
361 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

656 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