Solved

Non-printable printer margins

Posted on 1997-05-29
2
536 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 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

Technology Partners: 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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

729 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