Printing remote page using java

Thanks for your replies for my previous queries I would very thankfull to you all
If you can suggest me a way to this.
I would like to know how a remote file is printed using java
This is the code I am using.
public void print() throws Exception
     FileInputStream psStream=null;
     try
     {  //This is pointing to a file in the server
          psStream = new FileInputStream("c:/Index_page_Links.gif");
     catch (FileNotFoundException ffne)
               System.out.println("File Not Found Exception");
     DocFlavor psInFormat = DocFlavor.INPUT_STREAM.GIF;
     Doc myDoc = new SimpleDoc(psStream, psInFormat, null); 
     //This returns the list of printers that are capable of
     //printing the document in the format speciied.
     PrintService[] psrvc = PrintServiceLookup.lookupPrintServices(null,null);
     if (psrvc.length > 0)
          DocPrintJob job = psrvc[0].createPrintJob();
          try
               job.print(myDoc, null);
          catch (Exception pe)
               System.out.println("Print exception");
} I need some claification on one point
PrintService[] psrvc = PrintServiceLookup.lookupPrintServices(null,null);Is this going to return the printers conected to the users system.
What I need is the user who is borwsing the site should be able to print
the file from his local printer.
(The document what he should print is located in the server and we should
not show him that document).

Is this going to return the printers conected to the users system.If it returns anything, it will return the printers connected to the system where the code is running.
You have some words in your post that suggest you have a web application in mind, or something like that. It's hard to tell.

