Printer DPI

Discussions related to network, internet and socket programming; also to serial, parallel, Bluetooth, USB etc.
MattC
Posts: 107
Joined: Mon 16 Apr 2018, 06:17

Printer DPI

Post by MattC »

Hi,

I'm trying to set up a program that prints labels. Each Line will be cut depending on its length against the width of the label. This necessitates knowing the printed length of the line-string. In the help file, on aligning proportional-spaced text, the request 'SYS "GetTextExtentPoint32", @prthdc%, string$, LEN(string$), size{}' is used to get the printer-printed string length. However, with experimentation, this gives a value of around 48 [units(/dots?)] per inch. However, the value returned by 'SYS "GetDeviceCaps", @prthdc%, _LOGPIXELSX TO dpix%', suggested in 'Drawing graphics to the printer', is 600 - which is the correct DPI value the printer is set to. (Other possible values are 300 and 1200, but not 48 (or 50?)). Where does the 48 come from? I would need to know how to get this value in order to workout how far to chop the string down. (The value 48 is half 96, the value of the screen resolution. Not sure if this is relevant.)

I have tried searching the help, forum and MS (docs.microsoft.com), but I can't seem to find any reference to this (or similar) value for this problem.

Matt

Edit: For anyone who's interested, I've solved the mystery. To my intense embarrassment, I realised that I had put the wrong variable into the system call in my program. The post above seems to have been copied directly from the help, rather than my own code. I had put the system variable @memhdc% rather than @prthdc%, therefore giving the screen value rather than the printer value. I obviously need to pay more attention to what I'm doing. :oops: