___Advice on how to print html from an applet___

I have been working on this problem for a little while, but still can't find a good solution. I ask for any help/advice I can receive on this matter.
Below is what I have already tried:
1) Place the HTML within a JEditorPane and print the graphics object.
* In order to do this I would have to display the HTML, which I do not want to do.
* I have also tried placing the HTML within a JEditorPane and not display it, but I get no data from printing the graphics object.
2) Print the View classes that contain the text by placing the html into a JEditorPane ex) JEditorPane.getUI().getRootView(jeditorPane).
* This method is how the following article prints HTML: http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/
* This class prints each "leaf" view, which unfortunately will not print lists or table borders b/c they are contained in "branch" views. I have not been able to convert this class to print the branch views in a nice looking format.
3) Use a DocFlavor of type "text/html" and send document to the printer.
* Some printers can render html, but these are few and far between. Most printers I am dealing with do not accept type text/html.
Below are some things I am thinking about trying:
1) Convert the HTML to postscript and print the postscript.
* I have no clue how to do this. I have searched the internet for code and found nothing but perl code (but I am using a java applet).
2) Save the html file to users disk and open html file in new browser window. Then use javascript print function.
* I really do not want to have to save files to the users disk just to print. This seems like the easiest way, but is also the least user-convient way.
I would greatly appreciate any advice on printing HTML using java. Should I re-examine the methods I already tried? Can anyone give input on the methods I am planning to try? I would think this is a common problem, but I am having a hard time finding answers.
Thanks for your interest and any help you can provide :)