Similar Messages

  • Print Html page Using Java

    I need to print Html Page into my printer, how can I do this. Any help will be appreciated.
    Wil

    File > Print.
    See: http://java.sun.com/javase/6/docs/technotes/guides/jps/spec/printing2d.fm.html
    And:
    http://java.sun.com/j2se/1.4.2/docs/guide/jps/index.html
    And google "Java JPS"

  • Printing Web contents using Java Fx.

    Hi,
    How to Print Web contents using Java Fx application? ie, displaying a web page as it is on the application..........
    Thanks......

    You might want to try to SwingComponentize third-party Java web browser (JDic, NativeSwing).
    Another recommended alternative is to wait for the JWebPane because it is designed to work with JavaFX (http://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec_1.html). No date is given to JWebPane's release though. JWebPane will be my Christmas's wish.

  • How to create hyperlink in Html page using Java

    Hello every one
    I want to know that how can I create a hyperlink in Html page using java ?
    Let for example
    I have code like this and i want to give hyperlink to it using java.
    rember that i am creating node using this id="name" which give me multiple value. and i want to assign diff link to each name..?
    <tr>
    <td ><span id="name"></span>
    </tr>

    but i m using this code to create node in html file
    HTMLLIElement li = (HTMLLIElement)appHTML.createElement("LI");
    Text txt = appHTML.createTextNode(name);
    li.appendChild(txt);
    appHTML.getElementById("name").appendChild(li);
    this will display all name value which is coming from database,
    and i want to assign a hyperlink to it,
    I have id with name also so I thought that using id i will
    create javascript like
    function popup(id)
         if(id==1)
              var n1 = window.open("../list/name1.html");
         if(id==2)
              var n1 = window.open("../list/name2.html");
    this way i want to popup particular file if i can pass id value in this function
    so want hyperlink like
    name

  • How to do transactions in jsp pages using Java & MySQL ?

    Hi,
    I'm a newbie..
    I'd like to know "How to do transactions in jsp pages using Java & MySQL ?"
    Platform: Windows XP, Apache Tomcat 5.5, MySQL 5, Java bean without EJB
    what are the the different types of transactions? Differences between them?Pls provide examples?
    Which among them is the best method to implement a transaction?
    Pls help me...
    thnx in advance...

    http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

  • How to embed 3D models in web page using JAVA?

    Hello
    I'm doing a project at University to create a virtual tour of a village. I am creating the buildings in MAYA using polygon planes and cubes and then exporting to VRML.
    I plan to embed each individual model into a separate web page. Then when the user clicks on a location in a 2D map they will be taken to the web page containing that building.
    However, I can't work out how to embed these 3D models into web pages using JAVA. Can anyone help me with this, please?
    Also, I've been told to use JAVA 3D to interact with the project but am unclear as to how JAVA 3D would be used in this project - aqny ideas/suggestions welcome!
    M.

    If you use Java-plugin, you can embed Java3D in a web page.
    Here is the URL(http://www.geovista.psu.edu/products/demos/LorenzAttractor3D/index.html) which used Java3D.
    I hope this helps.
    Masa

  • I am unable to print "ALL Pages" using the Adobe Print plugin in Firefox, only the first page gets printes. however IE works perfectly fine.Please advise. Is it some way that firefox identifies the complete web page..? PLease help

    I am unable to print "ALL Pages" using the Adobe Print plugin in Firefox, only the first page gets printes. however IE works perfectly fine.Please advise. Is it some way that firefox identifies the complete web page..? PLease help

    Does the entire webpage appear in Print Preview? <br />
    File > Print Preview

  • Directly Printing RTF document using java

    Hi,
    can we directly print RTF document using java, without giving any preview or any other screen in between.
    Actually we created inventory system, in which when user create any sale information, it should print the bill for the same with single button click.
    Any sample code or help will be highly appreciated
    Thanks in advance

    Hi,
    can we directly print RTF document using java, without giving any preview or any other screen in between.
    Actually we created inventory system, in which when user create any sale information, it should print the bill for the same with single button click.
    Any sample code or help will be highly appreciated
    Thanks in advance

  • I can not print web pages,print box does not appear . I can print web pages using IE

    Windows 7. Firefox 5.0 I can not print web pages. After clicking PRINT the print dialog box does not appear and nothing prints. I do not have this problem using IE
    Printer: Brothers HL-5140
    Thank you,
    Syd

    First of all, update Firefox to 3.6.17 via Help | Check For Updates.
    There was a security breach at Comodo which is an SSL certificate provider recently whereby a number of fraudulent certificates were inadvertently issued. These allow a hacker to impersonate any site including online banking and the Firefox version you're running at the moment will not warn you that the site is a fake. The fraudulent certificates were blacklisted in v3.6.17 and beyond.
    To uninstall the Yahoo Toolbar, go to Tools | Add-ons | Extensions. You should find it in there.
    To revert to Google as your preferred search engine, please do the following.
    * In the location bar, type '''about:config''' and hit Enter.
    * In the filter at the top, type: '''keyword.URL'''
    * Double click it and remove whatever's in there and replace it with http://www.google.com/search?q=
    The URL to add in "keyword.URL" becomes a link in this post, so right click it and choose "Copy Link Location" to copy it to the Windows clipboard. Then hit CTRL+V to paste it. Saves you having to type the whole thing.
    '''To reset your home page, do the following'''.
    * Go to the site you want to set as your homepage.
    * Go to '''Tools '''| '''Options '''| '''General'''
    * Make sure it says "''Show My Homepage''" in the first dropdown menu.
    * Click the button called "'''Use Current Pages'''" to set the homepage to the one you have on the screen.
    After you complete the above steps, install this add-on to prevent another search engine from modifying your preferences: https://addons.mozilla.org/en-US/firefox/addon/browserprotect/
    Additonal security risks on your system are the version of Flash you have installed at the moment. See http://www.adobe.com/support/security/bulletins/apsb11-12.html
    Update via http://get.adobe.com/flashplayer/
    Printing issues might be fixed by installing Java via http://www.java.com/en/
    But if the problem persists, please post again.

  • Printing issues while using java code

    good day everyone,
    Im stuck on a silly issue that has to do with printing using java and i can't wrap my head around the why its behaving like this.
    What i do is i hide a few pages on initialize to basically endup with only 1 page showing out of 6.
    On that solo page i have a print button i would like to use.
    Under the click command i want to show all my pages temporarlly and then print and hide them again.
    Right nowi have this code to do the un-hide and activate the print function:
      form1.Header1.presence="visible";
      form1.Page1.presence="visible";
    form1.Page2.presence="visible";
    form1.Page3.presence="visible";
    form1.Page4.presence="visible";
    form1.Page5.presence="visible";
      xfa.host.print(1,"1","5",0,0,0,0,0);
    So when i press the button, the pages show up but nothing happens, i dont see the print dialog. But if i press on the print button another time, it will work.
    Its almost liike i would need to do this for it to work properlly:
    xfa.host.print(1,"1","5",0,0,0,0,0);
    xfa.host.print(1,"1","5",0,0,0,0,0);
    But im guessing that this is just something im doing wrong, but i cant see why it justs doesnt work on the first try.
    Anyone can point to what is happening or what needs fixin? I just dont see it
    Thank you very much again for all the help.

    Maybe this will help:
    http://forums.adobe.com/message/5206864#5206864
    Kyle

  • I have a new 64bit computer to which I have transferred all my files and re-installed all my programsWhen I try to print a page using Adobe Acrobat 9, Firefox crashes. This has never happened before, and does not happen with other browsers.

    I have a new computer. I transferred all my data files and installed my programs. Now, when I try to print a page ti pdf using Adobe Acrobat 9, Firefox crashes, and Adobe hangs up.

    Thanks for your reply cor-el. I had never heard of nor seen the pref network.http.max-connections until I read about it in some of the replies in this support forum. People were saying 256 was the old setting and a new setting of 48 would correct my problem. When I followed the instructions to get to - see - and change the setting I discovered that my network.http.max-connections was already set to 48. I never did this. The only way I can think of that this setting was changed is that it happened by an automatic update to my Firefox browser. So, the problem I have was probably happening while this setting was at 48 all along. It is still set at 48 and I am still having the same problem. I will try as you suggest and set it to 30 and see what happens. I'll let you know the results. That's again for your response.

  • I just purchased a HP PhotoSmart printer and it prints blank pages using FireFox. It prints ok using Internet Explorer

    I cannot print using Mozilla FireFox. It prints blank pages.
    It prints ok with Internet Explorer

    Try to reset the print prefs.
    See http://kb.mozillazine.org/Problems_printing_web_pages

  • C4680 Prints Blank Pages using Mac OS X 10.9 (Mavericks)

    Hello.
    My Hp printer recently started to print blank pages. The problem started with two of the prints partially printed and since then the rest appears blank. I check the UTILITY tool - the cartridge levels are good (the tricolor is full, the black ink level shows yellow warning triangle but no critical level). The next step I performed was printing a test page through UTILITY, but a blank page was printed. Finally I deleted the hp folder from Library/Printers, then deleting the Printer using the - sign in the System Preferences/Printers and back again to Printers with downloading and installing the drivers through the Apple Software Update as suggested by the system once I used the + sign (Add Printers) command. After all this manipulations the printer is still printing blank pages. Could you please help me with the solution.
    Thank You,
    PetarTzenev
    This question was solved.
    View Solution.

    Hi TeriLynn,
    I have successfully installed the v 3.3.1 Drivers on my Mac, but after triple check with my other macbook OS Yosemite and with other Windows Vista laptops I am almost 100% sure that the problem is the black cartridge. It should be completely empty nevertheless is shows some ink.
    So, at least the Printer menus are there - utility, supplies, etc. 
    Once I buy the black cartridge, I hope I'll find the problem.
    One suggestion for HP, please take my case and fix the Mac "no ink" notifications. At any moment I did not receive a pop-up warning that I have to change the cartridge.
    TeriLynn, thank you very much for the efforts and your guidence. It was really helpful.
    Thank you.
    Best regards.

  • Unable to print in linux using java 1.5

    Hi i could't able to print in linux system using java 1.5. Printer name is detecting.
    when i execute printDataTransferCompleted then printJobNoMoreEvents happening But print is not happening.
    here i attached the source.
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.event.PrintJobEvent;
    import javax.print.event.PrintJobListener;
    public class HellowLinux {
         public static void main(String args[]){
              String printText = "The Java Tutorials are practical guides for programmers" ;
              DocFlavor byteFlavour = DocFlavor.BYTE_ARRAY.TEXT_PLAIN_UTF_8;
              Doc myDoc = new SimpleDoc(printText.getBytes(), byteFlavour, null);
              PrintService[] services = PrintServiceLookup.lookupPrintServices(byteFlavour, null);
              System.out.println("No of printer detected : "+services.length );
              for(int i = 0; i<services.length; i++){
                   System.out.println("Printer Name : "+services.getName());
              if(services.length > 0){
                   DocPrintJob myJob = services[0].createPrintJob();
                   myJob.addPrintJobListener(new PrintJobMonitor());
                   try{
                        myJob.print(myDoc, null);
                        System.out.println("Printed Successfully ... ");
                   }catch(Exception e){
                        System.out.println("Error : "+e.getMessage());
         private static class PrintJobMonitor implements PrintJobListener {
              public void printDataTransferCompleted(PrintJobEvent pje) {
                   // Called to notify the client that data has been successfully
              // transferred to the print service, and the client may free
              // local resources allocated for that data.
                   System.out.println("Data transfer Completed : "+pje.hashCode()
                             +"\n"+pje.getPrintEventType());
              public void printJobCanceled(PrintJobEvent pje) {
                   // Called to notify the client that the job was canceled
              // by a user or a program.
                   System.out.println("Cancelled : "+pje.hashCode()
                        +"\n Event Type "+pje.getPrintEventType());
              public void printJobCompleted(PrintJobEvent pje) {
                   // Called to notify the client that the job completed successfully.
                   System.out.println("Completed : "+pje.hashCode()
                             +"\n Event Type "+pje.getPrintEventType());
              public void printJobFailed(PrintJobEvent pje) {
                   // Called to notify the client that the job failed to complete
              // successfully and will have to be resubmitted.
                   System.out.println("Failed : "+pje.hashCode()
                             +"\n Event Type "+pje.getPrintEventType());
              public void printJobNoMoreEvents(PrintJobEvent pje) {
                   // Called to notify the client that no more events will be delivered.
                   System.out.println("No More Events : "+pje.hashCode()
                             +"\n Event Type "+pje.getPrintEventType());
              public void printJobRequiresAttention(PrintJobEvent pje) {
                   // Called to notify the client that an error has occurred that the
              // user might be able to fix.\
                   System.out.println("Requires Attention : "+pje.hashCode()
                             +"\n Event Type "+pje.getPrintEventType());
    Edited by: 936393 on May 24, 2012 12:08 AM

    Hi ,
    Go to Help menu >> update
    it will update your application to 13.1
    then go to  Editor 's Edit menu >> Preferences and click on Reset Preference on next launch .
    after that relaunch your application..
    Refer article for the same:
    https://helpx.adobe.com/photoshop-elements/kb/elements-printer-issue-incompatible-error.ht ml

Maybe you are looking for

  • TS1453 Apple TV (1st Generation) no longer synching with iTunes

    Since updating to OS X 10.7.4 I am no longer able to synch my Apple TV with iTunes on my 21.5" iMac.  The Apple TV appears on the list of devices in iTunes and is connected to the internet, but it will not synch with iTunes on my computer.  Also sinc

  • Slow mac mini

    Mac Mini G4, 1.33 GHz 512 MB OS 10.4.11 Has suddenly begun slowing down when I have been loading web pages. This occurred a day or two after I installed Apple's Sept. 15 Security Upgrade. Also, I found a drop-down message in my network preferences th

  • HP Photosmart R847 Digital Camera

    I've been very happy w/ my camera but now it won't come on when I lower the shutter door.  I've made sure that it's fully charged, just unplugged it from an overnight charge.  I've never had a problem with it until now.  BTW, the little blue light is

  • How do i get the web,images,videos bar back?

    how do i add the browse web,images,videos bar back?

  • After latest update 1 feb 2014 error msvcr80.dll was not found

    after latest update 1 feb 2014 on both my desk top running vista and my lap top running xp both crashed and now itunes wont open i just get failed to star because msvcr80.dll was not found obviously i tunes has a serious bug Help huve uninstalled fro