Solved

None printing area on Inkjet-/laser printers

Posted on 1998-09-24
4
260 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
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now