Hi
Need to print in vb 6.0
Printable View
Hi
Need to print in vb 6.0
You need to look at the 'printer' object for methods and properties
printer.enddoc has to be called after you have done all your 'printing' to actually send everything to the printer.
ei one thing, do you want to print the form or you want to print records from database?
do you want print simple form with text only? or form with lines and circles or graphics?
can any one help which is the best way to print in above cases?
VB Code:
Printer.print "This is a test" Printer.EndDoc
Thats all there is to it!
PRINTER.PRINT
print "bob"
print "cox"
print "ok"
print "dos"
print "god"
PRINTER.ENDDOC
For some wierd reason, even if i use
VB Code:
printer.enddoc
It still wont print the text until my program ends :s
That is odd. As soon as I send EndDoc, the queue starts filling up.
How about in the IDE? Does it print immediately?
Change your code to this and tell us what happens.Quote:
Originally Posted by boku
VB Code:
MsgBox "About to ENDDOC" Printer.EndDoc MsgBox "Just did the ENDDOC"
You can get stuff out using what others have posted, but if you are looking for formal, stylized reports, you would need to incorporate a report engine into your project. The best 'free' type of report generator would be creating your reports in Access and calling them from your VB code. If you are working with a budget, then look into something like Report Writer or Crystal Reports.Quote:
Originally Posted by dos5731
Or On a budget of zero pounds. Invest some time with this little baby....
http://www.qbdsoftware.co.uk/moth/qp...qprinter20.htm
Not too shabby.
don't forget
printer.currentx
printer.currenty
printer.print ""
printer.enddoc
:thumb: I'd never heard of the "DonationWare" qPrinter product. This looks interesting...thanks for the link. :)Quote:
Originally Posted by David.Poundall
I used the earlier version on a commercial app and it was superb for doing reports. It comes with a handy print preview function a sstandard.
Edward Moth has rewritten the program from the ground up and now it enjoys easier table creation. I have yet to use this new version but I am looking forward to it as the template function looks a lote easier than before. The documantation is also very well put together.
Another print dll I have come across in the past, and tested, is this one.
CSPrintengine
I briefly considered it but decided at the end of the day to go with the one I knew more about. It looks a lot easier to use than qPrinter and the full version only costs $5.
When I tried this link, I got a "Page Could Not Be Displayed" :confused:Quote:
Originally Posted by David.Poundall
http://www.consiliumsoft.com/Quote:
When I tried this link, I got a "Page Could Not Be Displayed"
We found Crystal to be too cumbersome and too limited in ability.
We choose to develop our own report writer engine - it's actually a very simple task. We store "print objects" in a SQL table and loop through our data recordset and loop through the "print objects" and user .CURRENTX and .CURRENTY to produce extremely high quality reports.
Whenever a new twist comes down the pike, we simply enhance our report writer engine - it's extremely simple.
Last twist was to print the PO # on a purchase order vertically down the right side.
Sorry Guys I fixed the link - as I had saved it to hard disk it was referencing my E-Drive. It's OK now - here it the correct link as I am here.
http://www.topshareware.com/CSPrinti...load-11486.htm
Hi szlamany. Do you use a rich text box or a PictureBox for your reports. In either case how do you handle page breaks and word wrap?
We output directly to the PRINTER object.Quote:
Originally Posted by David.Poundall
We have options to output also to a PICTURE BOX - but for the most part we ignore print-preview and have our users install FULL ADOBE, so they get the PDF print driver.
We make extensive use of .TEXTWIDTH to measure items - so we can "right-fill" our numeric values - so decimal places line up.
We always print with ";" at the end of the line, so we are fully in control of the vertical movement down a page.
It's so nice to be able to do things like: Print the ADDRESS on the bottom of the check first, then go back up to the top to output the stub info; Print multi-column reports; Print quandrant type output (student transcripts); handle all the extremely odd total/break conditions that financial systems can throw at you.
Here's a list of the "print objects" we support - plus there are lots of variations on these as well.
Code:' 1 Font
' 2 Fontsize
' 3 FontBold=True
' 4 FontBold=False
' 5 FontItalic=True
' 6 FontItalic=False
' 7 Forecolor
' 10 Portrait
' 11 Landscape
' 12 Duplex (horizontal)
' 13 Paperpin
' 14 Papersize
' 20 Skip to line
' 21 Skip to next line
' 22 Header Control
' 23 Skip to right
' 24 Eject page
' 25 Break column
' 26 Specific column
' 27 Skip back to prior line
' 30 Date
' 31 Draw line
' 32 Draw left/right edge lines
' 33 Page
' 34 Query line
' 35 JPG
' 40 Item with CR
' 41 Item without CR
' 50 Column with CR
' 51 Column without CR
' 52 Column (first-name-first) with CR
' 53 Column (if-not-blank) with CR
' 54 Column (numeric) with CR
' 55 Column (numeric) without CR
' 56 Column (numeric-nz) with CR
' 57 Column (numeric-nz) without CR
' 58 Total with CR
' 60 Paragraph
' 61 Paragraph (next 255 characters of text)
' 62 Load Key Column Data
' 63 Dump Key Column Data
' 64 Clear Key Column Data
' 70 If
' 71 End if
' 72 If-Break Area
' 73 End if-Break Area
' 74 Sub-Heading
' 75 End Sub-Heading
' 80 Sub report
' 81 End Sub report
' 82 Sub report RS loop start
' 83 Sub report RS loop end
' 100 Output column to text file
There is a lot if IP there - nice. Thanks for the pointer. If I have time I may give that a go.
I saw the post where you list some of the printer objects you store, and how you use them. Is what you are doing properity to your company?Quote:
Originally Posted by szlamany
I ask because if it is not, I think it would be very cool if you put together a little demo of how your 'print engine' works, and placed it in the Code Bank or Utility section. If you wouldn't be violating any copywrites, I think an example of this would be extremely beneficial to folks that don't have access to a report generator, and who don't have the existing skill set to create their own.
Just a thought...
Unfortunately it is proprietary - so I cannot put it on the code bank.
I have no problem sharing my concepts with those that ask.
Maybe in a year or so we will be marketing it outside the realm of our own applications.
We could do the Classic VB programmers a big favor, if we did something along the lines of what you suggested.Quote:
it would be very cool ......., and placed it in the Code Bank or Utility section........, I think an example of this would be extremely beneficial to folks that don't have access to a report generator, and who don't have the existing skill set to create their own.
It may very end up not being a single solution, but rather a set of a few solutions. If we find free (or dirt cheap) solutions along the lines of David's suggestions, then they may be part of our set.
If anyone is interested in furthering this, I think the first task is 'to clearly identify the problem' (the needs).
Can I start the ball rolling -
Some of the solutions may be code, and some be controls(if we can't get the source)
Any solutions must be free or extremely cheap.
They must not be complicated to install/distribute.
They must be reasonable easy to use ( or prior users be prepared to share the results of their learning curve)
etc
To illustrate why I think more than one solution may be required, we should cater for -
Print preview, as I don't wish to re-visit the days of printing off 10's of pages whilst trying to get the layout just right.
Normal reports (which can run to many pages).
Portrait and Landscape.
Embedded graphics.
Print Grid(s)
Print Form would be nice. This may be either a means to print the image on the screen, or something like what I use, which 'reads' the Form, and 'scrapes' the text, and box outlines etc. ('Hi Res' from Rod Stephens 'Graphics Programming' book).
I'm happy to let it throw to the default printer, but some of you may wish more control ?
Wouldn't it be ironic, that whilst 'Kill Bill' is trying to bury VB6, we provided the 'Holy Grail' that VB'ers have been searching for, for years.