Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
_gb2.pngCreate own software - Print with Gambas 2

PRINT WITH GAMBAS 2

 


 

 

printersample.png

Today, with this little application, we print text and rectangle to your printer.

1) How to work...
To print something to your printer, you have to use the same command than draw in a drawarea :

draw.begin(printer)
....Something to print
draw.end

2) To configure
to configure the thing to print, use the system printer windows with this command

printer.setup()

Here you find a screenshot of my linux system printer window configuration :

printer.png

Then you find now all command to print :

printer.abort
: cancel print
printer.black : print in black and white
printer.color : print in colors
printer.colormode :choose black and white or colors
printer.copies : numbers of copies to print
printer.file : print in a file
printer.frompage : print from this page
printer.height : height of the area to print
printer.landscape : print in landscape format
printer.maxpage: maximun pages to print
printer.minpage : minimun page to print
printer.name : printer name
printer.newpage : ?
printer.orientation : 0 or 1 landscape or paysage
printer.resolution : DPI resolution
printer.setup : open the printer windo configuration
printer.size: Size of area to print
printer.topage : last page to print
printer.width : with of area to print


Thanks for your attention here you find the source code of example

PRIVATE drawstate AS boolean = FALSE 'if true draw rectangle and print rectangle
PUBLIC SUB _new()
END
PUBLIC SUB form_OPEN()
END
PUBLIC SUB bquit_click()
me.CLOSE
END
PUBLIC SUB bconfig_click()
printer.setup()
END
PUBLIC SUB textarea1_keypress()
drawingarea1.clear()
draw.begin(drawingarea1)
texttoprint()
IF drawstate = TRUE THEN drawtoprint()
draw.END
END
PUBLIC SUB button1_click()
draw.begin(drawingarea1)
drawtoprint()
draw.END
END
PUBLIC SUB bprint_click()
draw.begin(printer)
texttoprint()
IF drawstate = TRUE THEN drawtoprint()
draw.END
END
PRIVATE SUB drawtoprint()
draw.rect(100, 100, 10, 10)
END
PRIVATE SUB texttoprint()
draw.text(textarea1.text, 3, 3)
END

Creation date : 08/03/2012 @ 10:57
Last update : 08/03/2012 @ 12:59
Category : Create own software
Page read 4590 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^