Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Non-printable printer margins

Posted on 1997-05-29
2
Medium Priority
?
545 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
[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 Comments
 
LVL 3

Accepted Solution

by:
byang earned 400 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
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…
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…
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

688 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