?
Solved

Printed Page Margins - revisited

Posted on 1998-08-13
3
Medium Priority
?
216 Views
Last Modified: 2010-04-30
My application produces a printed page output. The printing is complicated, some graphics, some text. When run on various systems, sometimes the printing overshoots the margins, usually the bottom one, yielding partial printout on multiple pages.

I started with guessing that any printer could handle half inch margins. 8.5 X 11 inches is 12240 X 15840 twips. Taking 1/2 inch off (720 twips) all around gives a printing "real estate" of 10800 X 14400 twips with upper right hand corner at x=720 and y=720 twips.

Printing is scaled to fit in the 10800 X 14400 box.

I found that I had to back off, that some installations evidently had bigger margins than that.  I backed off by guessing 100 twips at a time. There has to be a more direct way to do this.

How can I use PaperSize, Height, Width, ScaleLeft, ScaleTop properties of the printer object to get "usable twip real estate" information (from the specific installation) into my source code?  If I could do that, I could take it from there. -- Norm
0
Comment
Question by:normpos
[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 8

Accepted Solution

by:
mrmick earned 400 total points
ID: 1468781
  Dim PageWidthPixels As Long, PageHeightPixels As Long
   Dim UnPrintableAreaX As Long, UnPrintableAreaY As Long
   Dim PrintablePixelsX As Long, PrintablePixelsY As Long

   PageWidthPixels = Int(Printer.Width / Printer.TwipsPerPixelX)
   PageHeightPixels = Int(Printer.Height / Printer.TwipsPerPixelY)
   UnPrintableAreaX = PageWidthPixels - Int(Printer.ScaleWidth / Printer.TwipsPerPixelX)
   UnPrintableAreaY = PageHeightPixels - Int(Printer.ScaleHeight / Printer.TwipsPerPixelY)
   PrintablePixelsX = PageWidthPixels - UnPrintableAreaX
   PrintablePixelsY = PageHeightPixels - UnPrintableAreaY

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1468782
whoops... place this just after the sample above in a procedure and call it to see the result.


   MsgBox "PageWidthPixels: " & PageWidthPixels & vbCrLf _
          & "PageHeightPixels: " & PageHeightPixels & vbCrLf _
          & "UnPrintableAreaX: " & UnPrintableAreaX & vbCrLf _
          & "UnPrintableAreaY: " & UnPrintableAreaY & vbCrLf _
          & "PrintablePixelsX: " & PrintablePixelsX & vbCrLf _
          & "PrintablePixelsY: " & PrintablePixelsY & vbCrLf
         

0
 

Author Comment

by:normpos
ID: 1468783
mrmick: Thank you! Please be available if I have further comments on this. I'll get back to you and let you know how it works. -- Norm
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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Suggested Courses

765 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