I tried the Java printing API in 1.4.2 but found it hopeless in terms of printing anything without using AWT.
Also since the print service was going to be on Windows machine I used jawin (http://sf.net/projects/jawinproject/) to query the registry for the command to print a particular extension and then exec that command.

Similar Messages

  • How to print HTML contents

    can anyone tell me how to print HTML contents...i needed it urgently
    Thanks

    actually i have a print button on html page....when i click on print button using window.print(); the html page gets printed...but along with it print button is also printed...i dont want print button to be printed...
    this is the issue...
    please resolve it
    Thanks a lot...

  • How to print HTML to a remote Server

    Ho guys my problem is only this
    how to print HTML to a remote Server
    i hav used JavaPrintService for it javax.print....
    The Doc Flavor i used is
    DocFlavor.INPUT_STREAM_TEXT_HTML_HOST;
    and with simple print attribute set but it doesnt locates
    the PrintSerivces.
    Plz try this code on your system(Jdk1.4 beta) and see whether it detects PrintServices or not
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
    public class PrintHTML {
    FileReader readfile;
    Doc doc;
         public static void main(String args[]) {
              PrintHTML ps = new PrintHTML();
         public PrintHTML() {
              DocFlavor flavor =DocFlavor.INPUT_STREAM_TEXT_HTML_HOST;
              PrintRequestAttributeSet aset =
                   new HashPrintRequestAttributeSet();
              aset.add(MediaSizeName.ISO_A4);
              // aset.add(OrientationRequested.LANDSCAPE);
              aset.add(new Copies(1));
    PrintService[] pservices =
                   PrintServiceLookup.lookupPrintServices(flavor, aset);
    if (pservices.length > 0) {
                   System.out.println("Available printer " + pservices[0].getName());
                   System.out.println("Available printer " + pservices[1].getName());     
                   System.out.println("Available printer " + pservices[2].getName());     

    The documentation is misleading. You cannot directly print HTML. See:
    http://developer.java.sun.com/developer/bugParade/bugs/4495770.html

  • How to print texts from iphone 4

    how to print text from iphone 4 without having to screenshot?

    An iOS cannot be downgraded or uninstalled...Apple has never supported doing this and removes the older iOS version files when a new iOS is released.

  • How to print photos from my iphone?

    I have the HP Photosmart C309a,(wireless) and would like to know how to print photos from my iphone 3G.
    I have the "app" "HP ePrint Home & Biz", but I don't know if it's compatible with my printer?

    The app is compatible with your printer IF it is connected to a network (not via USB to a printer).
    If it is not working restart your router by pulling its power plug momentarily.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • How to print information from my Apple I pad to my HP Photosmart D110 series printer

    How to print information from my Apple I Pad to my HP Photosmart D110 series printer ?

    Hello 518,
    Welcome to the HP Support Forums!
    It would appear that the HP Photosmart Plus 209B is not compatible with AirPrint. Without AirPrint you can only print via an App.
    I suggest the ePrint App. Getting Started with HP ePrint Mobile Apps<---
    Cheers,
    JERENDS
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • How to print labels from my Christmas card list?

    Does anyone know how to print labels from the Christmas card list in Contacts?
    I am new to computers and having managed to type in all my addresses I was hoping to print some labels!    Please can anyone help!

    Welcome to the Support Communities. What version of OS X is your Mac running? ...Click on the  menu at top left of your screen and choose About This Mac. Note the version in the form 10.n.n and then see this ASC tutorial:
    Update your product list
    Then see this Apple doc, which is for OS X 10.9 (Mavericks)...
    Contacts (Mavericks): Print contact information
    ...Found by searching here:
    http://support.apple.com/kb/index?page=search

  • Print HTML from Java

    Hello All,
    can anyone please provide example code of how to print an html-file from localhost by Java-code ?
    Thanx a lot !!

    Not sure what you are asking. You've mentioned several different things.
    One is printing - do you mean to put something on paper? There should be examples on how to print a file if you do a search.
    The other is 'from localhost' - this implies a socket to connect to 127.0.0.1 - Does your code connect to an HTTP server, issue a HTTP GET for an HTML page?
    Again there should be sample code for connecting to a server and reading the response if you do a search.

  • How to print html file on client system without viewing data on client syst

    I want to print html data from database.
    i am not able to print it using java code,
    javascript can do that.
    but in javascript window is opened on client browser.
    but i dont want to open that
    var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
           disp_setting+="scrollbars=no,width=0,height=0";
         var docprint = window.open("","",disp_setting);
         //docprint = new PopUpWindow() ;
         docprint.document.write('<%= mm %>');
         docprint.document.close();
            docprint.focus();
         docprint.document = null; mm contents the data to be printed. it prints well but window is shown
    in mm there is <BODY self.print() > so it prints on printer but i am viewing window i donot want to view window....
    and print Dialog box also.. I want to by pass this both.
    please send me code or any help regarding that.
    ....

    1. Post a javascript question on a javascript forum please.
    2. Don't think you can bypass without some plugin/setting on the client browser.

  • How to print report from JSP Page

    Hi Everybody,
    I am developing a simple project in JSP with MS Access. I hav some tables and reports for them. I hav a JSP page which gets inputs from user and save it in the table. Its working fine. But my problems are,
    1) I hav a button called "SAVE & PRINT" in that bottom of the page, if i click that button, the currently entered data has to save in the table and the same data has to print from the MS Access report. I dont know how to print this report from JSP page.
    2) Another button called "REPRINT". If i click that button, it has to ask a number to print the report page, that number is nothing but a field in that report.
    Could anyone help me to solve this problem.

    Hi Everybody,
    I am developing a simple project in JSP with MS Access. I hav some tables and reports for them. I hav a JSP page which gets inputs from user and save it in the table. Its working fine. But my problems are,
    1) I hav a button called "SAVE & PRINT" in that bottom of the page, if i click that button, the currently entered data has to save in the table and the same data has to print from the MS Access report. I dont know how to print this report from JSP page.
    2) Another button called "REPRINT". If i click that button, it has to ask a number to print the report page, that number is nothing but a field in that report.
    Could anyone help me to solve this problem.

  • How to Print Html Document (more than one page)

    I've a problem with printing my html page. I can print one page of html file, But my document is longer than one page. and i can't print it.
    who know how to print . Please Reply

    A recent article in JavaPro has a nice solution for this problem. Check out
    http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/
    It describes a way of using Views to break down the pages.

  • How to display html from the jar

    Hiiiiiiiii
    How I can to display html from jar file

    Check out datagriditemrenderer for the datagrid column. Sample datagriditemrenderer code below:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Text xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      dataChange="updateHTML()">
      <fx:Script>
        <![CDATA[
          private function updateHTML():void
            htmlText = data.streetaddress + "\n" +
              data.city + ", " + data.state + "\n" +
              "<b>Phone:</b> " + data.phone + "\n" +
              "<b>Email:</b> " + data.email + "\n";
        ]]>
      </fx:Script>
    </mx:Text>

  • How to Serve HTML from a Proxy Service?

    I am trying to serve HTML from a proxy service.
    I set up a Messaging Service with request type = 'None' and response type = 'Text'; with Endpoint URL = '/OSB_Project/Proxy_Services/InfoPingerProxyService.html'.
    In my incoming request pipeline I set an html Transport Header action to define Content-Type = 'text/html'.
    In the response pipeline I replace the body with the html document contents...
    Trouble is, when I access the proxy (via a standard browser GET), I always produce an XML file with an <?xml...?> processing instruction:
    <?xml version="1.0" encoding="UTF-8"?>
    <html>
    Also: the browser always sees an XML response regardless, it seems.
    Any suggestions gratefully accepted.
    Cheers,
    Alph

    More on this.
    I made an "educated guess' that the path should be
    {code}./ctx:transport/ctx:response/tp:headers/http:Content-Type{code}
    But take a look at the following, you will see that the content type IS now text/html, but the XML processing instruction is still there...
    {code}
    :\BIN\wget-1.11.4-1-bin\bin>wget -d http://localhost:7001/Test_Project/ProxySe
    rvice1?q=1
    SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
    syswgetrc = C:\BIN\wget-1.11.4-1-bin/etc/wgetrc
    DEBUG output created by Wget 1.11.4 on Windows-MinGW.
    --2010-09-15 15:33:17-- http://localhost:7001/Test_Project/ProxyService1?q=1
    Resolving localhost... seconds 0.00, 127.0.0.1
    Caching localhost => 127.0.0.1
    Connecting to localhost|127.0.0.1|:7001... seconds 0.00, connected.
    Created socket 268.
    Releasing 0x0063a620 (new refcount 1).
    ---request begin---
    GET /Test_Project/ProxyService1?q=1 HTTP/1.0
    User-Agent: Wget/1.11.4
    Accept: */*
    Host: localhost:7001
    Connection: Keep-Alive
    ---request end---
    HTTP request sent, awaiting response...
    ---response begin---
    HTTP/1.1 200 OK
    Connection: Keep-Alive
    Date: Wed, 15 Sep 2010 05:33:17 GMT
    Content-Length: 61
    Content-Type: text/html; charset=utf-8
    X-Powered-By: Servlet/2.5 JSP/2.1
    ---response end---
    200 OK
    Registered socket 268 for persistent reuse.
    Length: 61 [text/html]
    Saving to: `ProxyService1@q=1'
    100%[=====================================> ] 61 --.-K/s in 0s
    2010-09-15 15:33:17 (1.23 MB/s) - `ProxyService1@q=1' saved [61/61]
    C:\BIN\wget-1.11.4-1-bin\bin>type "ProxyService1@q=1"
    <?xml version="1.0" encoding="UTF-8"?>
    <server>8088</server>
    C:\BIN\wget-1.11.4-1-bin\bin>
    {code}
    (I know that the actual CONTENT [ie "<server>8088</server"] is not really HTML at the moment...this is just intermediate testing content...)
    Back to the issue of how to get rid of that processing instruction...
    The proxy service is configured as a messaging service with request = none and response = text.
    Cheers,
    Alph

  • Printing HTML from AIR app

    What are the general rules to print an html content from an AIR application to make sure that the printout looks the same as printing it from the browser?
    Thanks

    Hi,
    This link might help you:
      http://dryicons.com/blog/2008/04/26/multiple-page-printing-from-a-html-adobe-air-applicati on/
    Thanks and Regards,
    Kanchan Ladwani | [email protected] | www.infocepts.com

  • How to Print preview from Form9i

    I using forms & Report 9i i want to know that it is possible to print or print priview from form9i how, please help me

    Thanks jeet
    I received following error when i try to run report from form9i
    FRM-41213 : Unable to connect to the Report server repserve
    after starting report server by entering following command from Dos
    rwserver server=repserver
    report server repserver start
    after i try to run report from form9i i received following
    FRM-41214 : unable to run report
    following code i enter in when button press trigger
    DECLARE
    Report_Id report_object;
    hTimer timer;
    vcFile varchar2(255);
    vcResult varchar2(30);
    BEGIN
    /* Generate a pseudo-unique filename */
    vcFile := get_application_property(USERNAME)||TO_CHAR(SYSDATE,'YYYYMMDDHHMISS');
    /* We will be producing Postscript output in this case so add a .rrpp extension */
    vcFile := vcFile||'.rrpp';
    /* Find an existing Report Object and set parameters */
    report_id:=FIND_REPORT_OBJECT('JUMREP');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE,BATCH);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE,FILE);
    /* Format to Postscript */
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,'ps');
    /*Desname to our generated filename
    Note: <PhysicalDir> refers to a location on the
    Webserver which we read from with SHOW_DOCUMENT() */
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESNAME,'D:'||vcFile);
    /*Set the name of the Reports Server, again this would be softcoded */
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,'repserver');
    /* Save the Report Handle to a global as well */
    :GLOBAL.ReportHandle := RUN_REPORT_OBJECT(report_id);
    /* Save the generated Filename away for use in the When-Timer-Expired */
    :GLOBAL.PrintOutPut := vcFile;
    /* Create a timer to monitor the Report,
    This one is set to check 4 times a minute */
    hTimer := CREATE_TIMER('PRINTER_QUEUE','15000',REPEAT);
    END;

