Solved

API Printing - Orientation (Again)

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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