Page 1 of 3

Bluetooth print and Special characters

PostPosted: Wed Feb 14, 2007 3:22 pm
by Richard Chidiak
Antonio

My fwppc app writes on bluetooth printer. This works OK on HP 460 BT, the print goes OK but the special characters do not show.
Printing to a text file and then manually printing the text file is OK.

I wouls like to avoid this solution and have direct print with special charcaters. Any idea ?
Has anyone succeeded printing special characters directly on bt from fwppc ?

Thanks for the help

Richard

Here is a small sample of the code

Sendblue( MemoRead(cfile)) // oemtoansi(cfile) does not do any change


STATIC function SendText( hOut, cText )
local n
FWRITE( HOUT, CTEXT + CRLF )
return nil

STATIC FUNCTION SENDBLUE(ctext)
LOCAL i, hOut

DPTCOM := "COM" + STR(PKID->COMIMPRI,1) + ":"
// DPTCOM := "COM6:"

hOut := CreateFile( DPTCOM,GENERIC_REWRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL )
IF hOut==-1
MsgStop("Port Impression non trouvé, Impression Impossible")
ELSE
FOR i = 1 TO Len( cText )
WriteByte( hOut, Asc(SubStr( cText, i, 1 ) ) )
NEXT
CloseHandle( hOut )
ENDIF
return nil

PostPosted: Thu Feb 15, 2007 6:17 pm
by Antonio Linares
Richard,

What asc() values those special characters have ?

PostPosted: Thu Feb 15, 2007 7:57 pm
by Richard Chidiak
Antonio

They are standard accented french characters (like in spanish)

i do not know the ascii character but i can display them it if necessary

ex: "Désignation" The (é) is one of them.

What is strange, is that my program writes first to an ascii file (txt) and then prints from the ascii file.

The ascii file is perfect.

If i print directly the ascii file to the printer (without fwppc), the printout is perfect !

I am puzzled. No one has ever tried to print local characters (spanish, portuguese,..etc) via bluetooth ?

I can do all necessary tests if needed.

Thanks for your help.


Richard

PostPosted: Thu Feb 15, 2007 9:06 pm
by Antonio Linares
Richard,

> i do not know the ascii character but i can display them it if necessary

Please place a MsgInfo() to check their asc() values, thanks

PostPosted: Thu Feb 15, 2007 9:17 pm
by Richard Chidiak
Antonio

first one is 233

Do you need them all ? :x

Richard

PostPosted: Thu Feb 15, 2007 9:34 pm
by Antonio Linares
Richard,

Just two more, please

PostPosted: Thu Feb 15, 2007 9:37 pm
by Richard Chidiak
232

224

PostPosted: Thu Feb 15, 2007 9:41 pm
by Richard Chidiak
231
249
176

PostPosted: Thu Feb 15, 2007 9:43 pm
by Antonio Linares
Richard,

Characters with ascii over 128 are printing right ? I wonder if it is a sign issue

PostPosted: Thu Feb 15, 2007 9:47 pm
by Richard Chidiak
Antonio

I do not have the printer here at home but at the office.

I can check all ascii chars tomorrow early morning and report back.

If you need any more testing, drop me a line

Regards

Richard

PostPosted: Fri Feb 16, 2007 8:51 am
by Richard Chidiak
Antonio

Confirmed, it is a sign issue

Ascii codes up to 127 are printed correct not the others.

I sent to your private email a pdf showing a print out of all ascii codes.

Richard

PostPosted: Fri Feb 16, 2007 9:08 am
by Antonio Linares
Richard,

Please test this function and place a #define WriteByte _WriteByte in your app:
Code: Select all  Expand view
HB_FUNC( _WRITEBYTE ) // hComm, nChar --> lOk
{
   DWORD cBytes;
   unsigned char ch = ( unsigned char ) hb_parnl( 2 );
   
   hb_retl( ( BOOL ) WriteFile( ( void * ) hb_parnl( 1 ), &ch, 1, &cBytes, NULL ) );
}   

PostPosted: Fri Feb 16, 2007 9:47 am
by Richard Chidiak
Antonio

Same result


Richard

PostPosted: Sat Feb 17, 2007 7:53 am
by Antonio Linares
Richard,

We are searching info for WriteFile() use to manage unsigned chars

PostPosted: Sat Feb 17, 2007 8:01 am
by Richard Chidiak
Antonio

No problem

I have the printer available all week end if you need some testing.

Let me know.

Richard