normpos
asked on
Printed Page Margins - revisited
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
MsgBox "PageWidthPixels: " & PageWidthPixels & vbCrLf _
& "PageHeightPixels: " & PageHeightPixels & vbCrLf _
& "UnPrintableAreaX: " & UnPrintableAreaX & vbCrLf _
& "UnPrintableAreaY: " & UnPrintableAreaY & vbCrLf _
& "PrintablePixelsX: " & PrintablePixelsX & vbCrLf _
& "PrintablePixelsY: " & PrintablePixelsY & vbCrLf