Maybe you are looking for

  • Partial amount picked up in payment run(t.code F110)

    Hello guru's, I am facing strange problem in payment run.I have two invoices($10000+ $5000) due in one vendor account.when run the payemnt program. system clears the both documents but with differnt amount $3000. Hence, cheque was issued to vendor fo

  • Only German Language fails in Portal view of SUS app

    Hello, We are running SAP's SUS (Supplier Self Services) through the portal.  Everything works fine in any language except German.  German works when using SUS through the backend.  When a user with the German Language set opens the Self Services tab

  • Problem in running the servlet

    I have compiled the servlet and put the class file HelloWorld.class inside $CATALINA_HOME$/webapps/ROOT/WEB-INF/classes/ directory, under tomcat6.0.18 and also mapped servlet in $CATALINA_HOME$/webapps/ROOT/WEB-INF/web.xml, as below web.xml:     <?xm

  • Mac G5 Trouble

    My Mac G5 was running real loud, so I turned it off.  I had to unplug it to turn it off.  After letting it rest for about 2 hours, I turned it on again.  There was a clicking noise in the tower.  In the center of the screen was  a small icon of the "

  • 2007 wireless keyboard led doesn't display

    I have a 2007 wireless keyboard that the green LED doesn't display. I just replaced the batteries with new ones and the LED still doesn't display after pressing the on button, so I replaced the batteries with another set of 3 brand new batteries. Sti