Solved

None printing area on Inkjet-/laser printers

Posted on 1998-09-24
4
267 Views
Last Modified: 2010-04-30
How do I get the top,bottom,left and right margin where a laser/inkjet printer cannot print. As far as I know, can I only get physical forms length/width and the printing forms length/width. Do anybody know if there is any way to get the exact margins where the printer cannot print.
I shall use these exact mesaures, because im making a form with an OCR-B line which an optical reader shall read, and the tolerance is a very small. I don't how and where to get these informations?
0
Comment
Question by:ertro
[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
4 Comments
 
LVL 2

Expert Comment

by:dabellei
ID: 1436410
The only way is to contact the manufacturer of the printer or reading the books that comes with the printer were this should be mentionned clearly.
0
 

Author Comment

by:ertro
ID: 1436411
Their must be another answer, I can read printer manual too, but I don't know which printer users of my program have, it vill be distibuted over the internet. I have made an solution today, where I make a box for the printing area, then the user can measure the none printing margins. If I have the top-,left margin or Bottom,right margin I can calculate the opposite. It may be the only way, but it isn't very elegant.
0
 
LVL 2

Accepted Solution

by:
schild earned 100 total points
ID: 1436412
Hello ertro

Try the folowing code:


   Private Const PHYSICALOFFSETY As Long = 113

   Private Declare Function GetDeviceCaps Lib "gdi32" ( _
      ByVal hdc As Long, ByVal nIndex As Long) As Long
   Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" _
      (ByVal hWnd As Long, ByVal msg As Long, ByVal wp As Long, _
      lp As Any) As Long

Public Sub MyPrinterCaps()

      ' Start a print job to get a valid Printer.hDC
      Printer.Print Space(1)
      Printer.ScaleMode = vbTwips

      ' Get the offsett to the printable area on the page in twips
      LeftOffset = Printer.ScaleX(GetDeviceCaps(Printer.hdc, _
         PHYSICALOFFSETX), vbPixels, vbTwips)
      TopOffset = Printer.ScaleY(GetDeviceCaps(Printer.hdc, _
         PHYSICALOFFSETY), vbPixels, vbTwips)


End Sub
0
 

Expert Comment

by:rukiman
ID: 2560398
With that code, can you tell the X and Y offsets for any printer accurately for any printer? I tested the code, it worked fine for the Y offset, but the X offset was way off, how come?
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

726 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