Solved

Non-printable printer margins

Posted on 1997-05-29
2
512 Views
Last Modified: 2008-03-06
In using VB 4.0 I am working on an app that does a lot of printing to the printer.  Since it will be used by different people (and different printers), I need to know how to programmatically find out what the four non-printable margins are.  Does this come from the "device context" and if so, how do I get at it?  Using the difference between Printer.Width and Printer.ScaleWidth (and dividing by 2) assumes that the top and bottom non-printable margins are the same and this is rarely the case.
0
Comment
Question by:stephani
2 Comments
 
LVL 3

Accepted Solution

by:
byang earned 100 total points
ID: 1426624
You can get the offset of the upperleft corner of the printable area using either Escape() or GetDeviceCaps() API function. You have to pass in Printer.hdc as the device context.  For example:

  uppery=GetDeviceCaps(printer.hdc,PHYSICALOFFSETY)
  status=Escape(printer.hdc,GETPRINTINGOFFSET,0,0,rc)

Of course, the values you get back this way are pixels, not twips.
The definition of API stuff is in winapi directory under your vb directory.
0
 

Author Comment

by:stephani
ID: 1426625
This is the sort of thing I was looking for!  I haven't tried it yet to see IF it works, but I've been pointed in the right direction.  It's time for me to start reading up on how to access the API
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

758 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

14 Experts available now in Live!

Get 1:1 Help Now