Problem in Printing HTML page

While I am trying to print a HTML page using window.print(), the bgcolor of the table is not printing.

Did you consider inquiring about this at a Javascript or HTML forum?

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"

  • Ever since Firefox did an update I have printing problems. Prints partial pages and spreads out over several sheets. I use Mac OS X 10.4.11

    Ever since Firefox did an update I have printing problems. Prints partial pages and spreads out over several sheets. I use Mac OS X 10.4.11

    See this: <br />
    http://kb.mozillazine.org/Problems_printing_web_pages#Prints_to_a_small_portion_of_the_page

  • Problem Printing html page with JEditorPane...

    Hello All,
    I Have a problem in printin html file with JEditorPane...
    My Html file contains a Table on it..
    Problem is that JEditorPane displays the html file correctly but
    it prints the file without print that Table..
    So pls help me...
    Thanx in advance,..
    Amit
    [email protected]

    I think you would know how to retrieve content of an HTML page using the URL object. Just in case.
    My apology if this short note doesn't help you at all.

  • Problems printing html page created from servlet

    Hi
    How do I go about to print a html page that spans outside the visible window (to the left). All I get when I print is the visible page.
    Is it at all possible?
    Would appreciate an answer.
    Thanks
    David Mossberg

    No, not impossible to do.
    You need to provide a printer friendly version of the content so that it spans correctly.
    Again, this is not a Java problem this is an Application problem.
    How you format the data is down to you.

  • Problem with printing HTML container

    Hi all,
    I am having a problem with FlexPrintJob (or PrintJob) for the
    mx.controls.HTML container. On print i receive only one page (only
    the visible area) of my HTML container. How can i print multiple
    pages from mx.controls.HTML?
    Please Help!!!

    And here we have the problems with Adobe's take on printing.
    It would be much easier for every developer, if they could say
    "HTMLContainer.print()" and have it print all of the text contained
    in the html container, maybe even with integrated use of CSS print
    stylesheets...
    But, for the time being, the easiest method is to break all
    of the text out into a second invisible (alpha = 0 NOT
    visible=false) html container that is sized to the dimensions of
    your page. Then you call addPage, scroll the container exactly 1
    page, and call addPage again, repeating until you reach the end of
    your content. This method of printing is necessary for people
    developing an image builder, that want to make multi-sheet prints.
    But people who are writing RIA's have the need to make multi-sheet
    prints of TEXT that is not in a datagrid on a regular basis. This
    is a SERIOUS limitation, and should have been taken care of prior
    to the release of AIR 1.0

  • Printing html pages from JSF-JSC created pages

    Hi all,
    I have a serious problem with my web apps created with JSC using the JSF components. I designed a page full of tables, developed in vertical for a total of about three or four pages scrolling down.
    When I try to print the generated page from the browser (Firefox, Safari, Explorer) I always get just the first 'page', the entire webpage generated by my application is not saw as a long page, but just 'cutted' out.
    It seems like all JSF components have some problems being like layers or so...any hint? How can I print my html page generated by my web app?
    G

    Perhaps viewing the source of the generated html page will give you a clue to what's wrong..

  • Problem in Opening HTML Page in Internet Explorer from my Swing Application

    Hi,
    I am opening a HTML file in Internet Explorer from my swing application.I am using the code given below
    private final static String WIN_FLAG = "url.dll,FileProtocolHandler";
    private final static String WIN_PATH = "rundll32";
    String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
    // url is HTML file Path
    Process p = Runtime.getRuntime().exec( cmd );
    Here there are two things i need to address ...
    1)The HTML file is opening up,but it always opens behind the swing application,that makes me every time to maximize the HTML file after it being opened up.I want to open it in front of the Swing Application.I need to implement "Always On Top" functionality for the html page.
    2)Whenever i trigger action to open different HTML page,it opens in new Internet Explorer window.
    I need to open it in same IE window.
    how to solve out these problems ??? any help would be greatly appreciated .Thanks in advance.
    - Manikandan

    any idea about this ????

  • Unable to print HTML pages

    After a good bit of reading, I found that printing HTML directly to the printer doesn't work for many printers. I don't want to print the code. I want the actual HTML page. I have some code here that reads the HTML file into a JEditorPane and then is rendered into a graphic for printing.
    My code compiles fine, I'm not getting any errors, but what I'm also not getting is any pages printing.
    Here is the source of my class:
    * PrintReport.java
    * @author tristan
    * Created on September 27, 2007, 4:06 PM
    package fedex;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import java.io.*;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.ServiceUI;
    import javax.print.SimpleDoc;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.swing.JEditorPane;
    import javax.swing.RepaintManager;
    public class PrintReport
        private FileInputStream fileIS;
        private Doc doc;
        private DocAttributeSet das = new HashDocAttributeSet ();
        PrintService defaultService;
        /** Creates a new instance of PrintReport */
        public PrintReport ()
        public void printHTMLFile (String file) throws FileNotFoundException, IOException
            PrintableEditorPane jEditorPane = new PrintableEditorPane ();
            jEditorPane.setContentType ("text/html");
            jEditorPane.read (new BufferedInputStream (new FileInputStream (file)), "");
            System.out.println (jEditorPane.getText ());
            PrinterJob job = PrinterJob.getPrinterJob ();
            job.setPrintable (jEditorPane);
            if (job.printDialog ())
                try
                    job.print ();
                catch (Exception ex)
                    System.out.println (ex);
        public class PrintableEditorPane extends JEditorPane implements Printable, Serializable
            public int print (Graphics g, PageFormat pf, int pageIndex) throws PrinterException
                Graphics2D g2 = (Graphics2D)g;
                g2.setColor (Color.black);
                RepaintManager.currentManager (this).setDoubleBufferingEnabled (false);
                Dimension d = this.getSize ();
                double panelWidth = d.width;
                double panelHeight = d.height;
                double pageWidth = pf.getImageableWidth ();
                double pageHeight = pf.getImageableHeight ();
                double scale = pageWidth / panelWidth;
                int totalNumPages = (int)Math.ceil (scale * panelHeight / pageHeight);
                System.out.println ("Total pages to print are " + totalNumPages);
                if (pageIndex >= totalNumPages) return Printable.NO_SUCH_PAGE;
                g2.translate (pf.getImageableX (), pf.getImageableY ());
                g2.translate (0f, -pageIndex * pageHeight);
                g2.scale (scale, scale);
                this.paint (g2);
                return Printable.PAGE_EXISTS;
    }I tried using a complex HTML file as well as a basic one, but everytime Total pages to print are 0 is printed back to the console. I can't figure out why it's unable to create any pages to print.

    DrClap wrote:
    I think you will find thatDimension d = this.getSize ();produces (0, 0) until you actually display your component somewhere. I believe it's possible to "display" it in such a way that it doesn't appear on the user's screen, but I don't know how.
    There's a Swing forum here where you get answers from people who are good at Swing. Posting here attracts answers from people like me who are mediocre at it.I think that calling validate() on a Container will lay it out and size it's components, even if it hasn't been made visible, but don't take my word for it.

  • Problem in refreshing html page using LinkToURL API

    Hi all,
    I use LinkToURL in order to open a html page in a new window. My problem is that this html file is changed (the name is the same but the contents is diff) dynamically. I click on the link and the window is open, but later on when the html file is changed and I reopen the window it shows the old html file. Is it possible to refresh this window automatically every time when it is opened? Otherwise the user has to press Refresh button in order to see the new html file.
    10x for your help.
    Svetlomira

    Hi Svetlomira,
    Do you have access to html file? Can you changed it?
    Or you can use following approach: if html is static (not jsp or asp or similar)
    you can append System.currentTimeMillis() to the html file name after '?' sign:
    final String nonCachedURL = "http://www.domain.com/index.html?" + System.currentTimeMillis();
    You can achieve this by using calculated context attribute and bind it with LinkToUrl`s reference proprty.
    Best regards, Maksim Rashchynski.

  • Printing HTML PAGE in a Applet

    I am tryng to print a HTML Page in a Applet .
    When Using Eclipse Environment everythig goes fine.
    Now I am trying to use the appletviewer to run the same
    source, but it appears the following:
    http://10.15.1.26/
    Conecting to http://10.15.1.26/
    Exception in thread "AWT-EventQueue-2" java.lang.RuntimeException: java.security.AccessControlException: access denied (java.net.SocketPermission 10.15.1.26:80 connect,resolve)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
         at java.net.HttpURLConnection.getResponseCode(Unknown Source)
         at javax.swing.JEditorPane.getStream(Unknown Source)
         at javax.swing.JEditorPane.setPage(Unknown Source)
         at javax.swing.JEditorPane.setPage(Unknown Source)
         at javax.swing.JEditorPane.<init>(Unknown Source)
         at AppletPrintHTML$EditorPaneHTMLViewer.loadStartingPage(AppletPrintHTML.java:90)
         at AppletPrintHTML$EditorPaneHTMLViewer.<init>(AppletPrintHTML.java:103)
         at AppletPrintHTML$5.actionPerformed(AppletPrintHTML.java:364)
         at java.awt.Button.processActionEvent(Unknown Source)
         at java.awt.Button.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission 10.15.1.26:80 connect,resolve)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    Why I am not allowed to connect to the site without Eclipse? Any Idea?
    Angel Portal

    This code
              * Load a HTML Page
              private void loadStartingPage() {
              try {
                   System.out.println("Conectando a "+ path);
                   mainPane = new JEditorPane(path);
                   } catch (IOException e) {
                        System.err.println("N�o Pode Conectar");
                        System.exit(1);
    Open a html page ( path ) on JEditorPane!
    In Eclipse worked just fine!
    But if I try to do that on a Browser or appletviewer the error a told you shows up.
    I am reading about the The Permission Classes.Someone have heard of it?

  • Safari prints HTML page as blank

    When I load an HTML page in Safari and print it, it's totally blank. Doesn't happen in Firefox with the same HTML files.

    Hi John,
    I don't see anything in the console that would be relevant. I'm happy to send you a log if you'd like to see it. (Lots of crap from TextExpander )
    Yes, the thumbnail is blank.
    I should mention I've already tried moving my printer plists to the trash.
    Thanks

  • Printing HTML PAGE

    Java has some Class to handle HTML Pages.
    I want to build a Button that is able to print the
    actual page of the Browser.
    I know about ClipBoard Class, SomeOne has
    some Idea how to do this?
    The idea is to create an applet that creates a button
    to print the actual HTML page.
    Some Idea how to do this, or where I can get this
    information?
    Angel -Portal

    Hello, I got your advise and I could write a small program
    to open a URL ,put it in a JEditorPane like you sad.
    public class EditorPaneHTMLViewer extends JEditorPane implements Printable {
    Inside the code I create a menu to change to portrait to landscape.
    But now I need somehow to print the HTML Page that I took from
    internet.
    I believe that I need to load the content of the JEditorPane to a graphics
    and then set to a Format of a Page and Print, but I do not know how yet.
    Some Hint.
    That true that I could do in a easiest way in JavaScript. But it is going to
    be possible to do landscape and portrait?
    Angel Portal: [email protected]

  • Problem in displaying html page in JEditorPane....

    Hi All,
    i was trying to display a html page in a JEditorPane. i was able to do that when i'm displaying a html page from a local machine.. But when i try to get the page from some website, it giving me
    "exception access denied (java.net.SocketPermission www.java.sun.com resolve)"
    exception. But if i run the same code thru JBuilder, its working. But thru appletviewer or thru IE or Netscape its throwing the error.. Any suggestion or help is highly appreciated....
    Thanks
    Ragu

    Java Applets are very secure, what is good. Java applets are extremely secure
    what is bad. So Applet cannot open TCP connection to any host rather than its
    home host. So you cannot get the resources from any other server (what is common to
    HTTP).
    In JBuilder iit works cause JBuilder is used for development and security in deevelopment
    is not an issue. But it confuses then you see.
    vpanasenko_even

  • Problem sending a HTML page

    How can i send a HTML by email??
    When i am sending a HTML he shows the code in the mail instead of showing the HTML page??
    Anyone knows how can i solve tyhis??

    are you setting the content type to text/html? there are plenty of examples out there (and in here). run a search.

Maybe you are looking for