Dear visitor, welcome to Jabaco - Community.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Printing RTF
Hi everbody,
Here is how to show print dialog:
|
Source code
|
1
2
|
Dim p As java#awt#print#PrinterJob = java#awt#print#PrinterJob.getPrinterJob
p.printDialog
|
But how to print a file?
Thanks,
klctal
This post has been edited 1 times, last edit by "klctal" (Jul 27th 2009, 2:55am)
I've found out something but never tested it:
|
Source code
|
1
2
3
4
5
6
7
8
9
|
Import java.awt.*
Import java.awt.event.*
Import javax.swing.*
Import java.awt.print.*
Public Sub PrintDoc(RTB As RichTextBox)
Dim G As Graphics
G.drawString(RTB.Text,100,100)
RTB.Parent.print(G)
End Sub
|
I found it over here:
http://java.sun.com/docs/books/tutorial/…rldPrinter.java
I've found a way to print text without formating:
|
Source code
|
1
2
|
Public Sub Printtxt
Dim File As vbFileHandler = Open("TempFile.txt") Write(File,RichTextBox1.Text) Dim D As Desktop = Desktop.getDesktop D.print(New file("TempFile.txt"))End Sub
|
It saves a txt file then prints the txt file out.
Well, that's my best idea.
klctal
This post has been edited 2 times, last edit by "klctal" (Aug 7th 2009, 4:50am)
I found out a more buggier way:
|
Jabaco Source
|
1
2
3
4
5
|
Public Sub Print
Dim print As PrintRequestAttributeSet
Dim printer As PrinterJob
printer.print(print)
End Sub
|
When you continuly click continue(a jabaco expection occurs) it works!