Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

strange win32prn issue

90 views
Skip to first unread message

Claudio Herszage

unread,
May 16, 2013, 2:25:06 PM5/16/13
to
Hi
I'm printing labels in a laser printer with win32prn.
The routine has 2 arrays of coordinates for fields which are not modified while printing.
As printing moves down the page, the fields are slightly moved to the right although same X coordinate is passed to textoutat method for each label (actually more than 2 size 8 chars to the right along an A4 sheet).
Any idea? Below is a self contained example.
Thanks
Claudio H

///// CODE /////
#include "WINGDI.CH"

FUNCTION Main ()

LOCAL cPrinter := GetDefaultPrinter()
LOCAL oPrinter
LOCAL nX, aX:={1,951,1901,2851,3801}
LOCAL nY, aY:={171,971,1771,2571,3371,4171,4971,5771}

oPrinter := Win32Prn():new( cPrinter )
oPrinter:formType := DMPAPER_A4
oPrinter:create()
oPrinter:startDoc( "test" )

FOR nY:=1 TO LEN(aY)
FOR nX:=1 TO LEN(aX)
WITH OBJECT oPrinter
:setFont("Courier New",8,{0,0},FW_NORMAL)
:textOutAt(aX[nX],:topmargin+aY[nY]+ 0,"|12345678901234567890")
:textOutAt(aX[nX],:topmargin+aY[nY]+ 85,"|12345678901234567890")
:textOutAt(aX[nX],:topmargin+aY[nY]+ 370,"|12345678901234567890")
END
NEXT nX
NEXT nY

oPrinter:endDoc()
oPrinter:destroy()

RETURN NIL
///// ENDCODE /////

Enrico Maria Giordano

unread,
Apr 15, 2014, 10:30:21 AM4/15/14
to


Claudio,

> Hi
> I'm printing labels in a laser printer with win32prn.
> The routine has 2 arrays of coordinates for fields which
> are not modified while printing.
> As printing moves down the page, the fields are slightly
> moved to the right although same X coordinate is passed
> to textoutat method for each label (actually more than 2
> size 8 chars to the right along an A4 sheet).
> Any idea? Below is a self contained example.

I tried your sample on PDFCreator (virtual printer) and HP Deskjet F380
(real inkjet printer). No problem in both cases. I haven't a laser printer
but I doubt that the problem will only arise on that.

Any ideas on how to replicate the problem? I can't try to fix it otherwise.

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

eisoftserv

unread,
Apr 15, 2014, 11:07:38 AM4/15/14
to
Claudio: below is the current source code of the TextOutAt(...) method. I can only suggest you to make a test with ALL the input parameter values EXPLICITLY set in accordance with your needs.

Ella

METHOD TextOutAt( nPosX, nPosY, cString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert ) CLASS WIN32PRN

IF lNewLine == NIL
lNewLine := .F.
ENDIF
IF lUpdatePosX == NIL
lUpdatePosX := .T.
ENDIF
::SetPos( nPosX, nPosY )
::TextOut( cString, lNewLine, lUpdatePosX, nAlignHori, nAlignVert )

RETURN( .T. )
0 new messages