USB Printing

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: USB Printing

Post by apais »

A PCI paralell port for your new PC costs about U$D 5.-
Angel Pais
Web Apps consultant/architect/developer.
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Thanks, I know they are cheap!

Serge
There's nothing you can do that can't be done...
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: USB Printing

Post by trmpluym »

This harbour function will also do the job:
PrintFileRaw()
Print a file to a windows printer in RAW mode.

SYNTAX
PrintFileRaw() -->

ARGUMENTS
<cPrinter> = a valid windows printer name<cFileName>= a valid filename that exists and can be printed<cDocName> = option text to appear as the document name in the spooler

DESCRIPTION
This function prints a file to a windows printer in RAW mode.

EXAMPLES
FUNCTION MAIN()
LOCAL cPrinter:= GETDEFAULTPRINTER(), cFileName:="MyFile.Txt"
LOCAL nPrn:= -1, cMess:= "PrintFileRaw(): "
IF !EMPTY(cPrinter)
IF (nPrn := PrintFileRaw(cPrinter,cFileName)) < 0
DO CASE
CASE nPrn = -1
Alert(cMess+"Incorrect parameters passed to function")
CASE nPrn = -2
Alert(cMess+"WINAPI OpenPrinter() call failed")
CASE nPrn = -3
Alert(cMess+"WINAPI StartDocPrinter() call failed")
CASE nPrn = -4
Alert(cMess+"WINAPI StartPagePrinter() call failed")
CASE nPrn = -5
Alert(cMess+"WINAPI malloc() of memory failed")
CASE nPrn = -6
Alert(cMess+"WINAPI CreateFile() failed - File "+cFileName+" not found??")
OTHERWISE
Alert(cFileName+" PRINTED OK!!!?")
ENDCASE
ENDIF
ENDIF
RETURN(NIL)
You can use the port used in Windows. I used it also with USB ports.

Also see:

c:\hmg.3.4.4\HARBOUR\contrib\hbwin\tests\prn2.prg

Theo
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Hmmm.. I got a serious kob to investigate all possibilities !

Thx all !

Serge
There's nothing you can do that can't be done...
ASESORMIX
Posts: 192
Joined: Thu Oct 25, 2012 8:08 pm
Location: Bqto, Venezuela

Re: USB Printing

Post by ASESORMIX »

PrinFileRaw
He usado esta herramienta con excelente resultado.
Si La recomiendo.
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Just to let you know that this option did the job:

Code: Select all

net use lpt1: \\pc1\EPSON
In the calling batchfile which afterwards caal the EXE.

So no changes to my EXE...

Thanks for all for helping!

Serge
There's nothing you can do that can't be done...
franco
Posts: 821
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: USB Printing

Post by franco »

Serge,
I hmg you can do as follows
I send 2 parameters to print procedure DI and PR

Code: Select all

di := 'DIRECT'
pr := '\\PR1\STAR'
		if  upper(di) = 'DIRECT'
			SELECT PRINTER PR TO LSUCCESS ;  //PREVIEW ;
			ORIENTATION	PRINTER_ORIENT_PORTRAIT ;  
			QUALITY	PRINTER_RES_MEDIUM 
		else
			SELECT PRINTER P1 TO LSUCCESS PREVIEW ;
			ORIENTATION	PRINTER_ORIENT_PORTRAIT ;  
			QUALITY	PRINTER_RES_MEDIUM
			endif
			If lSuccess == .T.
					*PrintDoc()
			Else
				MsgInfo('Print Not Available')
				return
			EndIf
create print area here.
I have also added a pinter on one computer
to send to a different computer I add a port
port is \\different\star
then make the port for the printer this port. then you print to installed on local computer but prints to other ..Works good.
Franco
All The Best,
Franco
Canada
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: USB Printing

Post by serge_girard »

Thx, Franco !

I also replied to you in Private Mail.Please have a look!

Serge
There's nothing you can do that can't be done...
Post Reply