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.

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
// 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.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
   }Hope that helps.

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.

  • 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

  • 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.setDataAndType(uri, "ePrintWebContent/*");
    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?​/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.
    Navigate Callback ‏24 KB
    Navigate ‏15 KB
    DocumentComplete ‏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

    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.
    (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?

    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("");
    BufferedReader in = new BufferedReader(new InputStreamReader(u.openStream()));
    while ((s = in.readLine()) != null) {
    Unforturnately, the output is the soucecode of the html file and I just want the content.
    Please help me.
    Thanks a lot in advance,

    Here's a simple example
    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?

    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

  • 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?

    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.

  • 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

  • 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 -
    # Use the Firefox Sync extension to synchronize the bookmarks -
    # If you want bookmarks on the netbook to be replaced with those from the laptop used the method in the following link -
    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

    Maybe this will help:

Maybe you are looking for

  • How Can I Use Bluetooth For Sharing With iPhones?

    Hello, i have an iPod touch 3rd Gen. 32GB, And I'm Wondering How Could I Share Music or Photos With My Cousin's iPhone (Jailbroken iPhone), When I Turn The Bluetooth On, Nothing Shows Up On My iPod Or On Here iPhone, So How Could I Share Things With

  • Is it possible to circumvent read-only after a pdf has been signed?

    Hi, my pdf has a signature field.  In the signed event I have make all fields read-only.  Is it possible for someone to come along and make them not read-only anymore?  It seems the easiest way to make my document tamper-proof.  Thank you.

  • Laptop boots up but display is intermittent

    laptop boots ok and display is available on external monitor or hdmi to tv. lap top display backlight is lit, but screen is blank. This question was solved. View Solution.

  • Help interpreting  v$rowcache_parent output

    Hi, what saddr = 00 means in that output : SQL> select count(*) , saddr from v$rowcache_parent group by saddr order by 1 desc;   COUNT(*) SADDR     413532 00          2 00000001DF739E88DB is RAC . Regards. Greg

  • My ipad freeze and cannot shut down

    My ipad freeze while my daughter is playing her kids game.i try to shut down the ipad by pressing the start button but it wont help and now battery is drained flat.What can i do after recharging it.Tx