Print HTML File Without Showing on Screen

Hi Everyone
Is there a way to print a file (in particular, an html file) from a java app without actually displaying the file on the screen.
ie. print from command line.
I am creating an html file from within java app and would like to print it in one step.
Any help would be greatly appreciated.
Thanks
Kelly

Hi,
Heres some code from an app I wrote that prints out text. I've stripped out little sensitive bits.
// Procedure to perform when print button is pressed
   void printButton_actionPerformed(ActionEvent e){
     int x, y, pageNo = 1, maxPageHeight, textHeight = 0;
     Date today = new Date();
     String tempLine = new String("");
     String tempString = new String();
     Graphics pg;
// Create date and time formats
     SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yy");
     SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
// Create date and time strings
     currentDate = dateFormatter.format(today);
     currentTime = timeFormatter.format(today);
// Turn off double buffering
     RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);
// Get a print job
     PrintJob printjob = getToolkit().getPrintJob(this, "<printjob name>", null);
     if (printjob != null) {
       maxPageHeight = printjob.getPageDimension().height-(rowHeight*2);
       pg = printjob.getGraphics();
       if (pg != null) {
         pg.setColor(Color.black);
         pg.setFont(new Font("Courier", 0, 10));
// Print header
         textHeight = topOfPage;
         pg.drawString("Report      Date " + currentDate +
                       "      Time " + currentTime + "  Page " + pageNo,
                       30, textHeight);
         textHeight += rowHeight;
         pg.drawString("File: " + dataFile , 30, textHeight);
// Print errors
         textHeight += rowHeight*2;
         pg.drawString("Errors", 30, textHeight);
         textHeight += rowHeight;
         pg.drawString("------", 30, textHeight);
         textHeight += rowHeight;
         pg.drawString("col1         col2 col3                 Value        Reason",
                        30, textHeight);
         textHeight += rowHeight;
         pg.drawString("------------ ---- -------------------- ------------ --------------------",
                        30, textHeight);
         if(errorData != null){
           for(x = 0; x < errorData.length; x++){
             textHeight += rowHeight;
             if(textHeight > maxPageHeight){
               pg = nextPage(pg, printjob, ++pageNo);
               textHeight = topOfPage + rowHeight*2;
             tempLine = "";
             for(y=0; y<columnLengths.length; y++){
               tempString = errorData[x][y] != null ?
                            roundLength(errorData[x][y].toString(), columnLengths[y])
                            : roundLength(" ", columnLengths[y]);
               tempLine += tempString + " ";
             pg.drawString(tempLine, 30, textHeight);
         pg.dispose(); // flush page
       printjob.end();
   }Hope that helps.
Rob.

Similar Messages

  • Print html file without seeing a print dialog box

    i need to script an action that would allow a user to print a sparcly formated html file to a printer while bypassing the normal print dialog box.
    the unix lpr command seems like it might work, but the man page only mentions PS and txt files.
    Ultimately i'd want to trigger the print action from a php script, but it could be a folder action also.
    Does anyone have any suggestions or point me in the right direction.

    lp is the right command to use but you may need to convert the html file in PDF format before printing it. Just test it. Also type man lp to see more options.
    enscript is a nice utility that may help you. man enscript for more.
    Mihalis.

  • After changing my graphic card to an ASUS Strix GT 970, Photoshop CS6 opens the JPG files without show them on the screen

    After changing my graphic card to an ASUS Strix GT 970, Photoshop opens the JPG files without show them on the screen

    Try turning off GPU support in your Photoshop's preferences performance section.  Also check that you have installed the latest device driver installed for your GT 970 adapter and that all CS6 updates are installed... Your CS6 should be version 13.0.1.3....

  • Print html file via share intent

    Hello HP
    I'm a developer, I trying to print html file to HP Printer via share intent. Here is my code:
    Intent intent = new Intent("org.androidprinting.intent.action.PRINT");
    Uri uri = Uri.parse(path);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setDataAndType(uri, "ePrintWebContent/*");
    startActivity(intent);
    Nothing happen when I share this intent. Please show me right way to print html file.
    Thank you!!

    Did you look in the LabVIEW Help? http://zone.ni.com/reference/en-XX/help/371361G-01​/lvhowto/reg_hndl_ax_evnts/
    You right-click on that parameter and select Create Callback VI. This will automatically create a VI with the required inputs and outputs. This is the VI that will be called when the event occurs. If you need the callback VI to update any front panel controls of the main VI, then you can pass in control references via the User Parameter input.
    Attached is a modification of the shipping example that handles the Navigate and DocumentComplete events.
    Attachments:
    Navigate Callback Example.vi ‏24 KB
    Navigate Callback.vi ‏15 KB
    DocumentComplete Callback.vi ‏15 KB

  • Can I print a calander without showing the times of events?

    Can I print a calander without showing the times of events. Or, alternatively, is there a way to list things without having them be an event. Just notes on the day, for instance.

    It seems like a simple solution must be at hand. There is an option in the iCal Preferences (General) panel--Show event times. With this command unchecked the screen view of the month view is free of the times of day, but when I print the month view the times of day are printed.

  • Print html file with barcode from abap report

    hi
    i am printing html file from abap program using gui_execute.
    i am using netscape.exe , its printing first time and when reprint its not working
    basically html file contains gif file which has fedex barcode.
    could you please let me know how to print html file from report

    DGU wrote:
    where to check RAW or TEXT? the print report vi only asks for file name and printer name.
    When I print from notepad, everything just goes by default. This is a label printer, so I never need to specify printing parameter such as size, orientation, etc in the past
    Famous last words go something like this: "...never had to do that before."  Maybe you have to do that now.  It's worth at least comparing the defaults settings for bothe generic drivers.  It could save you a lot of headache if you notice something different.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How do I save a pdf as an html file without losing formatting?

    How do I save a pdf as an html file without losing formatting?  My coworker is able to do this on her Adobe 9 by saving to html css 4.0 - I have Adobe 11 and have not been able to save as an html at all without loosing formatting.

    Are the PDF files that you are attempting to Save As HTML tagged?

  • How to display a html file without tags?

    Hello,
    I am new for Java programming. Now i have to display a html file without all the tags. My code is the fllowing:
    u = new URL("http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=protein&val=55584070");
    BufferedReader in = new BufferedReader(new InputStreamReader(u.openStream()));
    while ((s = in.readLine()) != null) {
    System.out.println(s);
    in.close();
    Unforturnately, the output is the soucecode of the html file and I just want the content.
    Please help me.
    Thanks a lot in advance,
    Danica

    Here's a simple example
    http://forum.java.sun.com/thread.jspa?threadID=293830
    I haven't tested it, but I bet camickr did.

  • Embed  html file without using IFrame UI

    Is there any way to embed html file without using IFrame UI?

    Hi
    To embed a static HTML content inside your view, Iframe is the easiest form or else, you can provide links through Linktourl UI or through a static text or a button, invoke a action and display the HTML content inside the frame or call it in a seperate (external) window.
    Otherwise, we have only less options!
    if you have anything specific, do let us know
    thanks
    sathya

  • Print pdf files without open them

    i am using gnome and adobe reader to open pdf file. however, is there anyway i can print the files without open them ?

    lpr somefile.pdf - as long as cups is configured correctly.

  • Please wait. printer preperation occurring. keeps showing on screen

    if i hook up with usb i can print but "please wait. printer preperation occurring". keeps showing on screen can anybody help me?

    Please read this post then provide some details.  What printer model? What operating system? 
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • How print .html file?

    Hi,
    I'm a beginner printing in Java.
    What I'm trying to do is to print .html file but I don't know how to do it well.
    Please, someone who can help me to solve this problem.
    Thanks a lot!

    i have the same problem, hope some1 could help.
    cheers.

  • Printting HTML file...

    Hi all,
    anybody knows that how to print HTML file. i mean the contents which are viewable in browser.
    please let me know..
    Thanks in advance..

    check this out
    http://java.sun.com/printing/whitepaper.html

  • Importing new bookmark html file without doubling bookmarks

    I saved my bookmarks form my laptop in an html file. now I want to import that file into the bookmarks on Firefox on my netbook.
    the files are basically the same but i have dded several new bookmarks because I was using my laptop and have not used my netbook in awhile.
    how do I import the new html file without doubling the bookmarks that are already on my firefox which is running on my netbook. a lot of the folders are the same.

    There is no option to just import the new bookmarks.
    A few options.
    # Import the HTML file, then use the CheckPlaces extension to remove the duplicates - https://addons.mozilla.org/firefox/addon/checkplaces
    # Use the Firefox Sync extension to synchronize the bookmarks - https://addons.mozilla.org/firefox/addon/firefox-sync
    # If you want bookmarks on the netbook to be replaced with those from the laptop used the method in the following link - https://support.mozilla.com/kb/Backing+up+and+restoring+bookmarks
    With the last method, you backup the bookmarks to a json file and import that file onto the netbook. When you restore a json file on the other computer it will remove all bookmarks that currently exist and replace them with those in the json file.

  • Print report from client machine without showing in screen

    Hi guys!!
    I m using (forms10g+ 10gAS). I want to Print report from client machine without showing in the screen/monitor.
    Currently I m generating report in pdf format. From the pdf I m printing the document.
    But my requirements is to print directly to the printer without showing preview
    Thanks in advance
    Mokarem

    Maybe this will help:
    http://forums.oracle.com/forums/thread.jspa?messageID=1209371&#1209371
    Gary

Maybe you are looking for

  • Transaction 100000100 in company code KSID: Activity 00001 has status Replaced

    Hi Frds, When I am going to change a contract in money market instrument, I am getting this error, which in term not allowing me to change the contract. Can anybody please through some light about status profile. what is this & what is the use of thi

  • Need network security settings for wireless printer set-up

    I have an older airpot extreme base station. I'm trying to set-up my wireless brother printer and it says that I need the following network information: SSID- I know this one Authentication Method (open system/shared key/WPA-PSK/WPA2-PSK) Encription

  • Customer fields in contracts

    Hi every one I have a development Need help for this I am using srm 4.0 in the contracts at the item level in the basic data tab I have to add new field called currency which should be editable .How do I do that and prior to this in the item level li

  • What STP protocol to use?

    Guys I have recently taken over the management of a small LAN made up of 13 switches 10 Cisco and 2 Nortel switches. The network is made up of a stack of 3750E-48 Port switches (x4), 3560E-48 Port (x2), 2960G-48 (x3), 3550E-48 (x1)and 2912XL-12 (x1).

  • Macbook pro is slow.....HELP

    My 2011 Mac Book pro is slow. i do not have many applications installed except skype, iAntivirus Picasa, Microsoft Office and amazon Mp3. i dont have alot of files i many use my macbook for the internet which is also slow. How can i speed up my compu