I am finally ready to explore the xprint functions, because I found out buying printing software did not offer full support, especailly with vista.
I have looked at forums for printing but some are too complex, I know I can do xprinting using less code and with help from fellow members help.
In the forum I have never been to successful finding many help articles, they are scatered around and dificult. Hopefully I will post a step by step on how to use Xprint functions with the help of forum members, for everyone who are also starting to use xprint functions.
I have included the test program I have started in exploring xprint. I want to print a full page of text with 80 character acrosss, a full page of text with 135 characters across (condensed). And later figure out bitmap printing and print preview.
1. problem one is that the sample text gets chopped off at 65 characters for the 80 & 135 character across and the first character does not print (printing
starts at extreme left).
also noted that printing uses about 1/4 of the page, when I want the full width across with margins all around.
I have looked at forums for printing but some are too complex, I know I can do xprinting using less code and with help from fellow members help.
In the forum I have never been to successful finding many help articles, they are scatered around and dificult. Hopefully I will post a step by step on how to use Xprint functions with the help of forum members, for everyone who are also starting to use xprint functions.
I have included the test program I have started in exploring xprint. I want to print a full page of text with 80 character acrosss, a full page of text with 135 characters across (condensed). And later figure out bitmap printing and print preview.
1. problem one is that the sample text gets chopped off at 65 characters for the 80 & 135 character across and the first character does not print (printing
starts at extreme left).
also noted that printing uses about 1/4 of the page, when I want the full width across with margins all around.
Code:
#COMPILE EXE #DIM ALL 'PRINT TEST 1 '1 setup printer to use print device, in program to use as default '2 determine to print 80 character across page or 135 characters in program GLOBAL hDlg AS LONG CALLBACK FUNCTION ENDPROG() DIALOG END hDlg, 1 DIALOG END CBHNDL, 15 END FUNCTION CALLBACK FUNCTION PRINT1 LOCAL linecount, w, h, w2, h2, x, y AS LONG, device,L1, L2, L3 AS STRING, nLEFT, nTop, nRight, nBottom AS SINGLE L1="This is your printer talking" L2="12345678901234567890123456789012345678901234567890123456789012345678901234567890" L3="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" ERRCLEAR 'XPRINT ATTACH "KODAK 5100 AiO" XPRINT ATTACH DEFAULT 'XPRINT ATTACH choose IF ERR = 0 AND LEN(XPRINT$) > 0 THEN 'device=XPRINT$ 'XPRINT GET LINES TO linecount& 'XPRINT GET MARGIN TO nLeft, nTop, nRight, nBottom 'MSGBOX device+"<device "+STR$(linecount)+"<linecount": 'MSGBOX STR$(nLEFT)+"<left "+ STR$(nTop)+"<top "+ STR$(nRight)+"<right "+ STR$(nBottom)+"<bottom" 'GOTO EXITT XPRINT GET CLIENT TO w, h ' get client size XPRINT TEXT SIZE L1 TO w2, h2 ' get text size x = (w-w2) / 2 ' centered x-pos y = (h-h2) / 2 ' centered y-pos MSGBOX STR$(w)+" "+STR$(h)+" "+STR$(w2)+" "+STR$(h2) XPRINT "" XPRINT SET POS (x, y) XPRINT L1 XPRINT L2 XPRINT L3 XPRINT FORMFEED ' Issue a formfeed EXITT: XPRINT CLOSE ' Deselect the printer END IF END FUNCTION FUNCTION PBMAIN () AS LONG LOCAL result AS LONG ': DIM SET1 AS SETUP1 DIALOG NEW 0, "PRINT TEST 1" ,,,400, 270, %WS_MINIMIZEBOX+%WS_SYSMENU, 0 TO hDlg CONTROL ADD LABEL, hDlg,200,"EASY Est",175, 55,100, 14, 0 CONTROL ADD BUTTON,hDlg,100,"&PRINT" ,155, 75, 90, 14, CALL PRINT1 CONTROL ADD BUTTON,hDlg,101,"&End Program" ,155,200, 90, 14, CALL ENDPROG CONTROL SET FOCUS hDlg, 101 DIALOG SHOW MODAL hDlg TO result END FUNCTION
Comment