Solved

None printing area on Inkjet-/laser printers

Posted on 1998-09-24
4
266 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 Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

737 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