473,842 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to avoid paper ejection after printer.enddoc

8 New Member
Hi buddies,

I am doing a project in vb6 for a restaurant. They are using continous paper roll of 5" width for billing. They need multi language printing. I tried it with Crystal report and even using printer.print command. As the bill is not having default size, i couldnt set a predefined paper size. When i give printer.enddoc the dotmatrix printer ejects enormous paper. I had searched many sites regarding this. Oops! no use.
Plese my buddies help me to make it succeed.

note: my competetor suceeded on this in various projects
Aug 12 '10 #1
16 9935
Guido Geurs
767 Recognized Expert Contributor
What type of printer is it?
Is it possible to find details of the codes that can be send to it?
I know that on my old-old-old printer (9 pins Star NL-10) it was possible to send control codes for the page length like = [ESC] "C" chr$(0) n .
Sets page length to n inches.
Aug 12 '10 #2
gevanand
8 New Member
dear ggeu
its dotmatrix printer and you cant use escape sequence hence its printer.print command
thanks for try
Aug 12 '10 #3
Guido Geurs
767 Recognized Expert Contributor
I have found this in: http://www.bigresource.com

I don't think you can use the PRINTER object.

Try opening the PRINTER as a file - with something like OPEN 'LPT1:' AS FILE...

Then do PRINT #1,CHR$(7)

I've never tried this on a PC with VB - but that is the way we talked to old-style printers on mainframes.
Aug 12 '10 #4
gevanand
8 New Member
Dear ggeu
print # command wont support change of font
because its DOS style Printing
I tried it also.
Thank you again for follow-up

I tried with bigresource also nobody found a best solution for this.

Upto my knowledge, whomsoever going to tell the solution for this, will be the first person on net.
Aug 12 '10 #5
Guido Geurs
767 Recognized Expert Contributor
Do you know the ASCII code for "End of page" for your printer?
Once we know this, the only problem is the way how we must talk to the printer.

some say: (http://www.xtremevbtalk.com)

Well, the "best" way to do this, is to use s.c. Escape characters (defined in the printers manual) and send them to the printer directly. This means, if the printer is attached via LPT port, you send commands to it just like you would print to the plain text file. Something like this:
Code:
Open "LPT1" For Output As ...
Print #1, "Hello!"
Print #1, Chr$(10) 'line feed
Close #1
and if your printer is on COM port, You'd use MSCOMM component to output those same commands.

As I said, those commands are usualy listed in the printers manual.
Aug 12 '10 #6
gevanand
8 New Member
Hi ggeu
I am extremely happy with your intention on my query.
But I like to inform you that I need different fonts of different columns. Your code I think, wont supports Windows fonts. Please keep in touch on this.
Aug 12 '10 #7
Guido Geurs
767 Recognized Expert Contributor
Are you using a form print ?
I have used this for a print in a game.

Expand|Select|Wrap|Line Numbers
  1. '§ Send a PRINTSCREEN-Window to the printer
  2. Private Sub Com_print_Click()
  3. '§1 Save Print Screen Window in Clipboard
  4.    On Error GoTo Print_Error
  5.    Clipboard.Clear
  6. '§ call the Windows keybd_event sub, passing the built-in
  7. '§ VB keyboard constant vbKeySnapshot (44) to the sub and 1& for the window catch.
  8.    keybd_event vbKeySnapshot, 1&, 0&, 0&
  9. '§ pause to let Windows update the clipboard
  10.    DoEvents
  11. '§2 retrieve the clipboard bitmap to the Picture
  12.   With Picture_print
  13.       .Picture = Clipboard.GetData(vbCFBitmap)
  14. '§3 Wake up printer
  15.       Printer.Print
  16. '§ print
  17.       Printer.PaintPicture .Picture, 1000, 1000
  18. '§ close printer
  19.       Printer.EndDoc
  20.    End With
  21. Exit Sub
  22. Print_Error:
  23.    If Err.Number Then MsgBox Err.Description, vbOKOnly, "Printer Error!"
  24. End Sub
it's also using Printer.Enddoc !!! but it sets the picture size.

You can change the form size depending on the lines to print !

Or is it the command "printer.enddoc " that is misunderstand by the printer.
If so, do you have the right printerdriver for Windows xx ?
Aug 12 '10 #8
gevanand
8 New Member
any how i got a solution
With Win98 printer.print works well.
I donna know why its not with windows xp
Aug 13 '10 #9
Guido Geurs
767 Recognized Expert Contributor
Maybe the version of the printerdriver (not compatible with XP) ???
Aug 13 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
22324
by: Patrick Herb | last post by:
Hello, I'm trying to print the content of a RichTextBox from my VB 6 app. What I want is that the CommonDialog shows up, the user selects a printer and the content of the RichTextBox prints to the selected printer. I'm not concerned about the text format. What I tried is something like this CommonDialog1.ShowPrinter
4
9706
by: Lizard King | last post by:
Hi. I have a computer running a third party software (POS). The thing is this application opens the printer port and I need to use another program while the first one is still running. Since the other app has the printer port windows shows an error (path/file access error). Is there a way that two applications can share the printer port?
5
2036
by: Tom Berry | last post by:
We currently are trying our first transformation from VB6 to VB.Net. Of course, the Printer object is gone, but I'm having trouble finding the replacement syntax necessary to perform similar actions or set variables. We are interested in doing this inline (no pop-up dialog box). Specifically, where how would I replace the following properties/methods of the old Printer objects. Printer.NewPage Printer.TextHeight Printer.TextWidth
2
3200
by: Daniel Iwan | last post by:
Hello everyone! I have a problem with using TCanvas Printer and network printer HP LaserJet It print just first page and throws blank all the rest. WinNT with Borland Builder 5. All works fine with my HP 3820 with USB printer (WinXP)
13
21719
by: Susan Beebe | last post by:
I have downloaded the code described in Microsoft article Q154078. I am trying to send raw ZPL (zebra barcode printer) code from Microsoft access. It works just fine if I hard code the actual data in the string being sent to the printer. However, if I prompt the user for data or if I insert data from a particular record/field in a form Access crashes/closes on its own. I have included the code below, if anyone has any suggestions,...
1
4361
by: anilkumarkp | last post by:
Hai I have to print a receipt in pre-printer stationary with bar code, My paper size is 4", i have set the paers size as Printer.ScaleMode = 1 ' vbTwips Printer.Height = 4 * 1440 Printer.width = 8 * 1440 but after priting this, when i put Printer.EndDoc, it is skiping the all 12" paper, in this 12" i have to print 3 receipt (4x3). If i have not used the Printer.EndDoc it is not going to the spooler,
2
5789
by: cjreynolds | last post by:
Please excuse my cluelessness on the subject - this is the first time I've worked with printing in VB (and it may be the last) and the more I work with it, the more confused I become... First, I'm setting the printer's scale and the X,Y position of the output: Sub SetLargePrinterScale(obj As Object, VertPosition As Single) Dim Owid As Single Dim Ohgt As Single Dim Pwid As Single Dim Phgt As Single Dim Xmid As Single
0
1154
by: shanavaspi | last post by:
Hi guys am using printer object to print Printer.print "Text" Printer.enddoc After the end doc the paper jumps to next page Hoe i stop paper scrolling Can any body Help me
23
11471
by: Al Grant | last post by:
I have a 'printable' button to generate printable output and want this to use A3 if available, irrespective of the user's default printer setting. Is there any way to set a page's preferred printed paper size from HTML? Portable if possible, but IE-only would be better than nothing.
0
9876
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10618
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10320
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9459
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7862
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5699
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4506
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4096
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3148
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.