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

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 read/write file on remote server in java

    Hi All,
    How To read/write file on remote server in java? I mean using URL - http://www.xyz.com can I right file to that perticular server.
    Thanks in advance

    If your server support a means of uploading files you can.
    A popular means is [http://en.wikipedia.org/wiki/WebDAV]
    However, by default web server don't allow you upload files, its usually something you need to configure or install.
    I suggest you have a look at your web servers documentation.

  • How can I login on a remote server ?

    I want to copy some files from a remote server automatic by using a java program ,how can i do it?
    I just can't login!!
    i use the following code but I get nothing only the black green!!!
    Any advise may be useful,
    thanks in advance!
    Socket s = SocketOpener.openSocket(host, port, timeout);
    try
              System.out.println(s);
              BufferedReader read = new BufferedReader(new InputStreamReader(s.getInputStream()));
              PrintWriter write = new PrintWriter(s.getOutputStream(),true);
              write.println("username");
              write.println("passwd");      
         //     write.println("ls");
         //     write.println();
              boolean more=true;
              while(more)
                   String line= read.readLine();
                   if (line==null)more=false;
                   else System.out.println(line);
         System.out.println("error");
         catch (IOException e)
         //     System.out.println("error"+e);

    Why u r using Socket Class? Instead of this u use RMI.
    In RMI u can access server remotely.I don't know that u know anything about RMI or not.If yes then ok,otherwise mail me I will tell u total detail of how to use RMI.
    My email address
    [email protected]

  • ___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.

  • 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 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 install Data Insight on remote server

    Hello,
    I am working in an enviorinement in which Data Services has been installed on remote server and i access it using Remote desktop. Now i need to install Data Insight and i am not sure where should Data Insight be installed. should it be installed on my local machine or on remote server. If on remote server, can i install it from my local machine?
    Thanks
    Adi

    What was your solution?
    Cheers,
    Julius

  • How-to install JRE/JDK on remote server without X11

    Hi,
    I need to install a JRE on my remote server (e.g. Amazon EC2) from a location with slow / limited bandwidth.
    Ok, so I cobble a way to get a download of the bin by fudging that I am going to load it to my laptop, then copy and paste the final URL for the bin into WGET on my amazon instance - (Why oh why cant SUN just give me an URL directly to the latest JDK/JRE) e.g.
    wget java.sun.com/downloads/jre-latest.bin
    Ok - so that took 3.3 seconds at 48Mb/s - great.
    chmod .u+x j*
    ./j*
    The box goes into the black hole of death (probably looking for a response on a non existant X
    Ok - so what am I doing wrong? Is this the correct analysis?
    Thanks
    Chris

    Are you sure that's a JavaFX question?
    You might want to ask it in a forum with people more knowledgeable to this domain.

  • How to execute BC4J code on remote server using DBC Files

    Hi People,
    I have a requirement here that i do not know if it's possible to achieve. We have an Application Module that fetches some records and another Application Module that receives them as parameters and inserts these records in interface tables. However, the BC4J code is installed on the JAVA_TOP of the Development Instance, and will not be installed on the destination server. What i would like to do is to place the target instance DBC file on the FND_TOP/secure directory on the Dev instance, and instantiate the Application module pointing to this DBC file, so that the AM connections would point to the target instance (thus inserting the data on the correct tables). Is that possible?
    Please let me know if you want further clarification. I have seen something similar working on iSetup (extract from source env -> Load on dest env) but have got no clue about implementing that.
    Best regards
    Thiago

    Hi,
    you can follow this steps.
    1. Create a database link to the remote server
    CREATE DATABASE LINK remote_Server
    CONNECT TO apps IDENTIFIED BY apps
    USING 'remote';
    2. Create a Synonym for the table in the remote server
    CREATE SYNONYM po_headers_remote
    FOR po_headers_all@remote_Server
    3. Create entity object based on this synonym.
    4. Create View Object based on above EO.
    Through this view object you can udpate remote database...
    Hope this helps.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Print html document from presentation server with no intervention of user

    Hello,
    I have been able to create HTML output for my smartform.
    They are saved on my machine.
    I need to print these HTML outputs as a part of process without intervention of the user.
    Is it possible?
    I have tried method 'EXECWB' of 'cl_gui_html_viewer', but that gets fired only on some action and shows the Print dialog for the selection of printer.
    It would be great if anyone can help me with us.
    Thanks
    Mona

    PDL -- thank you for your reply.
    What you gave me did spawn the print dialog allowing me to select a printer. However, when the document printed, the number of pages in the document was correct but the pages were empty except for the page x of y along the top and the name of the document along the bottom. Have you seen this before and do you know how to correct? Also, how do you suppress the info across the top and bottom of the report from printing?
    Thanks

  • How to display HTML file from Unix server on UI at runtime

    Hi Experts,
    My requirement is to display  HTML files,  related to some particular person, on UI. The file is existing on a separate UNIX server and a file related to one person may have a lot of attached files as well , as is the case generally with HTML files, including pictures etc. So it is no use transferring file on my CRM system, as the files are kept separately on this UNIX server which is particularly for this kind of storage.
    I am able to show files residing on MIME repository ( I created some new HTML files )  of my CRM system on UI. but I don't know how to go ahead with this particular requirement.
    One idea is that I can map one folder of my application server to that unix server so that I can see the HTML files in this particular folder. but I don't know how to map MIME repository folder to application server directory or directly to the UNIX server .
    Please advise. Is my approach correct or is there any other way ?
    thanks in advance.
    Regards,
    Vikas

    Maybe this is too simple, but have you got an HTTP server on the UNIX machine? You could simply link the URL into you CRM application and display the contents directly from UNIX.
    cheers Carsten

  • How to print html as it appears in internet explorer

    i've been workin on a program (volunteer work) to help storing database ...... i am almost close to finals in my school and im lookin for a way to finish fast, im desperate i've been workin for 3 month no sleep ..... please i just need advise on:
    1- I am linking my program through JDBC and imma access the code through java and do the changes but before doing that i need to know if i would be able to print the Html page as you can see it throu internet explorer. I dont know how to use a code in java to print the Html PAGE, i havent started on that cz i wana make sure i can print an html before editing the files. I have all my forms that i need to fill in .doc .html i can create them in any file whichever is more easy and convenient (i can do them in any format).would it be hard to print preview my html page throu java as well?
    2- how to make my java executable through jar or whatever is good, and how to create an installation wizard for my program and how to set the path for all internal files so the program can function as it functions in java.
    3- How to transfer the JTextPane to a file and save the style with it (bold or italic or Underline {bass im not saving any other styles })
    4- i need to figure out how to make a SpellCheck button that checks for error and give me the option to replace or add to dictionary and i need the button to access a JTextPane.
    5-i am creating a page that actually Display(play),save and delete audio and pictures. my program has multiple cases how am i gonna be able to save pics and audio in like seperate folders for each case?? and of course create that folder???
    i know its a lot of stuff anything u can advise would be helpful just any links or help as far as code
    any advise on getting answers or using this forum is appreciated, that;s my first trial as going to an online source in forums all ive been reading is the book and internet resources
    Edited by: cchaptini on Mar 8, 2008 3:17 AM

    Hi ,
    Try this
    SQL> set serveroutput on size 1000000;
    SQL>SQL> ed
    Wrote file afiedt.buf
    1 declare
    2 str varchar2(32000);
    3 begin
    4 str := 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    5 for i in 0 .. length(str)/250 Loop
    6 dbms_output.Put_line(substr(str, i*250+1, 250) );
    7 end loop;
    8* end;
    SQL> /
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.02
    Thanks
    Suni

  • How to print .html file ?

    Hello friends,
    In my program I have to give output of my reports into HTML PAGE. This is fine and I have already done. But now on click of a button I have to print this file. The html file I am storing on my project folder only.
    Pls tell me using I/O or any other way, how I can print the file on the printer. I also want the status of succesful printing.
    Even the guidance, where I should look for to get the solution ?
    Chhaya

    I'd start with http://www.google.com/search?q=java+print+html

  • How to print html code block

    hi all
    i have a problem about printing my html code block in a loop ...for example;
    <%
    int i;
    for(i=1;i<10;i++)
         out.println("<h1>Hi ALL</h1><h2>Hi All</h2>");
    %>it works well because the html code is just one line.
    but if i want to print very long html code how am i going to print that???
    for example i want to print that html code;what am i going to do now
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="800" height="60" valign="top"><div align="center">
                <span class="style1">Ders Ad&#305;</span>:          
                <%
              dersismi.next();
                %>
              <span class="stilim"><%out.println(dersismi.getString("DERS_ADI"));%></span>
              </div></td>
          </tr>
        </table>thanks for your help

    If you are printing out large blocks of HTML you shouldn't be using any java command. You should just write the HTML like you have in your example.
    The whole point of JSP was that you didn't have to put out.println() statements into a servlet!.
    If you just want to out.println a value into the HTML, consider using the <%= %> expression tag. ie rather than <%out.println(dersismi.getString("DERS_ADI"));%>
    just have
    <%= dersismi.getString("DERS_ADI") %>
    If you want to set up a loop, you can intersperse java and html code, but thats ugly. I would recommend using JSTL custom tags for looping.
    Good luck,
    evnafets

Maybe you are looking for

  • Error 1 occurred at an unidentified location

    Good morning, I've gotten the error shown in the screen capture below on a few occasions now.  It started occurring when I began running two different experiments from the same CompactRIO hardware.  I have a single target which scales all of the data

  • Disable a hot key

    I'm looking for a way to disable the delete immediately hotkey. I know its: Apple, Option, Delete. I've tried the Keyboard Shortcuts in the System Prefs but this key combination is not available to edit there.

  • Screens in SE51

    Hi Experts, My system has been upgraded from 4.7 to ECC 6.0. After the upgrade the standard screen  2900 of program MP000600 is deleted by the upgrade. I retrieved the screen using SE51 transaction. My problem is even though it is retrieved it is not

  • Split Panes, Frame and Resizing

    Hi, my user interface is made up of a message panel using the created class SplitPanes2 through the method createSplitPanes called from a class that extends Frame. (will post code if required: lengthy). When the frame is resized/maximized, the splitP

  • Migrating from different structure

    In second version of our software we change the database structure. Now we need to migrate data from version 1 to version 2 that have different database structure. Is Streaming or any other oracle feature provides possibility or I should write code b