New topic: Printing from RB
<http://forums.realsoftware.com/viewtopic.php?t=34248> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message John C Post subject: Printing from RBPosted: Sat Jun 12, 2010 12:19 am Joined: Mon May 24, 2010 9:55 pm Posts: 12 Location: Shellharbour NSW, Australia Hi Folks, I am trying to output to a printer from my RB project (2010 r2) and am just getting more confused as time goes by (2 days so far). This should be really simple, it is one page and the data is from variables within the program and static text. There is no database access required. I have added a report to the project and can set out all I need on that with no header or footer. From there everything seems to get complicated with "ReportViewer" Canvases, Graphics etc. At one stage I managed to send one line of text to the printer but it was so small I almost missed it, when I tried to use "TextSize" the whole thing crashed and by then I had forgotten how I got there in the first place. Is there a simple way to print one sheet of paper without going through all of this. I have downloaded a few tutorials which only confused me further, most have all of the commands buried in variables spread out all over the project which make it more difficult. Ideally, I would like to program a "Print" button and have it bring up the print dialog box and go from there. Thanks in advance, John. Top jefftullin Post subject: Re: Printing from RBPosted: Sat Jun 12, 2010 1:11 am Joined: Wed Nov 15, 2006 3:50 pm Posts: 1650 Location: England Quote:variables within the program and static text. There is no database access required. It doesnt sound like a typical job for a report. If you Code:dim g as graphics g = OpenPrinter G will hold an initialised graphic object for the current printer. (You can do things about the resolution, but let's keep things simple for the minute) So if you have a window or canvas on screen, it has a graphics property exposed in the Paint event. You can ask G how wide or tall it is, and you can draw lines, text, rectangles etc on it. Thats pretty much how all the stuff you see on screen happens. The graphics you get back from the printer is the same animal. Its just not visible until it prints. So taking your G Code:g.textfont = 'Arial' g.textsize = 24 g.drawstring "Hello Printer",100,100 When you call g.nextpage (if there is one) or G goes out of scope (at the end of your method), the page will print. A good search on the forum will run up lots of discussions about printing and resolutions, margins etc. _________________ RB2009 R5.1 and RB2008 Mac 10.6 + Windows 7/XP + Ubuntu Linux in Vmware on a Macbook 2.16 Top John C Post subject: Re: Printing from RBPosted: Sat Jun 12, 2010 2:16 am Joined: Mon May 24, 2010 9:55 pm Posts: 12 Location: Shellharbour NSW, Australia Thanks, I will try that in the morning. John. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
