Send a txt file to the printer with java

Hello,
I want to sent a txt file to the printer in java. I' am using the USB port. I can try to setup a dos command (print c:\test.txt), but I don't know the exactly command.
There is also another solution in java I thing but I don't know the code!
Can somebody give me the exact command for DOS and/or the code I have to write in java?
THANX!!!!

in dos imo you are not able to use usb-port. if your printer would be on lpt you could use javacomm ( http://java.sun.com/products/javacomm/index.html ). there is also another thread talking about this (print text to lpt). for your usb-problem i don't have a solution. but you could use JNI (java native interface). write code in c, compile to dll and use it in java.
tobias
ps: the other thread ( http://forum.java.sun.com/thread.jsp?forum=31&thread=224460 )

Similar Messages

  • Send updated xml file to the client with out any request

    hi,
    I am showing the data in the form of a table ,where the data are taken from a XML file. If i change the content of that XML file, the server should send the updated data to that client page, that means the client page should get refreshed automatically when there is a change in that XML file. I dont have any idea to implement this requirement.This is very urgent. Any suggestion would be appreciated. Already i have referred www.pushlets.com but that is not so clear. so pls............
    With regards
    Parameswaran

    The client is not supposed to know the server. You will need to have a periodic refresh. :)

  • PRINTING  A .tif FILE  TO THE PRINTER USING JAVA CODE

    I WROTE A CODE FOR PRINTING THE FILE .ITS PRINTING ALL FORMAT ,BUT WHEN I GIVE THE EXTENSION AS .tiff ,IT SHOWS IN A POP-UP THAT "PRINNTING FAILED"
    CAN ANYONE SEND ME THE CODE FOR PRINTING .tif FILE?

    AMARSHI wrote:
    I WROTE A CODE FOR PRINTING THE FILE .ITS PRINTING ALL FORMAT ,BUT WHEN I GIVE THE EXTENSION AS .tiff ,IT SHOWS IN A POP-UP THAT "PRINNTING FAILED"
    CAN ANYONE SEND ME THE CODE FOR PRINTING .tif FILE?YOU CANNOT PRINT A TIFF DIRECTLY FROM JAVA SINCE IT WILL NOT LOAD A TIFF!!! YOU HAVE TO USE JAVA ADVANCED IMAGINING TO GET THE FILE TO LOAD AND THERE ARE EXAMPLES ON HOW TO DO THAT IN THE JAI LIBRAIRY. ONCE YOU CAN GET THE TIFF TO LOAD YOU CAN USE WHAT EVER YOU HAVE NOW TO PRINT IT, THERE ISN'T ANY MAGIC, YOU JUST HAVE TO HAVE THE IMAGE LOADED FIRST.

  • How to send a text file to a printer?

    Hi, I'm in dark on how to send a text file to a printer through Java Stored Procedure.
    Here are what I tried so far (OS: win 2000, Oracle: 817 or 9i2):
    1, Enable DOS command in Java Stored Proc. and try to send PRINT command there:
    public static String Run(String Command){
    try{
    Runtime.getRuntime().exec(Command);
    System.out.println("Command: " + Command);
    return("0");
    catch (Exception e){
    System.out.println("Error running command: " + Command +
    "\n" + e.getMessage());
    return(e.getMessage());
    public static void main(String args[]){
    if (args.length == 1)
    Run("print /D:\\\\enterprise\\john " + args[0]);
    else System.out.println("Usage: java OSCommand filename");
    PL/SQL wrapper:
    CREATE OR REPLACE FUNCTION OSCommand_Run(p1 IN VARCHAR2) RETURN VARCHAR2 AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'OSCommand.Run(java.lang.String) return java.lang.String';
    SQL command:
    //print /D:\\machine\printer test.txt
    I loaded the Java Stored Procedure into SYSDBS account, it failed silently, even though piece of code works fine in external JVM.
    2, Use filePrinter:
    public static String print(String printString) {
    try{
    String printerUNC = "\\\\machine\\printer";
    FileWriter fw = new FileWriter(printerUNC);
    PrintWriter pw = new PrintWriter(fw);
    pw.println(printString);
    fw.close();
    return "OK";
    }catch(Exception e){
    e.printStackTrace();
    return "Exception: " + e.getMessage();
    public static void main(String[] args) {
    try{
    String printerUNC = "\\\\machine\\printer";
    String printString = "Hello World";
    FileWriter fw = new FileWriter(printerUNC);
    PrintWriter pw = new PrintWriter(fw);
    pw.println(printString);
    fw.close();
    }catch(Exception e){e.printStackTrace();}
    I loaded it into SYSDBS too, and tried with this:
    SQL> select MY_PRINT.PRINT('HELLO from Oracle') from dual;
    MY_PRINT.PRINT('HELLOFROMORACLE')
    Exception: No such file or directory
    SQL> show user
    USER is "SYS"
    It works in external JVM too.
    What's wrong with this?
    Thanks for any help in advance,
    Charles

    Avi:
    Thanks for your response!
    I put the java code in SYS, 'cause I assume that account has max privilege. If the test is successful, I will move that to some user schema and then to deal with those privilege settings... But I'm unlucky.
    I checked Ask Tom, this is what I got from http://asktom.oracle.com/pls/ask/f?p=4950:8:1619723::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:38012348052,%7Bprinter%7D:
    ... Print file from PL/SQL ...
    If you are using Oracle8i, release 8.1 -- much can be done with Java. java
    would be able to print directly from the server.
    Looks like using Java to print out file is better than PL/SQL. But there's no more hint there! And, no new question can be asked there today either...
    I'm wondering whether we can create a socket to a printer and send the characters there directly... Anyone has experience on this?
    Thanks for all the help in advance,
    Charles

  • Trying to get Photoshop CS4 functional with Mavericks and an Epson 3880 printer. CS4 fails to send a file to the print queue. Have reinstalled the Epson 3880 driver for Mavericks. All looks good but no file is sent.

    rying to get Photoshop CS4 functional with Mavericks and an Epson 3880 printer. CS4 fails to send a file to the print queue. Have reinstalled the Epson 3880 driver for Mavericks. All looks good but no file is sent.
    Does anyone know how to fix this?

    What EXACT version of Photoshop CS4 are you running?  You should be on Photoshop CS4 v 11.0.2.
    Also run Apple's software update to see whether it offers you the latest Epson update:
    Printer Driver v9.33
    Epson Stylus Pro 3880, Drivers & Downloads - Technical Support - Epson America, Inc.
    MOST IMPORTANTLY:  have Photoshop re-create its own Preferences:
    To re-create the preferences files for Photoshop, start the application while holding down Ctrl+Alt+Shift (Windows) or Command+Option+Shift (Mac OS). Then, click Yes to the message, "Delete the Adobe Photoshop Settings file?"
    Note: If this process doesn't work for you while you're using a wireless (Bluetooth) keyboard, attach a wired keyboard and retry.
    Important: If you re-create the preferences by manually deleting the Adobe Photoshop CS6 Settings file, make sure that you only delete that file. If you delete the entire settings folder, you also delete any unsaved actions or presets.
    Reinstalling Photoshop does not remove the preferences file. Before reinstalling Photoshop, re-create your preferences.
    NEW Video! Julieanne Kost created a video that takes you through two ways of resetting your Photoshop preferences. The manual preference file removal method is between 0:00 - 5:05. The keyboard shortcut method is between 5:05 - 8:18. The video is located here:
    How to Reset Photoshop CS6’s Preferences File | The Complete Picture with Julieanne Kost | Adobe TV
    Mac OS
    Important: Apple made the user library folder hidden by default with the release of Mac OS X 10.7. If  you require access to files in the hidden library folder to perform Adobe-related troubleshooting, see How to access hidden user library files.

  • With webutil-client_host, send txt file to client printer

    hi,
    I wanna to learn how to send a txt file to client default printer(local or network),
    I created txt file at client disk, and try to send printer directly,
    just try some statement looks like below;
    a.client_host('cmd /c start print C:\TEMP399899.txt /d:lpt1');
    b.client_host('cmd /c start copy C:\TEMP399899.txt lpt1');
    I do not know the command prompt syntax, please help me, reference me,
    thanks

    Hi,
    on a command line type
    print /?
    for the help of how to print documents. On XP this help is
    PRINT [D:device] [[drive:][path]filename[...]]
    /D:device Specifies a print device.
    Frank

  • Explorer Context Menu Convert Sends Files to the Printer

    Right-clicking PSD files and choosing "convert to PDF" sent the files to the printer!!!  I had hoped it would have brought up a dialog to convert the files to PDF...
    (I was looking for "combine as PDF" -- I'm not sure what happened to it?)
    I'm running Acrobat 11 on Windows 8.1
    -Donald

    All that context menu stuff is handled by the registry. The explorer application simply gets its information from there. So Labview can write to a registry key to add itself to handle a file type. This is why you can have multiple applications handle the same type and show up in the context menu.
    My point is that after I run LV 8.0, I will see both LV 8.2 and LV8.0 in the context menu (along with a couple of others). However, after I run LV 8.2, the LV8.0 option is removed. I'm guessing that this is related to a program's behavior in checking and setting the registry key to make sure that it is the default handler for the appropriate file types. NI would need to strengthen this code to be sensitive to previous versions of Labview.
    A rough example of how to do this is at  http://www.codeproject.com/w2k/extendingshell.asp
    Brian Rose

  • File name to print with your image (PS3)

    Hi,
    I'm working on about 20ish photoshop images that have a specific name to match up to a diagram, so when I print them I need the file name lable to appear on the print with it. Additionally when I send them off to clients, I need to have that file name lable visable on the pg of the pdf while looking at the image so they know which one is which. The collected multi pg pdf needs to be under 3megs (5 mgs max) so it is easily emailable.
    I'm trying to find an automated or an easier way to do this than what I am doing one by one now. I tried to set up a PS action which I would batch to all open files but, becuase of the two step print dialogue it gives me an error saying all the settings weren't recorded, thus it doesn't work.
    What I'm doing now:
    1. Cmd+P to print, in the print dialogue under the "output" drop down I have "Labels" checked
    2. Hit print, then my printer driver dialogue box pops up, then in the lower left corner I click the button "PDF" and "Save as a PDF"  (This produces an acceptable quality pdf at a sm size)
    3. I'm able to save it by the file name with .pdf extension and specify the folder to save it into.
    4. Repeat 20ish times for each file
    5. In Acrobat create a pdf out of multiple files
    6. Then make a print of all of them together for myself
    7. Email to client
    Can anyone help me figure out a way to stream line this procedure, there must be a way, this is way to time consuming?
    Thanks in advance!

    Thanks Dave but that is a very restricting way of doing this. Anyway I have worked it out.
    Get script "AddFilename20pt.jsx" from http://www.jkost.com/photoshop.html
    Place script in scripts folder in SC5
    restart PS
    Use script within an action to size and place the file name where you want over the image. Bevel emboss, drop shadow do what you want with it.
    It is found under > File > Scripts > AddFilename20t
    Done.

  • I am having problem with trying to install the printer with wireless connection​.i have windows 7

    the blue light on top of the printer blinks very fast and intermitenly.  i cannot install the printer with wireless.  I tried with the CD that came with the printer but the green install bar just stops and freezes.  I have a 4 month old Dell laptop.  Printer just purchased from HP is Laser Jet Professional P1102w.

    Are there any third party firewalls installed (e.g. Kaspersky, Norton, BitDefender, etc.)?  It sounds like something is blocking the software and third party firewalls have been known to block communication with the printer.
    How far in the installation process do you get (what options are you able to get to)?
    Is the USB cable connected at the start of the installation?  
    Do you receive any errors at all?  If so, what are they?
    Have you tried using Smart Install?  Smart Install works by connecting the USB cable to the computer.  By default, you should get a prompt to run a file.  Running this file starts the Smart Install process.  
    This video is a good guide to Smart Install.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Safari 7.0.6, using Adobe Acrobat 11.0.10, aren't rendering pdf files in the Print Preview screen.  Additionally, only a single, blank page prints for a multi-page pdf document.  Any ideas?

    Safari 7.0.6, using Adobe Acrobat 11.0.10, isn't rendering pdf files in the Print Preview screen.  Additionally, only a single, blank page prints for a multi-page pdf document.  Any ideas?

    Figured it out.  It had nothing to do with the software levels of Safari or Adobe Acrobat.  Here's the fix:
    Open Finder/Applications
    Search "Internet Plug-Ins"
    Move any Adobe plug-ins to the trash
    Quit Safari
    Launch Safari
    Your pdf document should now render in Print Preview and print properly.

  • How to Send a .txt file through FTPTARGET connector of Integration Broker

    Hi,
    Is it possible to send a .txt file(infact anyfile other than xml format) to a host server using FTP Target connector of Integration Broker. If so can someone explain the steps to achieve it.
    Regards,
    Uday

    Yes, you can do that. I've done exactly that couple years ago.
    If I remember currently, below is a high level of how I did it.
    Read the file you want to send into the buffer using GetString function like:
    +/*A single string containing the entire contents of the file including line terminator.+
    +     After this method completes successfully, the temp file is deleted.*/+
    +&FileData = &FiletoRead.GetString();+
    The function deletes the file so I had to create a temp copy of what i want to send and read that copy instead of the original file. Also, IB will have issues if you are trying to send an empty file. so i did a basic check, if the file is empty then put something in it.
    rem -- IB message will fail if we are trying to send an empty file;
    If None(&FileData) Or
    +&FileData = "" Or+
    +&FileData = " " Then+
    MessageBox(0, "", 0, 0, ("File " | &sTargetFileName | " is empty."));
    +&FileData = "No Data Found!";+
    End-If;
    Next, you need to load the file data that are now in &FileData to IB:
    +&MSG = CreateMessage(@&sServiceOperation);+
    +/* Generate the XML doc. */+
    +&dFtp = CreateXmlDoc("");+
    rem -- &bReturn = &dFtp.LoadIBContent("Some text inside of a file to send through IB!");
    +&bReturn = &dFtp.LoadIBContent(&FileData);+
    Then put XML into the message and publish it:
    +/*put the XML in the message*/+
    +&MSG.SetXmlDoc(&dFtp);+
    +%IntBroker.Publish(&MSG);+
    You might need to load some IBConnectorInfo and override them using your PC. I had to do that to get the password for the FTP transmission encrypted:
    /* Encrypt the password */
    &pscipher = CreateJavaObject("com.peoplesoft.pt.integrationgateway.common.EncryptPassword");
    &encPassword = &pscipher.encryptPassword(&sPassword);
    &pscipher = Null;
    Good luck and hope this helps.

  • Loading .txt file in the Database

    I want to load .txt file in a table with datatype as LONG.
    Please Specify how i do i upload it using SQL Loader or any other Utility.
    Detail step would be a great help as this very urgent.
    Thanks
    Mona

    Check the SQL*Loader chapter of the Utilities book: http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a76955/toc.htm

  • Captivate 8 - How to change to producing "project.json" file instead of a "project.txt" file?  Having issues with viewing published projects due to this.

    Captivate 8 - How to change to producing "project.json" file instead of a "project.txt" file?  Having issues with viewing published projects due to this.   Would be thankful fo rany/all advice.

    I'm having the same issue. I've been able to work around it by opening the txt file and copying the contents. Then I open a new file in Sublime Text 2, paste the contents and save the new file as "project.json". It seems to work, but it'd been nice if I didn't have to do this everytime I publish a new project.

  • How to Load the cap file to the SSD with DAP

    Dear everybody,
    How to use upload, load and install command to load cap file to the SSD with DAP?
    My step:
    1 I have already input the DAP Key into the SSD.
    2 Select ISD
    3 Do auth
    4 Upload -s ssdaid -d "XXX.cap", but JCOP return 6985.
    I don't kown why.
    Thank you very much.
    Edited by: Ivy_D on May 20, 2009 12:16 AM

    (The JCOP3.1,1 Eclipse Plugin's emulator) install for load still complains 6985 after i did these belows step by step. I will appreciate yours helps very much!
    1: install a new security domain.
    cm> install -s -b -i A000000003535042 A0000000035350 A000000003535041
    => 80 E6 0C 00 20 07 A0 00 00 00 03 53 50 08 A0 00 .... ......SP...
    00 00 03 53 50 41 08 A0 00 00 00 03 53 50 41 01 ...SPA......SPA.
    C0 02 C9 00 00 00 ......
    (5227 usec)
    <= 90 00
    cm> /select A000000003535041
    => 00 A4 04 00 08 A0 00 00 00 03 53 50 41 00 ..........SPA.
    (2303 usec)
    <= 6F 10 84 08 A0 00 00 00 03 53 50 41 A5 04 9F 65 o........SPA...e
    01 FF 90 00 ....
    Status: No Error
    2.1 use the ISD key to build a security channle by ISD to personalize the new secuirty domain
    cm> set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm> auth
    => 80 50 00 00 08 40 74 01 18 F9 FA 68 07 00 [email protected]..
    (2274 usec)
    <= 00 00 57 F3 97 D9 7F 72 88 55 FF 02 00 02 81 8D ..W....r.U......
    91 65 B4 F2 A9 29 B2 C0 A4 AD FD C5 90 00 .e...)........
    Status: No Error
    => 84 82 00 00 10 DE 01 A2 F1 79 12 8F 2E 87 6F FE .........y....o.
    63 0E E4 5D 40 c..]@
    (1969 usec)
    cm> put-pub-key --tokenpin 123456 115 c:/gptest.p12
    => 80 D8 00 01 88 73 A1 80 EA 15 24 8C 5C 26 E1 31 .....s....$.\&.1
    02 FE B1 44 0E 37 4F D5 49 29 25 14 5C 7B E0 63 ...D.7O.I)%.\{.c
    87 0C E8 B8 03 FF AF 0B F2 2B 54 6A 16 4A D6 8F .........+Tj.J..+
    EE B6 E0 1A 29 F2 13 E8 2B 04 FC 5F 2F D2 51 ED    ....)....._/.Q._
    _18 40 D3 E1 AF 36 CA A2 58 45 AC 38 3D 5F D4 56 [email protected]=_.V
    56 D8 87 5D 45 86 B9 36 F0 07 88 AD 59 78 A1 03 V..]E..6....Yx..
    2D F4 DE E9 51 E3 75 65 E3 2B B7 49 11 A5 E3 75 -...Q.ue.+.I...u
    39 25 1C 44 FB D5 3C 57 40 DD 64 22 D0 0A 8E 88 9%.D..<[email protected]"....
    2C 52 7B E2 67 A4 0B 65 A0 03 01 00 01 00 ,R{.g..e......
    (2614 usec)
    <= 73 90 00
    cm> card-info
    => 80 F2 80 00 02 4F 00 00 .....O..
    (1488 usec)
    <= 08 A0 00 00 00 03 00 00 00 01 9E 90 00 .............
    Status: No Error
    => 80 F2 40 00 02 4F 00 00 [email protected]..
    (2125 usec)
    <= 08 A0 00 00 00 03 53 50 42 0F C0 90 00 ......SPB....
    Status: No Error
    => 80 F2 10 00 02 4F 00 00 .....O..
    (1794 usec)
    <= 07 A0 00 00 00 03 53 50 01 00 01 08 A0 00 00 00 ......SP........
    03 53 50 41 90 00 .SPA..
    Status: No Error
    Card Manager AID : A000000003000000
    Card Manager state : OP_READY
    Sec. Domain:{color:#ff0000}PERSONALIZED (SV------) A000000003535042{color}
    Load File : LOADED (--------) A0000000035350 (Security Domain)
    Module : A000000003535041
    cm> /cap-sign --tokenpin 123456 a.cap A000000003535042 c:/gptest.p12
    cm> /cap-info a.cap
    SHA (Load File data): {color:#ff0000}1BD8F3CCC0042A5EEF9845FA3C667834051F4FAD{color} -- Load File Data Block Hash
    SHA (Load File dbg) : A36B4AED89FF8C4B8D8BBDDEB40757E36477143F
    SHA (Load File) : 0D4AD84E20D00C26ABA1BF5677636414234F5743
    DAP block(s) :
    DAP block : 1
    AID : A000000003535042
    Signature : 19F414292C00F9B7C89E7341A13AF15B
    CCF90D17A112418EAF556B5172EBE39C
    E05DF0CDDD68EFD2559CC7EC591878DF
    14B5C0FBC5C6CF6A0DC6E50B4AC99216
    7D6C46DC4098E0A1AC11DB69596E4A71
    F34CBFBD7DFABA88C6E8C2348FF8A9FC
    A8E22074B4D1B9D2AB5993A539BE8E1F
    6187252B9912909AE1DA4E5FAE866960
    Algorithm : VOP 2.0.1'
    Signed by : c=CN, st=beijing, l=beijing, o=logis, ou=logiscn, cn=gptest
    Load Token(s) : none
    Install Token(s) : none
    then send install for load
    cm> send 80E602002908{color:#ff0000}72666370626F6332{color}08{color:#ff0000}A000000003535042{color}14{color:#ff0000}1BD8F3CCC0042A5EEF9845FA3C667834051F4FAD{color}000000
    => 80 E6 02 00 29 08 72 66 63 70 62 6F 63 32 08 A0
    00 00 00 03 53 50 42 14 1B D8 F3 CC C0 04 2A 5E
    EF 98 45 FA 3C 66 78 34 05 1F 4F AD 00 00 00
    (3108 usec)
    <= 69 85 i.
    Status: Conditions of use not satisfied

  • Help reading a .txt file from the hard drive....

    Hi guys,
    Ok... I need to know how to read a .txt file from the hard drive... I have an example on how to read from a disk, but I don't have a disk drive. I could be confusing terminology, but I don't think I am. Here is the code I have for reading from a disk.. please let me know how I should change it to read from a hard drive.
    Also, when the error pops up, it says that it can't read another .txt file that is not specified in the code... any ideas how that is occuring? Please advise.
    import java.io.*;
    public class TEST {
    public static void main(String args[]) throws Exception{
    FileReader fr = new FileReader("customer.txt");
    BufferedReader bfr = new BufferedReader (fr);
    String s;
    while ((s=bfr.readLine())!= null){
    System.out.println (s);
    fr.close();
    }

    Ok... I need to know how to read a .txt file from the
    hard drive... I have an example on how to read from a
    disk, but I don't have a disk drive. I could be
    confusing terminology, but I don't think I am. Here
    is the code I have for reading from a disk.. please
    let me know how I should change it to read from a
    hard drive.The code will be the same, regardless of where the file is located. It's just the filename that will be different.
    Also, when the error pops up, it says that it can't
    read another .txt file that is not specified in the
    code... any ideas how that is occuring? Please
    advise.Probably becuase the class file (compiled version of the source code) is a different version to the source code, i.e. the source code hasn't been recompiled since the source code was changed.
    How does this relate to EJBs?

Maybe you are looking for

  • Windows XP not freezing anymore

    I've seen a lot of other frustrated users trying to load Windows XP and then freezing after the Mac driver install. The same thing was driving me crazy with my MBP 15" 2.33 C2D 2GB 160GB 10.5.4 setup. However, I did get Windows XP SP 2 to finally wor

  • Please help me with this etrecheck report!

    Please help me understand this report. Note: I've noticed that it has taken me longer to login after installing Yosemite. My computer has frozen a few times already and has shut itself down once or twice..also I have this annoying pop-up "To view thi

  • Can a servlet read a jsp file and display its contents?

    Hi, I would like to know if Servlets can read a Jsp file and display its contents.. Right now for our website, I am using a html file to be displayed after a successful post operation through the Servlets... -Thanks!

  • Exception in thread "main" java.lang.UnsatisfiedLinkError

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no LabIfxEC in java.library.path (LabIfxEC was compiled by ESQL/C of INFORMIX) My Java code as: public class LabEC      public int labnum;      public LabEC()           labnum = 0;      publi

  • ECATT benefits for ABAP developers

    Dear All, I'm new to eCATT, but have gone through eCATT tutorial successfully. My question is not about how to use SECATT transaction rather I'm interested in using eCATT from a ABAP developer point of view. Since, functional testing is main responsi