| | |
Documents
![]() |
•
•
Join Date: Jun 2004
Posts: 609
Reputation:
Solved Threads: 8
Hi everyone,
I have two weird questions but bear with me for a while.
The first question is about the printing of a styled document using the printable interface. i am using windows 98 and using the windows page format and print dialog. I have managed to print all the contents of the document using the windows print dialog but when i try to print a selected portion of the styled document(windows print dialog has an option of printing selected pages) always only the first page is printed.
This is what i did in my print method
RTFRenderer is an external class where i implemented the printable interface
My next question is about the html document i have in a JTextPane and its printing functionality works on all java sdks(ie.1.1 - 1.4.2)
but when i compile my program under java sdk 1.5 update 1 only the text is printed but all the images are not printed but this is not the case on the other java sdks(ie.1.1 - 1.4.2). I find this rather weird.
I was thinking i was doing something wrong in both my questions so i downloaded a third party package called Document Renderer at www.fawcette.com but still had the same results.
I also went to manning website(www.manning.com) where they had a swing book with a chapter(Chapter22) on printing and i used the examples there to do the printing but i still got the same results.
Has anyone ever encountered this before. Could anyone point me to a tutorial or an open source package in which i can print the contents of the JTextPane if it contains either a styled document or HTML document.
I also went to sun's website and could not find out if both my problems is a bug or not and i hope someone can help me with this problem. Please note that no exceptions were thrown in both my problems.
Any help is greatly appreciated
Yours Sincerely
Richard West
I have two weird questions but bear with me for a while.
The first question is about the printing of a styled document using the printable interface. i am using windows 98 and using the windows page format and print dialog. I have managed to print all the contents of the document using the windows print dialog but when i try to print a selected portion of the styled document(windows print dialog has an option of printing selected pages) always only the first page is printed.
This is what i did in my print method
Java Syntax (Toggle Plain Text)
public void printData() { //This is the main printing function that prints out the document try { PrinterJob prnJob = PrinterJob.getPrinterJob(); PageFormat format = prnJob.pageDialog(prnJob.defaultPage()); prnJob.setPrintable(new RTFRenderer(), format); if (prnJob.printDialog() == false) { return; } //The below command line prints out the document if the user clicked Ok prnJob.print( ); } catch (PrinterException e) { e.printStackTrace(); System.out.println("An error has occured"); } }
RTFRenderer is an external class where i implemented the printable interface
My next question is about the html document i have in a JTextPane and its printing functionality works on all java sdks(ie.1.1 - 1.4.2)
but when i compile my program under java sdk 1.5 update 1 only the text is printed but all the images are not printed but this is not the case on the other java sdks(ie.1.1 - 1.4.2). I find this rather weird.
I was thinking i was doing something wrong in both my questions so i downloaded a third party package called Document Renderer at www.fawcette.com but still had the same results.
I also went to manning website(www.manning.com) where they had a swing book with a chapter(Chapter22) on printing and i used the examples there to do the printing but i still got the same results.
Has anyone ever encountered this before. Could anyone point me to a tutorial or an open source package in which i can print the contents of the JTextPane if it contains either a styled document or HTML document.
I also went to sun's website and could not find out if both my problems is a bug or not and i hope someone can help me with this problem. Please note that no exceptions were thrown in both my problems.
Any help is greatly appreciated
Yours Sincerely
Richard West
![]() |
Similar Threads
- Unable to access my computer, my documents, and control from start bar and run!! (Windows NT / 2000 / XP)
- can only open my documents after connecting to internet (Web Browsers)
- Remove Record of Recently Used Documents (Windows tips 'n' tweaks)
- my computer, my documents, etc.. folders do not open (Windows NT / 2000 / XP)
- MY Documents (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: message applet failed
- Next Thread: altering a link
| Thread Tools | Search this Thread |
-xlint add android api applet application applications array arrays automation bank bi binary blackberry bluetooth chat class client code compile compiler component database development digit eclipse equation error event fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list login loop main map method methods mobile myregfun netbeans newbie nonstatic notdisplaying pearl problem program programming project qt recursion scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver string superclass swing system text-file thread threads tree variablebinding windows xor






