|
-
Jul 25th, 2006, 07:50 PM
#1
Thread Starter
Junior Member
Sending raw text straight to a printer
I posted this in the classic forum yesterday but it turns out I'm actually using .net, so you guys might be able to help...
I'm trying to write a program which reads in a plain text file, adds a line to the top of it and then sends it to the printer. This line is a set of controls which the printer knows what to do with and it sets up the layout etc. of the paper.
First of all, the file is being produced no problems and comes out exactly right. I have already sucessfully completed a Java version which runs and works perfectly, and they create identical files so I know that that's not the problem... so it must be somewhere in the sending.
So, starting from scratch, how do you print in VB given that you have a filename "myFilename".
Incidentally, the line that I have to add is as follows (escape is char27):
escape + "E" + escape + "&l1H" + escape + "&l26a1O" + escape + "9" + escape + "&l0l6d12e36F" + escape + "(s0p10H" + escape + "&a3L"
-
Jul 26th, 2006, 10:28 PM
#2
Thread Starter
Junior Member
Re: Sending raw text straight to a printer
-
Jul 26th, 2006, 10:42 PM
#3
Hyperactive Member
Re: Sending raw text straight to a printer
I printed a plain text file with the word "test" as the only contents. I sent this print command to a file as opposed to the printer, and this is the output (notice all the weird characters):
Code:
%-12345X@PJL SET PAGEPROTECT=OFF
@PJL SET QTY=1
@PJL SET RESOLUTION=600
@PJL ENTER LANGUAGE=PCL
E*t600R&u600D*r0F&l0o1E&l0S&l7H&l26a8c1E*p0x0Y*c0t5657x8177Y&l1X*b0M
*c16534D)s3556W H Ò Ò ä þ §Ò ÿ Lucida Console þg f PA
GT
„ € cvt CÔMŠ Œ ôfpgm.QÊ € gdir headÀÉ
* 6hhea$¾ Ø $hmtxŠVv¡ ü
hmaxp:÷ d prepÕJg „ þ ÿá ÿç ÿÛ">VÈí+Dþuþ\ Å Ò ” ¹P ¯ÿÿÿÿÿÿÿÿÈ ÞDBÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ‰ ¡ÿÿÿÿÿÿ Ê ÷4 * ¬ » ¨ º% £ Þ 2 ÷ –p { c¦äþØ ˆ(A ¥ : ¦ *i ´ + * \þ¹ | L o ~ ¹ ‡ ä « šD ÷(* JÚ A( ÷ ˆ ¨þPP Í i • x±,# ŠŠEPX!!EDY-,KRXED!!Y- @ YùÕ_<õ ©z ±n… þPÒP PþP Ó Ò šÒ Ò Ò Ò ÒíÒ ÷Ò 4Ò ØÒ Ò ÒÕÒYÒ ”Ò ¤Ò VÒÕÒ ÒÒÕÒ KÒ oÒ ¹Ò ¨Ò êÒ oÒÒ ¢Ò ÉÒ *Ò •ÒÕÒÕÒ VÒ VÒ VÒ ¤Ò JÒ Ò ¹Ò fÒ ‚Ò ØÒ ÷Ò MÒ ”Ò *Ò ÅÒ ªÒ ÞÒ ^Ò ”Ò >Ò äÒ >Ò ¸Ò ¤Ò Ò ™Ò Ò Ò Ò Ò cÒ¼Ò JÒ *Ò VÒ ÒrÒ ˆÒ *Ò £Ò Ò Ò ”Ò {Ò ¶Ò *Ò ”Ò ÕÒ *Ò ]Ò ¶Ò iÒ ³Ò oÒ4Ò »Ò ‚Ò °Ò >Ò Ò ]Ò UÒ ˆÒ êÒÒ ÒÒ VÒ Ò Ò fÒ ØÒ ”Ò >Ò ™Ò ˆÒ ˆÒ ˆÒ ˆÒ ˆÒ ˆÒ £Ò Ò Ò Ò Ò *Ò *Ò *Ò *Ò ¶Ò iÒ iÒ iÒ iÒ iÒ °Ò °Ò °Ò °Ò ÅÒˆÒ ÅÒ ûÒ ÙÒAÒ }Ò ¿Ò *Ò >Ò `ÒrÒÒ VÒ Ò >Ò Ò VÒ VÒ VÒ 2Ò ¶Ò ¬Ò 0Ò DÒ 8Ò íÒ íÒ ÞÒ 1Ò 1Ò iÒ ”ÒíÒ VÒ Ò 'Ò VÒ Ò uÒ ŒÒ kÒ Ò Ò Ò >Ò JÒ 1Ò ˆÒ >Ò ÷Ò ÷ÒÕÒÕÒ VÒ Ò UÒ Ò oÒ[Ò[Ò {Ò {Ò ÅÒAÒÕÒ ÷Ò Ò Ò ØÒ Ò ØÒ ØÒ *Ò *Ò *Ò *Ò >Ò >Ò >Ò ™Ò ™Ò ™Ò *ÒÒÒ(ÒÒúÒ´ÒïÒ@Ò¦ÒÒ Ò *Ò ¤Ò »Ò cÒ ˆÒÒ Ò pÒ Ò UÒ äÒ ³Ò VÒ LÒWÒ.Ò9Ò Ò Ò *Ò Ò MÒ {Ò *Ò ¤Ò »Ò fÒ £Ò fÒ £Ò Ò ÒÒ ÒíÒ Ò ˆÒ Ò ˆÒ Ò ˆÒ fÒ £Ò fÒ £Ò ‚Ò QÒ Ò ØÒ Ò ØÒ Ò ØÒ Ò ØÒ Ò ØÒ Ò MÒ {Ò MÒ {Ò MÒ {Ò ”Ò ¶Ò Ò "Ò *Ò *Ò *Ò *Ò *Ò *Ò *Ò *Ò 1Ò >Ò ÅÒ ”Ò ªÒ ÕÒ õÒ ÞÒ *Ò ÞÒ *Ò ÞÒ ”Ò ÞÒ *Ò ”Ò ¶Ò ”Ò ¶Ò ”Ò ¶Ò SÒ ”Ò ¶Ò >Ò iÒ >Ò iÒ >Ò iÒ ¸Ò4Ò ¸Ò%Ò ¸Ò4Ò ¤Ò »Ò ¤Ò »Ò Ò ‚Ò Ò ‚Ò Ò ‚Ò ™Ò °Ò ™Ò °Ò ™Ò °Ò ™Ò °Ò ™Ò °Ò ™Ò °Ò Ò Ò Ò UÒ cÒ ˆÒ cÒ ˆÒ ÿÒ Ò ˆÒ Ò 1Ò =Ò hÒÕÒÒ ÞÒ ÒíÒ Ò Ò Ò Ò Ò Ò sÒ Ò ¹Ò ÷Ò Ò ØÒ cÒ ”Ò >Ò *Ò ªÒ Ò ^Ò ”Ò >Ò >Ò ”Ò äÒ GÒ Ò Ò Ò Ò Ò 1Ò *Ò Ò ]Ò —Ò tÒ—Ò ³Ò ]Ò ÅÒ Ò {Ò —Ò Ò tÒ {Ò—Ò ÅÒ 6Ò ¶Ò +Ò Ò iÒ ³Ò …Ò >Ò 8Ò ³Ò 1Ò 2Ò ,Ò %Ò ÞÒ ³Ò iÒ ³Ò %Ò ØÒ Ò ÷Ò iÒ ¤Ò *Ò *Ò ÅÒ Ò oÒ Ò ÍÒ %Ò {Ò Ò ÒÒ ¹Ò ÷Ò Ò ØÒ Ò `Ò ”Ò ”Ò ÍÒ Ò ^Ò ”Ò >Ò ”Ò äÒ fÒ Ò %Ò Ò Ò xÒ ‘Ò JÒ JÒ Ò cÒ äÒ VÒ +Ò Ò ˆÒ {Ò »Ò ÷Ò 4Ò Ò Ò ¼Ò £Ò £Ò õÒ +Ò xÒ ³Ò iÒ ÅÒ ³Ò £Ò JÒ UÒ >Ò ]Ò *Ò {Ò JÒ JÒ +Ò cÒÒ ”Ò JÒ oÒ Ò "Ò ÷Ò šÒ »Ò *Ò *Ò ”Ò Ò \Ò "Ò õÒ UÒ ÅÒ ÷Ò ÷Ò Ò Ò Ò Ò Ò Ò Ò UÒ cÒ ÒÒ Ò ÒÒ ûÒ Ò >Ò Ò Ò Ò Ò VÒAÒ VÒAÒ VÒAÒAÒ VÒ VÒ VÒ ˆÒ VÒÒ ¹Ò ÒÒÒ ÒÒ ÒÒ Ò Ò Ò Ò Ò‹ÒÒ‹Ò‹Ò Ò Ò ÒÒ‹Ò‹Ò Ò Ò ÒÒ‹Ò‹Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò ÒiÒ Ò Ò Ò JÒ JÒ 8Ò 8Ò 8Ò 8Ò >Ò Ò Ò >Ò >Ò =Ò {Ò Ò Ò Ò Ò Ò XÒ ÒÒÒMÒÒ°ÒÒ;ÒÒ~Ò~ÒÒ ªÒ ÕÒ ÞÒ *Ò ”Ò ¶Ò ¸Ò4Ò ¤Ò »Ò Ò ‚Ó š x E – Ó! @F
dZL#?##
#
/
%/ < //cbZ][à^xàx[TM*=¸ @;<ð;:àSQD*rÒb`_àX`VàTà>à:´7à23¸ @3‚àà¸@@žpp€oŸ2¹ÿ KSX°°ŽY…KSX°€Yss+++++++++++++++++++ ++++++++++++++++++++ ÿÿ ’(s12H(16534X&d@*c32E(s122W t 8 ™ÿá9 /@FV KSX°FvYÖ]íÜý ?ý?Ä]10332653!"™Å˜†¬9yþêñçüõÌ··Ñýñiß u*c33E(s138W „ Q ¶ "V G@%t„@`
< J Ï Ð KSX°EvYÖ]ýÄvÜý ?Ä?ý?ØÈ]103363 #4&#"¶Åˆê5ÅO]”¢>Ìäþ‘ý±kÕý: *c34E(s148W Ž W ‚ÿçN >@ /??
KSX°EvYÖÌ<ý<ÜÄ ?ý??<ý<]10%#"&5!5!53!!327N”Šñ®þñÆáþ&D‚{y*ñ”êê”ýÔ]F- ‡*c35E(s92W V L * + &@89 8
Þ]ÌýÔý ??ý?ý10!!5!538þuPÞ÷ª”ûÂ4÷÷ ¤*c36E(s70W @ O * + @ Ü]Ìý ??ý10!!5!Pþ]i—”ùÕ õ*c37E(s180W ® H ÿçJV N@+–
G
%
6
E
U
z€
KSX°FvYÖíÜýÄ9] ?ý?ý9v/ý10]%# 4 32!!27!5#"JÍ«þèþÓ!ßáÕýxŸ¾ýõv“+D ýFþòþã?þL¹&ª ¤*c38E(s158W ˜ G ÿç5+ A@)D =EU Ö]í]Ü<<ý ?ý??ý?ÐÀ]10!5#"5323&#"327pÔ¸Õü̯zÅÅŠ„‚å§“ÌåöM”iùÕ.”äÏþÐ ±*c1G*c20W XXÿÿÿÿÿÿÿÿ*c1G*v4T*p580Y*p2160X !"#"$%&*c16534D*c39E(s216W Ò V »ÿçV o@A
J Z euŠ …
ˆ > >!KSX°DvYÖíÄÜýÄ9999] ?ý?ý99999]107532654/&54632&#"#"»å§x»Ó÷ßÌ™Êál“ùˆwþÖ»,²caJ_<EPÊ”¢/*;NBQ3W0…jš· €*p663Y*p352X"%'"*c16534D*c40E(s144W Š 3 ä … B@%6EYiy‹
KSX°CvYÖýÄÜý ??ý9/ý10]3!2!#3 4&+ä¡ß_ÂþÇþí{—°Ä(TðÊæþ{vf ¡*c41E(s214W Ð D ˆÿížV ( V@7( 80@zŠ™
J""
'iy $G)vÖÄíÜÀÄýÜ] ?íÔü?ý9/vÝ]10%#"&54$;54&#"5632327#"# 32C³²•Á,özfv«·Ò¸Ï«*:+c3’R;þkhVƒ–ª‚©Î]sb`©K¤Éþ9bG
v ÛO` ¬*c42E(s204W Æ J {þ\6W $ N@5–E #=LE XU es %Ö]ÌíÜÄÄÀý] ?ý?ý??ý]10]73 7#"53253!"&#"32Ô±˜< |ëºÛþËŸš¹8M{þúšÛ…Ž~q¯þ•¦K-ÄáðG•|ü›ÓÕRƒ%«–àÊ«Á g*c43E(s10W ù*c44E(s104W b ¹ ”í 4@U
KSX°EvYÖÜ<ýÜ ??ý<ÀÐÀ]1035!5%!¹‹þuP‹”Yz¹ú§” ’*p6330Y*p2210X()*%+,*v0o0TE%-12345X
Unless there's something I'm missing, you can't send the text directly to the printer... I think you would need to use an interface that would be provided in the windows API somewhere, but I'm not sure what or where... Hope that gets you started
-
Jul 27th, 2006, 07:40 PM
#4
Thread Starter
Junior Member
Re: Sending raw text straight to a printer
This is all I had to do for Java for what it's worth...
Code:
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
DocPrintJob jorb = service.createPrintJob();
FileInputStream stream = new FileInputStream(f);
Doc doc = new SimpleDoc(stream, flavor, new HashDocAttributeSet());
jorb.print(doc, new HashPrintRequestAttributeSet());
-
Jul 28th, 2006, 12:48 PM
#5
Addicted Member
Re: Sending raw text straight to a printer
Please see the following link (thread started by me in the forume and gurus helped me)
http://www.vbforums.com/showthread.php?t=401045
I am also using escape codes for DotMatrix Printer and it is working fine.
all the best
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|