When I print from my CAD program, the results are typically within a few thousandths of an inch for both axis. From this I assume my printer and Windows driver are good. I just wrote something where I need similar accuracy, but found an error of about 0.15" over 8". Try the following and check the aspect ratio of the circles. I've got to be doing something wrong with the printer scaling but it's eluding me. Any ideas?
Thanks,
CH
Thanks,
CH
Code:
'Printer accuracy check #COMPILER PBWIN 9 #COMPILE EXE #MESSAGES COMMAND #OPTIMIZE SPEED #REGISTER DEFAULT #DEBUG ERROR ON #DEBUG DISPLAY ON #DIM ALL FUNCTION PBMAIN () AS LONG LOCAL hBmp AS DWORD LOCAL NativeResX, NativeResY AS LONG LOCAL NativeSizeX, NativeSizeY AS SINGLE LOCAL nLeft, nTop, nRight, nBottom AS SINGLE LOCAL NativeX, NativeY AS SINGLE LOCAL dpiRatioX, dpiRatioY AS SINGLE LOCAL dpi AS SINGLE dpi = 300 GRAPHIC BITMAP NEW 3000, 3000 TO hBmp '10x10" based on 300dpi IF hBmp = 0 THEN 'check that bitmap is created ? "Sorry, insufficient video memory." EXIT FUNCTION END IF GRAPHIC ATTACH hBmp, 0 GRAPHIC SCALE (-1500, 1500)-(1500, -1500) 'move zero to center GRAPHIC COLOR %BLACK, %WHITE GRAPHIC PAINT (0,0), %WHITE GRAPHIC ELLIPSE (-1200, 1200)-(1200, -1200) 'draw a 8" diameter circle based on 300dpi XPRINT ATTACH CHOOSE IF ERR = 0 AND LEN(XPRINT$) > 0 THEN XPRINT SET ORIENTATION 2 'put printer in landscape mode XPRINT GET PPI TO NativeResX, NativeResY 'get pixels per inch XPRINT GET SIZE TO NativeSizeX, NativeSizeY 'get full page size XPRINT GET MARGIN TO nLeft, nTop, nRight, nBottom 'get margins NativeX = NativeSizeX - nLeft - nRight 'calculate printable width NativeY = NativeSizeY - nTop - nBottom 'calculate printable height dpiRatioX = NativeResX/dpi 'calculate dpi multipliers for different printers dpiRatioY = NativeResY/dpi XPRINT SCALE (-NativeX/2/dpiRatioX, NativeY/2/dpiRatioY)- _ 'set new coordinate system (NativeX/2/dpiRatioX, -NativeY/2/dpiRatioY) 'with scaling for size correction XPRINT STRETCH hBmp, 0, (-1500, 1500)-(1500, -1500) TO _ (-1500, 1500)-(1500, -1500) XPRINT ELLIPSE (-1175, 1175)-(1175, -1175), %BLACK 'see if this one has the same aspect ratio END IF XPRINT CLOSE END FUNCTION
Comment