Printing RTF files from Java

Hello,
I need to print RTF files from a java program. I am reading RTF files in my program and after modification need to send them to a network printer for printing.
Please let me know if there are any tutorials/books available on this.
Thank you very much,
Regards,
Vaishali

check these urls. may help u some extent.
http://java.sun.com/docs/books/tutorial/2d/printing/index.html
http://www.javaworld.com/javaworld/jw-03-2001/jw-0302-print.html
http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html

Similar Messages

  • Printing RTF files in Java

    Hi,
    I have a java application (No GUI) that needs to print an RTF file. Could any one provide me links to tutorial/sample codes for doing this?
    Thanks a lot,
    Vaishali

    Look at http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/default_pf.aspx. They provide an utility class which basically lets you do this in 1 line, by creating a JEditorPane with your document and passing it to a method there.

  • How to print PDF file from java application?

    Hi,
    I have a java application that needs to print an PDF files. Could any one provide me links to tutorial/sample codes for doing this?

    http://onesearch.sun.com/search/onesearch/index.jsp?qt=print+pdf+files&subCat=&site=dev&qp=&chooseCat=javaall&col=developer-forums

  • I want to print .ps file from java

    Hello
    i want to print .ps file using javax.print api and this give following error
    sun.print.PrintJobFlavorException: invalid flavor
    and my code is as below
    public PrintPS() {
              /* Construct the print request specification.
              * The print data is Postscript which will be
              * supplied as a stream. The media size
              * required is A4, and 2 copies are to be printed
              //DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
              DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
              PrintRequestAttributeSet aset =
                   new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              aset.add(new Copies(2));
              aset.add(Sides.TWO_SIDED_LONG_EDGE);
              aset.add(Finishings.STAPLE);
              System.out.println("HI");
              /* locate a print service that can handle it */
              PrintService pservices =
                   PrintServiceLookup.lookupDefaultPrintService();
              System.out.println("Hello "+pservices);
              DocFlavor[] flavors = pservices.getSupportedDocFlavors();
              for (int i = 0; i < flavors.length; i++) {
              System.out.println(flavors.getRepresentationClassName());
         /*     if (pservices.length > 0) {*/
                   System.out.println("selected printer " + pservices.getName());
                   /* create a print job for the chosen service */
                   DocPrintJob pj = pservices.createPrintJob();
                   try {
                        * Create a Doc object to hold the print data.
                        * Since the data is postscript located in a disk file,
                        * an input stream needs to be obtained
                        * BasicDoc is a useful implementation that will if requested
                        * close the stream when printing is completed.
                        FileInputStream fis = new FileInputStream("hexagon.ps");
                        Doc doc = new SimpleDoc(fis, flavor, null);
                        /* print the doc as specified */
                        pj.print(doc, aset);
                        * Do not explicitly call System.exit() when print returns.
                        * Printing can be asynchronous so may be executing in a
                        * separate thread.
                        * If you want to explicitly exit the VM, use a print job
                        * listener to be notified when it is safe to do so.
                   } catch (IOException ie) {
                        System.err.println(ie);
                   } catch (PrintException e) {
                        System.err.println(e);
    plz help me

    1. Turn the router, iPad and printer off.
    2. Turn on the router and then wait 30 seconds to let it complete its start-up process.
    3. Turn on printer and then wait 30 seconds to let it complete its start-up process.
    4. Turn on your iPad and test print.

  • Viewing and printing a PDF file from Java Swing Application

    Hello,
    I need to view and print PDF files from Java Swing Application.How do I do that?I appreciate your help.
    Thank you
    Sumana Somareddy

    If you have a link to the URL pointing to the PDF file, you can allow the browser to open it. Then use the print function of the browser to print the PDF document.
    Regards,
    Tak.

  • Print RTF file within app

    Hi
    Is it possible to print an rtf file from within java app without actually viewing the file on screen? I don`t want to display the file in a jtextpane or jeditorpane. Simply want to print the file like you can with a straight text file.
    Or, is there are a command line switch to print a rtf file? through ms word?
    Any help would be appreciated.
    Thanks
    Kelly

    printing RTF files from java is amazingly hard. if not impossible.
    (just what you wanted to hear)
    basically, rtf support in java is pathetic.
    in my case, i had to create an actual RTF file in ms word and save it.
    i then opened it in notepad so that i could see all the control codes.
    then i cut and pasted each section of the document template so that each bit was a string constant in java. the bits that i wanted to add i generated in code the normal way.
    then i stuck all the bits back together again in one string and sent that off to a data stream. (to answer your question, it never went to the screen, just to the data stream)
    its a bloody stupid way of doing rtf, but it was the only way to get it to work without having to go through and figure and implement out all the rtf codes yourself.

  • Printing problem with RTF file in java

    Hi,
    i actually got code to print the RTF doc using java, it works fine if we give small content (some text), but throws error 'java.io.ioException: Too many close-groups in RTF " when actual bill content is pass.
    Thanks in advance

    Can you please share the code to print the RTF file using java API

  • Creation of .RTF file in java

    Hi,
    I want to create/edit .RTF file through java application. In my RTF file, I should be able to edit data(formatting), inserting tables. This is already done. Now I want to create chart (like pie-chart) using java. I searched the net for the last couple of days but I couldn't get the proper help. I can do that in SWING but its of no use.
    can anyone help me in this?
    Thanks & Regards,
    mrP

    Hi,
    Can someone please point me in the right direction? I'm trying to create an RTF file from data in a database, so I have no need to use JTextPanel or any GUI components. I've been trying to use the RTFEditorkit with a DefaultStyledDocument, but can only manage to insert one line into the document(!) Does anyone have any suggestions or examples that would explain how to do this?
    Any ideas would be appreciated.
    Thanks in advance,
    Gillian

  • Can't print pdf files from my imac

    can't print pdf files from my imac.

    macs don't come with acrobat reader by default
    when one get a mac and open a pdf file the build in program called preview opens it
    most of us stick with preview because acrobat reader is a rather dangerous program to install
    http://www.cvedetails.com/vulnerability-list/vendor_id-53/product_id-497/cvsssco remin-6/cvssscoremax-6.99/Adobe-Acrobat-Reader.html
    more
    https://www.google.com/search?sourceid=opera-portal&q=acrobat+reader+exploits&cl ient=opera-portal&channel=portal#hl=en&client=opera-portal&hs=lqn&channel=portal &sclient=psy-ab&q=list+of+acrobat+reader+exploits&oq=list+of+acrobat+reader+expl oits&gs_l=serp.3...8463.9471.0.9773.8.7.0.0.0.1.162.508.6j1.7.0.les%3B..0.0...1c .1.5.psy-ab.4Tc73RiiXXA&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&bvm=bv.43148975,d .bGE&fp=cab576d3b9062d9c&biw=1825&bih=748
    after adobe flash and oracle Java the adobe acrobat reader is the most open door for hackers into ones system
    if you type preview in spotlight(the icon which looks like a spyglass) or in the launch's seach you can get to the preview app

  • How can i call forpro prg file from java

    Hai friends,
    I have a doubt,clear it.
    how can i call forpro prg file from java file
    by,
    N.Vijay

    Thanks to your reply,
    I have some print statements in my foxpro program file.
    Then i like to invoke that foxpro file from my java file
    This want i want..,
    by,
    N.Vijay

  • Generation of xml file from java code

    hi,
    I want to manipulate data in a xml file with java code.I have read data from xml file and also changed it. But i am unable to covert it again in xml file from java code. Can you please tell me how i can do this?

    Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html

  • Executing batch file from Java stored procedure hang

    Dears,
    I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
    public static String runFile(String drive)
    String result = "";
    String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
    try {
    File directory = new File(drive + ":");
    File file = File.createTempFile("bb1", ".bat", directory);
    file.deleteOnExit();
    FileWriter fw = new java.io.FileWriter(file);
    fw.write(content);
    fw.close();
    // The next line is the command causing the problem
    Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null)
    result += line;
    input.close();
    file.delete();
    result = result.substring( result.lastIndexOf( ' ' )).trim();
    } catch (Exception e) {
    e.printStackTrace();
    result = e.getClass().getName() + " : " + e.getMessage();
    return result;
    The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
    I gave the SYSTEM schema the required privilege to execute the code.
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '&lt;&lt;ALL FILES&gt;&gt;', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SYSTEM;
    I have used the following to load the class in Oracle 9ir2 DB:
    loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
    CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
    I have seen similar problems on other forums, but no solution posted
    [http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
    I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
    Can anyne help?

    Dear Peter,
    You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
    I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
    The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
    The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
    where content of bb1.bat as follows:
    echo off
    vol C: | find /i "Serial Number is"
    The above batch file just get the serial number of hard drive assigned when windows formatted HD.
    Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    Never returns
    Thanks for tracing teh issue to that details ;) hope you coul help.

  • Print PDF file from folder using SSIS

    Is there a way in SSIS to print pdf file from folder?
    ANy help much appreciated.

    One method is calling Adobe Acrobat Reader exe from Execute Process Task within SSIS passing the document path as the argument
    The command and arguments will look like this
    http://geekswithblogs.net/JeremyRamos/archive/2013/10/22/print-ssrs-report--pdf-from-sql-server-agent-or.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How can i print my files from mi iphone 5 throught the airport express?

    How can i print my files from mi iphone 5 throught the airport express?? i have the last iOS version installed and also the last firmware version of the printer. the printer is already connected to the USB airport express and when i look for printers in airprinter there is no printer found. i have an HP LASERJET P1606dn(i think that is supported by the airprinter).

    In order to function with AirPrint, a printer must connect to the network wirelessly.
    Even if you have an AirPrint compatible printer, iOS devices will not be able to print to the printer when it is connected via USB.
    So, you have two options:
    1) Reconfigure the printer to connect to the network using wireless only and the iOS devices should be able to print that way....assuming that you have up to date drivers for the printer installed.
    2) Leave the printer connected via USB and then use a third party App like Printopia installed on your Mac as a "workaround" to (hopefully) allow the iOS to device to be able to print.  If you want to give this a try, there is a free trial for Printopia, so you will know if it will work before you buy. You must have a Mac running on the network in order for Printopia to function correctly.
    Printopia - AirPrint to Any Printer - Print from iPad - Print from iPhone ...

  • How to print a Pdf from Java script

    Hi,
    I need to print a pdf from java script. In java script i have url of pdf. Is there any way to print pdf from java script?
    I am able to print word doc by ActiveX. is there any activeX or something else which do the same thing for pdf?
    Any help heartily esteemed to me.
    Thanks
    Kamlesh Sharma

    you are cross postin .. your thread has been answered in the jsp jstl forums

Maybe you are looking for

  • Problems with Attachment location in Mail

    I am using mail in Mountain Lion and whenever I forward or reply to an email and add an attachment it puts the attachment all the way at the bottom of the page.  It doesn't matter where the cursor is, which is what I'm used to being the indicator as

  • Upgraded to 23.0.1 and now bookmarks toolbar only shows open tabs and not bookmarks. How to I fix?

    Running Win 7 Home Premium. When I upgraded to Firefox 23.0.1, the Bookmarks Toolbar no longer shows my bookmarks which are in Bookmarks Toolbar but shows open tabs. If I uncheck "View Bookmarks Toolbar" the blank toolbar disappears, open tabs stay i

  • Automatic bank preference during F110 run

    Hi All, We have the following requirement from our client. Presently when we make payment to Vendors, we need to use funds from X (or) Y banks so we will need to manually reallocate those invoices that we will pay through the non-default bank.  Examp

  • Terminal - low disk space warning

    Hi I have MacBook Pro 15", Late 2011 256Gb SSD, 8Gb RAM One week ago I've updated to 10.8.3 and my Terminal.app constantly shows me the following message (every 3-5 min.): I neither run any new programs nor update any applications. I have the same ap

  • Saving Live Stream

    Hello, I just bought QuickTime 7 Pro because it allows you to save streamed video. We have a live camera feed to the web of our meeting room and I want to be able to save the stream as a QuickTime Movie. I right click the movie on my web browser and