Print html content of an JEditorPane

Hello!
I have an JEditorPane with some HTML Content displayed (as it is displayed in a browser).
Now i want to sent this content to a printer.
After some search i found the DocumentRenderer class from this link:
http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/
It may be trivial, but i don't know how to create a HTMLDocument Object from my JEditorPane (and its contents).
Maybe somebody can help me out with this.
my code so far:
DocumentRenderer renderer = new DocumentRenderer();
HTMLDocument doc = new HTMLDocument();
//At this point i don't  know how to get my JEditorPane/it's contents "into" the HTMLDocument Object
renderer.setDocument(doc);
renderer.print(doc);                               Many thanks in advance for help!

find it out by myself.
HTMLDocument doc = (HTMLDocument)myJEditorPane.getDocument();But now i ran in another problem:
Checkboxes are not displayed when i print this content.
Is it possible to solve this problem?

Similar Messages

  • How to print HTML contents

    can anyone tell me how to print HTML contents...i needed it urgently
    Thanks

    actually i have a print button on html page....when i click on print button using window.print(); the html page gets printed...but along with it print button is also printed...i dont want print button to be printed...
    this is the issue...
    please resolve it
    Thanks a lot...

  • Urgent help --  Printing HTML Content to printer from servlet

    I am wanting know if there is a way to Print Reports from servlet.I have some idea about JPS API but it shows some errors on printer services. Pls help me, if any onme having sample code mail to me [email protected]
    I want to print a html content to printer.

    Use the JavaScript window.print() function to print out the current window. However used the HTML LINK tag it can print out a report generated by a servlet without displaying the contents of the report in the browser window.

  • Printing HTML content without the printout dialog

    Hi all,
    I'm using a "CL_ISHMED_PMD_HTMLVIEWER" object to display an HTML file inside a PMD.
    Now, when I'm trying to print it, the OLE printout dialog pops up and ask me which printer I want to use.
    I want to hardcode the destination device and suppress this dialog.
    I don't mind setting an outside button in my PMD and print the file in an other way (directly printing the file maybe), but it MUST be without the dialog.
    Does anyone have an idea?
    Cheers,
    Ido

    Hi,
    Goto SU01 transaction.
    Enter your user id & click display
    Goto PARAMETERS tab
    enter PRI & value as LOCL or LP01 depending on the output device which you have configured for SAP.( You can check the same in SPAD transaction => Output device)
    SAVE
    You wont get the popup.
    Best regards,
    Prashant

  • Print HTML file inside JEditorPane

    Hi Guys,
    I'm trying to print the contents of a JEditorPane - actually, a html file that I read and display in that component from the underlying file system. I've had the class that manages the JEditorPane implement Printable - the following is my print() implementation:
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
              throws PrinterException {
              if (pageIndex > 0) {
                   return (NO_SUCH_PAGE);
              } else {
                   Graphics2D g2d = (Graphics2D) graphics;
                   g2d.translate(
                        pageFormat.getImageableX(),
                        pageFormat.getImageableY());
                   ivTextArea.paint(g2d);
                   return (PAGE_EXISTS);
    }I've got another method that gets called when a print button is clicked:
    class .... {
      PrintJob pj;
      PageFormat pf;
    private void printMe() {
               if (pj == null) {
                   pj = PrinterJob.getPrinterJob();
                   pf = pj.defaultPage();
                   pf.setOrientation(PageFormat.PORTRAIT);
              pf = pj.pageDialog(pf);
              pj.setPrintable(this, pf);
              try {
                   pj.print();
              } catch (PrinterException e) {
                   throw new RuntimeException(e);
    }Clearly I'm doing smth wrong, since only a single page gets printed and moreover the formatting is awful [text gets cut instead of moving on the next line]. Can someone help?
    Thanks much!

              if (pageIndex > 0) {
                   return (NO_SUCH_PAGE);This is why you only get a single page.
    page gets printed and moreover the formatting is
    awful [text gets cut instead of moving on the next
    line]. Can someone help?Yeah. Your best bet is either to put the editorpane in a scrollpane and just print what's visible, OR, you can take the print graphics object, convert it into a graphics2D object, and call scale on that by comparing component.getWidth/height to PageFormat.getImageableWidth/Height
    I'm attaching my StandardPrint class. It uses the pageable interface to carry the number of pages + page format as well. I'm not sure if I did the scaling here or not, but I've done it before so I know it works :-) Also, I've got methods for previewing the print, which can save a lot of paper.
    Please feel free to have and use this class, but please do not change the package or portray this as your own work
    =============================
    package tjacobs.print;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.print.*;
    import javax.print.PrintException;
    public class StandardPrint implements Printable, Pageable {
        Component c;
        SpecialPrint sp;
        PageFormat mFormat;
        public StandardPrint(Component c) {
            this.c = c;
            if (c instanceof SpecialPrint) {
                sp = (SpecialPrint)c;
        public StandardPrint(SpecialPrint sp) {
            this.sp = sp;
        public void start() throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            if (mFormat == null) {
                mFormat = job.defaultPage();
            job.setPageable(this);
            if (job.printDialog()) {
                job.print();
        public void setPageFormat (PageFormat pf) {
            mFormat = pf;
        public void printStandardComponent (Pageable p) throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPageable(p);
            job.print();
        private Dimension getJobSize() {
            if (sp != null) {
                return sp.getPrintSize();
            else {
                return c.getSize();
        public static Image preview (int width, int height, Printable sp, PageFormat pf, int pageNo) {
            BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            return preview (im, sp, pf, pageNo);
        public static Image preview (Image im, Printable sp, PageFormat pf, int pageNo) {
            Graphics2D g = (Graphics2D) im.getGraphics();
    //        PageFormat pf = sp.getPageFormat(pageNo);
    //        int width = im.getWidth(null);
    //        int height = im.getHeight(null);
    //        g.setColor(Color.WHITE);
    //        g.fillRect(0, 0, width, height);
    //        double hratio = height / pf.getHeight();
    //        double wratio = width / pf.getWidth();
    //        g.scale(hratio, wratio);
            try {
                   sp.print(g, pf, pageNo);
              catch(PrinterException pe) {
                   pe.printStackTrace();
            g.dispose();
            return im;
        public int print(Graphics gr, PageFormat format, int pageNo) {
            mFormat = format;
            Graphics2D g = (Graphics2D) gr;
            g.translate((int)format.getImageableX(), (int)format.getImageableY());
            Dimension size = getJobSize();
            if (pageNo > getNumberOfPages()) {
                return Printable.NO_SUCH_PAGE;
            int horizontal = getNumHorizontalPages();
            int vertical = getNumVerticalPages();
            int horizontalOffset = (int) ((pageNo % horizontal) * format.getImageableWidth());
            int verticalOffset = (int) ((pageNo / vertical) * format.getImageableHeight());
            double ratio = getScreenRatio();
            g.scale(1 / ratio, 1 / ratio);
            g.translate(-horizontal, -vertical);
            if (sp != null) {
                sp.printerPaint(g);
            else {
                c.paint(g);
            g.translate(horizontal, vertical);
            g.scale(ratio, ratio);
            g.translate((int)-format.getImageableX(), (int)-format.getImageableY());
            return Printable.PAGE_EXISTS;
        public int getNumHorizontalPages() {
            Dimension size = getJobSize();
            int imWidth = (int)mFormat.getImageableWidth();
            int pWidth = 1 + (int)(size.width / getScreenRatio() / imWidth) - (imWidth == size.width ? 1 : 0);
            return pWidth;
        private double getScreenRatio () {
            double res = Toolkit.getDefaultToolkit().getScreenResolution();
            double ratio = res / 72.0;
            return ratio;
        public int getNumVerticalPages() {
            Dimension size = getJobSize();
            int imHeight = (int)mFormat.getImageableHeight();
            int pHeight = (int) (1 + (size.height / getScreenRatio() / imHeight)) - (imHeight == size.height ? 1 : 0);
            return pHeight;
        public int getNumberOfPages() {
            return getNumHorizontalPages() * getNumVerticalPages();
        public Printable getPrintable(int i) {
            return this;
        public PageFormat getPageFormat(int page) {
            if (mFormat == null) {
                PrinterJob job = PrinterJob.getPrinterJob();
                mFormat = job.defaultPage();
            return mFormat;
    }>
    Thanks much!

  • Printing HTML with Java Printing Service(JDK1.4 beta)

    Hi there!
    I'm currently checking out the new Java Printing Service (JPS) in the new JDK1.4 beta. This looks like a very promising printing API, with amongst others printer discovery and support for MIME types - but I have some problems with printing HTML displayed in a JEditorPane.
    I'm developing an application that should let the user edit a (HTML)document displayed in a JEditorPane and the print this document to a printer. I have understood that this should be peace-of-cake using the JPS which has pre-defined HTML DocFlavor amongst others, in fact here is what Eric Armstrong says on Javaworld (http://www.javaworld.com/javaone01/j1-01-coolapis.html):
    "With JPS, data formats are specified using MIME types, for example: image/jpeg, text/plain, and text/html. Even better, the API includes a formatting engine that understands HTML, and an engine that, given a document that implements the Printable or Pageable interface, generates PostScript. The HTML formatting engine looks particularly valuable given the prevalence of XML data storage. You only need to set up an XSLT (eXtensible Stylesheet Language Transformation) stylesheet, use it to convert the XML data to HTML, and send the result to the printer."
    After one week of reasearch I have not been able to do what Armstrong describes; print a String that contains text of MIME type text/html.
    I have checked the supported MIMI types of the Print Service returned by PrintServiceLookup.lookupDefaultPrintService(). This is the result:
    DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(MediaSizeName.ISO_A4);
    aset.add(new Copies(2));
    PrintService[] service = PrintServiceLookup.lookupPrintServices(flavor,aset);
    if (service.length > 0) {
    System.out.println("Selected printer " + service[0].getName());
    DocFlavor[] flavors = service[0].getSupportedDocFlavors();
    for (int i = 0;i<flavors.length;i++) {
    System.out.println("Flavor "+i+": "+flavors.toString());
    Selected printer \\MUNIN-SERVER\HP LaserJet 2100 Series PCL 6
    Flavor 0: image/gif; class="[B"
    Flavor 1: image/gif; class="java.io.InputStream"
    Flavor 2: image/gif; class="java.net.URL"
    Flavor 3: image/jpeg; class="[B"
    Flavor 4: image/jpeg; class="java.io.InputStream"
    Flavor 5: image/jpeg; class="java.net.URL"
    Flavor 6: image/png; class="[B"
    Flavor 7: image/png; class="java.io.InputStream"
    Flavor 8: image/png; class="java.net.URL"
    Flavor 9: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    Flavor 10: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"
    As you can see there is no support for text/html here.
    If anyone has a clue to what I'm missing here or any other (elegant, simple) way to print the contents of a JEditorPane, please speak up!
    Reply to: [email protected] or [email protected] or here in this forum

    Since you have 'printable' as one of your flavors, try this using a JTextPane (assuming you can dump your HTML into a JTextPane, which shouldn't be a big problem)...
    1. Have your JTextPane implement Printable
    ie. something like this:
    public class FormattedDocument extends JTextPane implements Printable 2. Read your HTML into the associated doc in the text pane.
    3. Implement the printable interface, since you have it as one of your available flavors (I'd imagine everybody has printable in their available flavors). Something like this:
    public int print(Graphics g, PageFormat pf, int pageIndex) {
            Graphics2D g2 = (Graphics2D) g;
            g2.translate((int)pf.getImageableX(), (int)pf.getImageableY());
            g2.setClip(0, 0, (int)pf.getImageableWidth(), (int)pf.getImageableHeight()); 
            if (pageIndex == 0)
                setupPrintView(pf);
            if (!pv.paintPage(g2, pageIndex))
                return NO_SUCH_PAGE;
            return PAGE_EXISTS;
        }Here's my setupPrintView function, which is executed once on page 0 (which still needs some polishing in case I want to start from page 5). It sets up a 'print view' class based on the root view of the document. PrintView class follows...
    public void setupPrintView(PageFormat pf) {
    View root = this.getUI().getRootView(this);
            pv = new PrintView(this.getStyledDocument().getDefaultRootElement(), root,
                               (int)pf.getImageableWidth(), (int)pf.getImageableHeight());Note of obvious: 'pv' is of type PrintView.
    Here's my PrintView class that paints your text pane line by line, a page at a time, until there is no more.
    class PrintView extends BoxView
        public PrintView(Element elem, View root, int w, int h) {
            super(elem, Y_AXIS);
            setParent(root);
            setSize(w, h);
            layout(w, h);
        public boolean paintPage(Graphics2D g2, int pageIndex) {
            int viewIndex = getTopOfViewIndex(pageIndex);
            if (viewIndex == -1) return false;
            int maxY = getHeight();
            Rectangle rc = new Rectangle();
            int fillCounter = 0;
            int Ytotal = 0;
            for (int k = viewIndex; k < getViewCount(); k++) {
                rc.x = 0;
                rc.y = Ytotal;
                rc.width = getSpan(X_AXIS, k);
                rc.height = getSpan(Y_AXIS, k);
                if (Ytotal + getSpan(Y_AXIS, k) > maxY) break;
                paintChild(g2, rc, k);
                Ytotal += getSpan(Y_AXIS, k);
            return true;
    // find top of page for a given page number
        private int getTopOfViewIndex(int pageNumber) {
            int pageHeight = getHeight() * pageNumber;
            for (int k = 0; k < getViewCount(); k++)
                if (getOffset(Y_AXIS, k) >= pageHeight) return k;
            return -1;
    }That's my 2 cents. Any questions?

  • Finding HTML content bounds in JComponents

    I'm developing an application that uses JComponents to print HTML content.<br><br>My problem is that I can't find a way to get the bounds of HTML content in JLabel.<br><br>This represents a huge problem because it means that I don't know when to split pages.<br><br>And no the usual <i>getPreferredSize</i>, <i>getMinimumSize</i>, <i>getMaximumSize</i> and <i>getSize</i> doesn't work.<br><br>Are there anybody that knows a good trick to how to do this?<br><br>PS: I'm using JLabel rather than other components such as JEditorPane because it provides the most correct rendering when printed.

    Here's a small example that will point you in a possible direction:
    public class Test extends JFrame {
         public Test() {
              JLabel lo = new JLabel(
                        "<html>hjgsdfjh dfsjhgfsdjh sdfjhgsdf jhgf jhsdf sdfjh h dfsjhgds sdjhg sdfjh dfj sdjhgsdf jsdfhg</html>") {
                   @Override
                   public void paint(Graphics g) {
                        View view = (View) getClientProperty(BasicHTML.propertyKey);
                        float size = view.getPreferredSpan(View.Y_AXIS);
                        System.out.println(size);
                        super.paint(g);
              this.add(lo);
              this.setSize(100, 200);
              this.setLocationRelativeTo(null);
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        new Test().setVisible(true);
    }See other public methods on the view.

  • SSRS 2008 R2 report does not print the page header for a html content displaying on multiple pages

    Hi
    I need to display the html content from the database. The html content are quite long and can have content of 3-5 pages. Issue I  am facing is f the record has html content of 3-5 pages, then it does not print the page header (which is a separate tablix) on
    second page onwards.
    Nikesh Shah
    Nikesh Shah

    Hi Nikesh,
    According to your description, I’m not sure the meaning of Page header in your scenario. In Reporting Services, a page header that run along the top of each page, respectively. Headers can contain static text, images, lines, rectangles, borders, background
    color, background images, and expressions. But we couldn’t add tablix in the page header.
    If you are saying report header, a report header consists of the report items that are placed at the top of the report body on the report design surface. They appear only once as the first content in the report. So it cannot repeat in other pages.
    If you are saying tablix header, freezing column headers are different in table and matrix. For more details, please refer to the following thread:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/c8ddc1af-1bdf-4e72-8aab-0353c7cc848a/ssrs-report-freezing-row-and-column-while-scrolling-issue?forum=sqlreportingservices
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • SSRS 2008 R2 report prints empty spaces for html content till end of page

    Hi
    I need to display records containing long html content say each record of different size ranging from 5 lines to 3-5 pages.
    Issue observed is:
    When a record complete is printing say half the page and subsequent record is bigger then half a page, the subsequent record is printed on the next page rather than continue immediately after the previous record is completed.
    Is their any property or any other solution to resolve the issue. Print on next page is not set.
    Nikesh Shah

    Hi Nikesh,
    As per my understanding, I think the issue is caused by the blank space in the report body. In order to get rid of the blank space when print the report, please refer to the following steps:
    Click on Report > Report Properties > Layout tab
    Make a note of the values for Page width, Left margin, Right margin
    Close and go back to the design surface
    In the Properties window, select Body
    Click the + symbol to expand the Size node
    Make a note of the value for Width
    Please check the Page Break settings on all your report items and make sure the Body Width + Left margin + Right margin less than or equal to Page width, just like the equalities below:
    (Body Width + Left margin + Right margin) <= (Page width)
    If there are any other questions, please feel free to ask.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Memory leak in Jeditorpane.setText method while displaying html content

    I tried to display a larger size html page using JeditorPane. But I found that there as a huge memory leak after JEditorPane's setText method was called.
    Refering to the below code there was a difference of about 40 MB after the setText method was called.This does not happen if we display the page in rtf format.This finally results in Out Of memry error.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    import java.awt.BorderLayout;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    public class SampleProgram extends JFrame{
    public JEditorPane pane;
    static public String getContents(File aFile) {
    StringBuffer contents = new StringBuffer();
    try {
    BufferedReader input = new BufferedReader(new FileReader(aFile));
    try {
    String line = null;
    while (( line = input.readLine()) != null){
    contents.append(line);
    contents.append(System.getProperty("line.separator"));
    finally {
    input.close();
    catch (IOException ex){
    ex.printStackTrace();
    return contents.toString();
    public SampleProgram() {
    pane = new JEditorPane();
    pane.setContentType("text/html");
    pane.setEditable(false);
    pane.setCaretPosition(0);
    pane.setAutoscrolls(true);
    getContentPane().add(pane, BorderLayout.CENTER);
    setSize(400,400);
    File file = new File("D:/Audit_Log.html");
    String summary = getContents(file);
    System.out.println("Memory used Before setText invoke ==>" +((Runtime.getRuntime().totalMemory()- Runtime.getRuntime().freeMemory())/1000000)+"M");
    pane.setText(summary);
    System.out.println("Memory used after setText invoke ==>" +((Runtime.getRuntime().totalMemory()- Runtime.getRuntime().freeMemory())/1000000)+"M");
    setVisible(true);
    * @param args
    public static void main(String[] args) {
    new SampleProgram () ;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The html i am trying to display is similar to the one below.But the original content almost 10 times bigger than this html content and it has only td and tr tags. and for this file the leak is about 4 MB and if I use the file 10 times bigger than this it is 40M .
    Any suggestions how to avoid this memory leak?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <html>
    <body>
    <h1 align="center">Test HTML</h1>
    <table align="center" border="0" width="90%">
    <tr>
    <td>
    <h3>10-Sep-2008 08:11:32 GMT - <i>User</i>
    </h3>
    <h4>Employee 1 - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 2 - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 3, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 4, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 5, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 6, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 7, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 8, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 9, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 10, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 11, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 12, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 13, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 14, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 15, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 16, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 17, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 18, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 19, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 20, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 21, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 22, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 23, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 24, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 25, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 26, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 27, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 28, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 29, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 30, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 31, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 32, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 33, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 34, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 35, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 36, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>Green</td>
    </tr>
    <tr>
    <td>vision</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 37, - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Name</td><td></td><td>xyzxyz</td>
    </tr>
    <tr>
    <td>Place</td><td></td><td>Mangalore</td>
    </tr>
    <tr>
    <td>State</td><td></td><td>Karnataka</td>
    </tr>
    <tr>
    <td>Country</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    <tr></tr>
    <tr>
    <td>Unit </td><td></td><td>India/MT</td>
    </tr>
    <tr>
    <td>Floor</td><td></td><td>MARblE</td>
    </tr>
    <tr>
    <td>Rating</td><td></td><td>Quantity: amount = 45 uom = MT</td>
    </tr>
    </table>
    <br>
    <h4>Employee 60, Employed - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Price</td><td></td><td>India/MT</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Employee - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Accept the agreement</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Indicator</td><td></td><td>True</td>
    </tr>
    <tr>
    <td>Conditions</td><td></td><td>AIR</td>
    </tr>
    <tr>
    <td> Status</td><td></td><td>QUALIFIED</td>
    </tr>
    <tr>
    <td>Job Type</td><td></td><td>ddddd</td>
    </tr>
    <tr>
    <td>agreement signed</td><td></td><td>TRUE</td>
    </tr>
    <tr>
    <td>Degree</td><td></td><td>True</td>
    </tr>
    <tr>
    <td> Options</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Quality</td><td></td><td>TRUE</td>
    </tr>
    <tr>
    <td>Quantity</td><td></td><td>123</td>
    </tr>
    <tr>
    <td>Basis</td><td></td><td>TOTAL</td>
    </tr>
    <tr>
    <td>GapPresent</td><td></td><td>TRUE</td>
    </tr>
    <tr>
    <td>Unit </td><td></td><td>MT</td>
    </tr>
    <tr>
    <td>Warning</td><td></td><td>4000000</td>
    </tr>
    <tr>
    <td>Rounding </td><td></td><td>3</td>
    </tr>
    <tr>
    <td>Security</td><td></td><td>OC</td>
    </tr>
    <tr>
    <td>Number</td><td></td><td>61</td>
    </tr>
    <tr>
    <td>Employee Status</td><td></td><td>Rupee INDIA</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61 - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Alternative </td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Advantage</td><td></td><td>all</td>
    </tr>
    <tr>
    <td>Loading</td><td></td><td>all</td>
    </tr>
    <tr>
    <td>flag</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Lateral</td><td></td><td>True</td>
    </tr>
    <tr>
    <td> Mode</td><td></td><td>Null</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Chain - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Roll Number</td><td></td><td>1</td>
    </tr>
    <tr>
    <td>Section</td><td></td><td>AA</td>
    </tr>
    <tr>
    <td>Percentage</td><td></td><td>100</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Employee Terms - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Date of Record</td><td></td><td>DateRange
    startDate=01-Jun-2009
    endDate=30-Jun-2009
    </td>
    </tr>
    <tr>
    <td>Continent</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Employed - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Price</td><td></td><td>India/MT</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Employed Term 1, Fixed Employed - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Alternative</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Price </td><td></td><td>123</td>
    </tr>
    <tr>
    <td>Unit </td><td></td><td>India/MT</td>
    </tr>
    <tr>
    <td>Floor</td><td></td><td>MARblE</td>
    </tr>
    <tr>
    <td>Remainder</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Rating</td><td></td><td>Return: amount = 55 uom = HH</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Employed Term 2, Fixed Employed - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Price </td><td></td><td>123</td>
    </tr>
    <tr>
    <td>Unit </td><td></td><td>India/MT</td>
    </tr>
    <tr>
    <td>Floor</td><td></td><td>MARblE</td>
    </tr>
    <tr>
    <td>Rating</td><td></td><td>Quantity: amount = 45 uom = MT</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Demurrage - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Country</td><td></td><td>Africa</td>
    </tr>
    <tr>
    <td>Term Period</td><td></td><td>2 months</td>
    </tr>
    <tr>
    <td>Time Period</td><td></td><td>Asia</td>
    </tr>
    <tr>
    <td>Flag ON/OFF</td><td></td><td>Asia</td>
    </tr>
    </table>
    <br>
    <h4>Employee 61, Organisation Job Settlement Term - <i>Create</i>
    </h4>
    <table border="0" width="100%">
    <th align="left" width="40%"><u>Field Name</u></th><th align="left" width="30%"><u>From Value</u></th><th align="left" width="30%"><u>To Value</u></th>
    <tr>
    <td>Indicator</td><td></td><td>aaaaa</td>
    </tr>
    <tr>
    <td>Alt Event</td><td></td><td>blSPLIT</td>
    </tr>
    <tr>
    <td>Alt Osssssssssssssst</td><td></td><td>2</td>
    </tr>
    <tr>
    <td>Calendar</td><td></td><td>NEW YORK</td>
    </tr>
    <tr>
    <td>Currency Type</td><td></td><td>India</td>
    </tr>
    <tr>
    <td>Day</td><td></td><td>aaaaa</td>
    </tr>
    <tr>
    <td>Event</td><td></td><td>bl</td>
    </tr>
    <tr>
    <td>alter ddddddddd</td><td></td><td>Asia</td>
    </t

    Screen_Name_09, You can post in the bug database.
    http://bugs.sun.com/bugdatabase/

  • Help with code to print HTML in Java 5

    Hi,
    The following code works and runs successfully..
    However, the printing in Java 1.4.2_03 is better than Java 5 (latest version).
    i.e in particular the characters are not monospaced compared with compiling with Java 1.4.2_03. e.g si so ss squashed together.
    This issue does not seem to occur when running the same code in Java 1.4.2_03. (I haven't tried other 1.4.2 java versions).
    Any help would be appreciated. We really need this working under Java 5 or bust.
    Here is the complete listing ... PrintHtml.java (it uses the DocumentRenderer)
    and following this is the input file.
    import javax.swing.text.html.HTMLDocument;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
    import java.io.DataInputStream;
    import java.io.InputStream;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    import java.lang.reflect.*;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.Shape;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import javax.swing.JEditorPane;
    import javax.swing.text.Document;
    import javax.swing.text.PlainDocument;
    import javax.swing.text.View;
    import javax.swing.text.html.HTMLDocument;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    import java.text.ParseException;
    public class PrintHtml {
         * Utility helper to convert HTML Text to HTML Document.
         * @param baseUrl URL to be used in order
         * to resolve relative HTML references, in lieu of an
         * HTML BASE tag. May be null, if not required or HTML
         * BASE tag is to be used.
         * @see jbox.view.jfx.JboxHtmlEditor
         * @see jbox.utility.JboxPrint
         * @see jbox.utility.JboxPrintUtil
      public static HTMLDocument htmlTextToHtmlDoc(String htmlText, URL baseUrl)
              try
              //  JboxHtmlEditorKit editorKit = new JboxHtmlEditorKit();
                HTMLEditorKit editorKit = new HTMLEditorKit();
                HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
                   if (baseUrl != null)
                        try
                             doc.setBase(baseUrl);
                        catch(Exception e)
                             //JboxTraceManager.trace(e);
                   StringReader reader = new StringReader(htmlText);
                   editorKit.read(reader, doc, 0);
             return doc;
              catch(Exception e)
                   //JboxTraceManager.trace(e);
                   return null;
       public static void main(String[] args) {
          System.out.println("printing...");
          HTMLDocument x = new HTMLDocument();
          DocumentRenderer invoice = new DocumentRenderer();
          //invoice.setScaleWidthToFit(false);
          String s = "";
          try {
            BufferedInputStream bis = new BufferedInputStream(new FileInputStream("mark.html"));
            InputStreamReader in = new InputStreamReader(bis , "ASCII");
            StringWriter sw = new StringWriter();
            while (true) {
               int datum = in.read();
               if (datum == -1) break;
               sw.write(datum);
            in.close();
            s = sw.toString();
            System.out.println("s="+s);
          catch (IOException e) {
             System.err.println(e);
          HTMLDocument htmldoc = htmlTextToHtmlDoc(s, null);
          invoice.print(htmldoc);
    // the good old infamous DocumentRenderer.
    /*  Copyright 2002
        Kei G. Gauthier
        Suite 301
        77 Winsor Street
        Ludlow, MA  01056
    class DocumentRenderer implements Printable {
    /*  DocumentRenderer prints objects of type Document. Text attributes, including
        fonts, color, and small icons, will be rendered to a printed page.
        DocumentRenderer computes line breaks, paginates, and performs other
        formatting.
        An HTMLDocument is printed by sending it as an argument to the
        print(HTMLDocument) method. A PlainDocument is printed the same way. Other
        types of documents must be sent in a JEditorPane as an argument to the
        print(JEditorPane) method. Printing Documents in this way will automatically
        display a print dialog.
        As objects which implement the Printable Interface, instances of the
        DocumentRenderer class can also be used as the argument in the setPrintable
        method of the PrinterJob class. Instead of using the print() methods
        detailed above, a programmer may gain access to the formatting capabilities
        of this class without using its print dialog by creating an instance of
        DocumentRenderer and setting the document to be printed with the
        setDocument() or setJEditorPane(). The Document may then be printed by
        setting the instance of DocumentRenderer in any PrinterJob.
      protected int currentPage = -1;               //Used to keep track of when
                                                    //the page to print changes.
      protected JEditorPane jeditorPane;            //Container to hold the
                                                    //Document. This object will
                                                    //be used to lay out the
                                                    //Document for printing.
      protected double pageEndY = 0;                //Location of the current page
                                                    //end.
      protected double pageStartY = 0;              //Location of the current page
                                                    //start.
      protected boolean scaleWidthToFit = true;     //boolean to allow control over
                                                    //whether pages too wide to fit
                                                    //on a page will be scaled.
    /*    The DocumentRenderer class uses pFormat and pJob in its methods. Note
          that pFormat is not the variable name used by the print method of the
          DocumentRenderer. Although it would always be expected to reference the
          pFormat object, the print method gets its PageFormat as an argument.
      protected PageFormat pFormat;
      protected PrinterJob pJob;
    /*  The constructor initializes the pFormat and PJob variables.
      public DocumentRenderer() {
        pFormat = new PageFormat();
        pJob = PrinterJob.getPrinterJob();
    /*  Method to get the current Document
      public Document getDocument() {
        if (jeditorPane != null) return jeditorPane.getDocument();
        else return null;
    /*  Method to get the current choice the width scaling option.
      public boolean getScaleWidthToFit() {
        return scaleWidthToFit;
    /*  pageDialog() displays a page setup dialog.
      public void pageDialog() {
        pFormat = pJob.pageDialog(pFormat);
    /*  The print method implements the Printable interface. Although Printables
        may be called to render a page more than once, each page is painted in
        order. We may, therefore, keep track of changes in the page being rendered
        by setting the currentPage variable to equal the pageIndex, and then
        comparing these variables on subsequent calls to this method. When the two
        variables match, it means that the page is being rendered for the second or
        third time. When the currentPage differs from the pageIndex, a new page is
        being requested.
        The highlights of the process used print a page are as follows:
        I.    The Graphics object is cast to a Graphics2D object to allow for
              scaling.
        II.   The JEditorPane is laid out using the width of a printable page.
              This will handle line breaks. If the JEditorPane cannot be sized at
              the width of the graphics clip, scaling will be allowed.
        III.  The root view of the JEditorPane is obtained. By examining this root
              view and all of its children, printView will be able to determine
              the location of each printable element of the document.
        IV.   If the scaleWidthToFit option is chosen, a scaling ratio is
              determined, and the graphics2D object is scaled.
        V.    The Graphics2D object is clipped to the size of the printable page.
        VI.   currentPage is checked to see if this is a new page to render. If so,
              pageStartY and pageEndY are reset.
        VII.  To match the coordinates of the printable clip of graphics2D and the
              allocation rectangle which will be used to lay out the views,
              graphics2D is translated to begin at the printable X and Y
              coordinates of the graphics clip.
        VIII. An allocation Rectangle is created to represent the layout of the
              Views.
              The Printable Interface always prints the area indexed by reference
              to the Graphics object. For instance, with a standard 8.5 x 11 inch
              page with 1 inch margins the rectangle X = 72, Y = 72, Width = 468,
              and Height = 648, the area 72, 72, 468, 648 will be painted regardless
              of which page is actually being printed.
              To align the allocation Rectangle with the graphics2D object two
              things are done. The first step is to translate the X and Y
              coordinates of the graphics2D object to begin at the X and Y
              coordinates of the printable clip, see step VII. Next, when printing
              other than the first page, the allocation rectangle must start laying
              out in coordinates represented by negative numbers. After page one,
              the beginning of the allocation is started at minus the page end of
              the prior page. This moves the part which has already been rendered to
              before the printable clip of the graphics2D object.
        X.    The printView method is called to paint the page. Its return value
              will indicate if a page has been rendered.
        Although public, print should not ordinarily be called by programs other
        than PrinterJob.
      public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
        double scale = 1.0;
        Graphics2D graphics2D;
        View rootView;
    //  I
        graphics2D = (Graphics2D) graphics;
        disableDoubleBuffering(jeditorPane);
    //  II
        jeditorPane.setSize((int) pageFormat.getImageableWidth(),Integer.MAX_VALUE);
        jeditorPane.validate();
    //  III
        rootView = jeditorPane.getUI().getRootView(jeditorPane);
    //  IV
        if ((scaleWidthToFit) && (jeditorPane.getMinimumSize().getWidth() >
        pageFormat.getImageableWidth())) {
          scale = pageFormat.getImageableWidth()/
          jeditorPane.getMinimumSize().getWidth();
          graphics2D.scale(scale,scale);
    //  V
        graphics2D.setClip((int) (pageFormat.getImageableX()/scale),
        (int) (pageFormat.getImageableY()/scale),
        (int) (pageFormat.getImageableWidth()/scale),
        (int) (pageFormat.getImageableHeight()/scale));
    //  VI
        if (pageIndex > currentPage) {
          currentPage = pageIndex;
          pageStartY += pageEndY;
          pageEndY = graphics2D.getClipBounds().getHeight();
    //  VII
        graphics2D.translate(graphics2D.getClipBounds().getX(),
        graphics2D.getClipBounds().getY());
    //  VIII
        Rectangle allocation = new Rectangle(0,
        (int) -pageStartY,
        (int) (jeditorPane.getMinimumSize().getWidth()),
        (int) (jeditorPane.getPreferredSize().getHeight()));
    //  X
        if (printView(graphics2D,allocation,rootView)) {
          return Printable.PAGE_EXISTS;
        else {
          pageStartY = 0;
          pageEndY = 0;
          currentPage = -1;
          return Printable.NO_SUCH_PAGE;
      /** The speed and quality of printing suffers dramatically if
       *  any of the containers have double buffering turned on.
       *  So this turns if off globally.
       *  @see enableDoubleBuffering
      public static void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
      /** Re-enables double buffering globally. */
      public static void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
    /*  print(HTMLDocument) is called to set an HTMLDocument for printing.
      public void print(HTMLDocument htmlDocument) {
        setDocument(htmlDocument);
        printDialog();
    /*  print(JEditorPane) prints a Document contained within a JEDitorPane.
      public void print(JEditorPane jedPane) {
        setDocument(jedPane);
        printDialog();
    /*  print(PlainDocument) is called to set a PlainDocument for printing.
      public void print(PlainDocument plainDocument) {
        setDocument(plainDocument);
        printDialog();
    /*  A protected method, printDialog(), displays the print dialog and initiates
        printing in response to user input.
      protected void printDialog() {
        if (pJob.printDialog()) {
          pJob.setPrintable(this,pFormat);
          try {
            pJob.print();
          catch (PrinterException printerException) {
            pageStartY = 0;
            pageEndY = 0;
            currentPage = -1;
            System.out.println("Error Printing Document");
    /*  printView is a recursive method which iterates through the tree structure
        of the view sent to it. If the view sent to printView is a branch view,
        that is one with children, the method calls itself on each of these
        children. If the view is a leaf view, that is a view without children which
        represents an actual piece of text to be painted, printView attempts to
        render the view to the Graphics2D object.
        I.    When any view starts after the beginning of the current printable
              page, this means that there are pages to print and the method sets
              pageExists to true.
        II.   When a leaf view is taller than the printable area of a page, it
              cannot, of course, be broken down to fit a single page. Such a View
              will be printed whenever it intersects with the Graphics2D clip.
        III.  If a leaf view intersects the printable area of the graphics clip and
              fits vertically within the printable area, it will be rendered.
        IV.   If a leaf view does not exceed the printable area of a page but does
              not fit vertically within the Graphics2D clip of the current page, the
              method records that this page should end at the start of the view.
              This information is stored in pageEndY.
      protected boolean printView(Graphics2D graphics2D, Shape allocation,
      View view) {
        boolean pageExists = false;
        Rectangle clipRectangle = graphics2D.getClipBounds();
        Shape childAllocation;
        View childView;
        if (view.getViewCount() > 0 &&
              !view.getElement().getName().equalsIgnoreCase("td")) {
          for (int i = 0; i < view.getViewCount(); i++) {
            childAllocation = view.getChildAllocation(i,allocation);
            if (childAllocation != null) {
              childView = view.getView(i);
              if (printView(graphics2D,childAllocation,childView)) {
                pageExists = true;
        } else {
    //  I
          if (allocation.getBounds().getMaxY() >= clipRectangle.getY()) {
            pageExists = true;
    //  II
            if ((allocation.getBounds().getHeight() > clipRectangle.getHeight()) &&
            (allocation.intersects(clipRectangle))) {
              view.paint(graphics2D,allocation);
            } else {
    //  III
              if (allocation.getBounds().getY() >= clipRectangle.getY()) {
                if (allocation.getBounds().getMaxY() <= clipRectangle.getMaxY()) {
                  view.paint(graphics2D,allocation);
                } else {
    //  IV
                  if (allocation.getBounds().getY() < pageEndY) {
                    pageEndY = allocation.getBounds().getY();
        return pageExists;
    /*  Method to set the content type the JEditorPane.
      protected void setContentType(String type) {
        jeditorPane.setContentType(type);
    /*  Method to set an HTMLDocument as the Document to print.
      public void setDocument(HTMLDocument htmlDocument) {
        jeditorPane = new JEditorPane();
        setDocument("text/html",htmlDocument);
    /*  Method to set the Document to print as the one contained in a JEditorPane.
        This method is useful when Java does not provide direct access to a
        particular Document type, such as a Rich Text Format document. With this
        method such a document can be sent to the DocumentRenderer class enclosed
        in a JEditorPane.
      public void setDocument(JEditorPane jedPane) {
        jeditorPane = new JEditorPane();
        setDocument(jedPane.getContentType(),jedPane.getDocument());
    /*  Method to set a PlainDocument as the Document to print.
      public void setDocument(PlainDocument plainDocument) {
        jeditorPane = new JEditorPane();
        setDocument("text/plain",plainDocument);
    /*  Method to set the content type and document of the JEditorPane.
      protected void setDocument(String type, Document document) {
        setContentType(type);
        jeditorPane.setDocument(document);
    /*  Method to set the current choice of the width scaling option.
      public void setScaleWidthToFit(boolean scaleWidth) {
        scaleWidthToFit = scaleWidth;
    }The sample input file is "mark.html":::
    <html>
    <head>
    <style type="text/css">
    <!--
    ol { list-style-type: decimal; margin-top: 10; margin-left: 50; margin-bottom: 10 }
    u { text-decoration: underline }
    s { text-decoration: line-through }
    p { font-weight: normal; font-size: medium; margin-top: 15 }
    dd p { margin-top: 0; margin-left: 40; margin-bottom: 0 }
    ol li p { margin-top: 0; margin-bottom: 0 }
    address { color: blue; font-style: italic }
    i { font-style: italic }
    h6 { font-weight: bold; font-size: xx-small; margin-top: 10; margin-bottom: 10 }
    h5 { font-weight: bold; font-size: x-small; margin-top: 10; margin-bottom: 10 }
    h4 { font-weight: bold; font-size: small; margin-top: 10; margin-bottom: 10 }
    h3 { font-weight: bold; font-size: medium; margin-top: 10; margin-bottom: 10 }
    dir li p { margin-top: 0; margin-bottom: 0 }
    h2 { font-weight: bold; font-size: large; margin-top: 10; margin-bottom: 10 }
    b { font-weight: bold }
    h1 { font-weight: bold; font-size: x-large; margin-top: 10; margin-bottom: 10 }
    a { color: blue; text-decoration: underline }
    ul li ul li ul li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    menu { margin-top: 10; margin-left: 40; margin-bottom: 10 }
    menu li p { margin-top: 0; margin-bottom: 0 }
    table table { border-color: Gray; margin-right: 0; border-style: outset; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    sup { vertical-align: sup }
    body { margin-right: 0; font-size: 14pt; font-family: SansSerif; color: black; margin-left: 0 }
    ul li ul li ul { list-style-type: square; margin-left: 25 }
    blockquote { margin-right: 35; margin-top: 5; margin-left: 35; margin-bottom: 5 }
    samp { font-size: small; font-family: Monospaced }
    cite { font-style: italic }
    sub { vertical-align: sub }
    em { font-style: italic }
    table table table { border-color: Gray; margin-right: 0; border-style: outset; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    ul li p { margin-top: 0; margin-bottom: 0 }
    ul li ul li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    var { font-weight: bold; font-style: italic }
    table { border-color: Gray; margin-right: 7; border-style: outset; margin-top: 7; margin-left: 7; margin-bottom: 17 }
    dfn { font-style: italic }
    menu li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    strong { font-weight: bold }
    ul { list-style-type: disc; margin-top: 10; margin-left: 50; margin-bottom: 10 }
    center { text-align: center }
    ul li ul { list-style-type: circle; margin-left: 25 }
    kbd { font-size: small; font-family: Monospaced }
    dir li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    th p { font-weight: bold; padding-left: 2; padding-bottom: 3; padding-right: 2; margin-top: 0; padding-top: 3 }
    ul li menu { list-style-type: circle; margin-left: 25 }
    dt { margin-top: 0; margin-bottom: 0 }
    ol li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    li p { margin-top: 0; margin-bottom: 0 }
    strike { text-decoration: line-through }
    dl { margin-top: 10; margin-left: 10; margin-bottom: 10 }
    tt { font-family: Monospaced }
    ul li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    dir { margin-top: 10; margin-left: 40; margin-bottom: 10 }
    pre p { margin-top: 0 }
    th { border-color: Gray; border-style: solid; padding-left: 3; padding-bottom: 3; padding-right: 1; padding-top: 1 }
    pre { font-family: Monospaced; margin-top: 5; margin-bottom: 5 }
    td { border-color: Gray; border-style: inset; padding-left: 3; padding-bottom: 3; padding-right: 1; padding-top: 1 }
    td p { padding-left: 2; padding-bottom: 3; padding-right: 2; margin-top: 0; padding-top: 3 }
    code { font-size: small; font-family: Monospaced }
    small { font-size: x-small }
    big { font-size: x-large }
    -->
    </style>
    </head>
    <body>
    <p style="margin-top: 0">
    </p>
    <table width="500" cellspacing="20" border="1">
    <tr>
    <td height="330" valign="top">
    <table border="0">
    <tr>
    <td>
    <font size="2">This is to certify that [[Client Name]], born
    on [[Client Date of Birth]], of [[Client Residential
                    Address]], was the holder of motor vehicle driver
    licence number [[Client Licence Number]], first issued on
    [[First Issue Date of Holding]] and expired on [[Holding
                    Expiry Date]].<br></font>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <table width="500" border="2">
    <tr>
    <td>
    <table width="480" border="0">
    <tr>
    <td align="right">
    <font size="2"><br>
    <b>Fred Flintstone<br>Manager</b><br>Records Services Division<br>State
    Police<br>An authorised person for the purposes of the
    Road Act 1986</font>
    </td>
    </tr>
    <tr>
    <td align="left">
    <font size="2"><b>User ID: wzvqv7<br>Dated: 29 November 2006</b>
    </font>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>

    I have finally cracked it!!!!!!!!!!!!!!!!
    The issue is definitely with Java Sun. "Uneven character spacing when printing JTextComponent"
    It is raised on the http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6488219
    And currently in OPEN state, and raised on 31 Oct 2006 and mentions it was caused by fix 4352983.
    So where do we go from here. It's not good because I have tried all later version of the JVM and the issue is still there.
    Why? Because it hasn't been fixed yet. Read the bug report above, as it gives more insight -- and mentions the workaround is NOT good for existing code.
    So the way forward is to use an earlier version of the JVM 5.
    I download the JVM version 1.5.0 (starting version) and works Ok... I would probably think version prior to 4352983 would be Ok too.
    Please vote for this.... We have a workaround (use older version of the JVM).
    So I am very happy.

  • Help needed:Printing HTML file using javax.print

    Hi
    I am using the following code which i got form the forum for rpinting an HTML file.
    The folllowing code is working fine, but the problem is the content of HTML file is not getting printed. I am geeting a blank page with no content. What is the change that is required in the code? ALso is there any simpler way to implement this. Help needed ASAP.
    public boolean printHTMLFile(String filename) {
              try {
                   JEditorPane editorPane = new JEditorPane();
                   editorPane.setEditorKit(new HTMLEditorKit());
                   //editorPane.setContentType("text/html");
                   editorPane.setSize(500,500);
                   String text = getFileContents(filename);
                   if (text != null) {
                        editorPane.setText(text);                    
                   } else {
                        return false;
                   printEditorPane(editorPane);
                   return true;
              } catch (Exception tce) {
                   tce.printStackTrace();
              return false;
         public String getFileContents(String filename) {
              try {
                   File file = new File(filename);
                   BufferedReader br = new BufferedReader(new FileReader(file));
                   String line;
                   StringBuffer sb = new StringBuffer();
                   while ((line = br.readLine()) != null) {
                        sb.append(line);
                   br.close();
                   return sb.toString();
              } catch (Exception tce) {
                   tce.printStackTrace();
              return null;
         public void printEditorPane(JEditorPane editorPane) {
                   try {
                        HTMLPrinter htmlPrinter = new HTMLPrinter();
                        htmlPrinter.printJEditorPane(editorPane, htmlPrinter.showPrintDialog());
                   } catch (Exception tce) {
                        tce.printStackTrace();
         * Sets up to easily print HTML documents. It is not necessary to call any of the setter
         * methods as they all have default values, they are provided should you wish to change
         * any of the default values.
         public class HTMLPrinter {
         public int DEFAULT_DPI = 72;
         public float DEFAULT_PAGE_WIDTH_INCH = 8.5f;
         public float DEFAULT_PAGE_HEIGHT_INCH = 11f;
         int x = 100;
         int y = 80;
         GraphicsConfiguration gc;
         PrintService[] services;
         PrintService defaultService;
         DocFlavor flavor;
         PrintRequestAttributeSet attributes;
         Vector pjlListeners = new Vector();
         Vector pjalListeners = new Vector();
         Vector psalListeners = new Vector();
         public HTMLPrinter() {
              gc = null;
              attributes = new HashPrintRequestAttributeSet();
              flavor = null;
              defaultService = PrintServiceLookup.lookupDefaultPrintService();
              services = PrintServiceLookup.lookupPrintServices(flavor, attributes);
              // do something with the supported docflavors
              DocFlavor[] df = defaultService.getSupportedDocFlavors();
              for (int i = 0; i < df.length; i++)
              System.out.println(df.getMimeType() + " " + df[i].getRepresentationClassName());
              // if there is a default service, but no other services
              if (defaultService != null && (services == null || services.length == 0)) {
              services = new PrintService[1];
              services[0] = defaultService;
         * Set the GraphicsConfiguration to display the print dialog on.
         * @param gc a GraphicsConfiguration object
         public void setGraphicsConfiguration(GraphicsConfiguration gc) {
              this.gc = gc;
         public void setServices(PrintService[] services) {
              this.services = services;
         public void setDefaultService(PrintService service) {
              this.defaultService = service;
         public void setDocFlavor(DocFlavor flavor) {
              this.flavor = flavor;
         public void setPrintRequestAttributes(PrintRequestAttributeSet attributes) {
              this.attributes = attributes;
         public void setPrintDialogLocation(int x, int y) {
              this.x = x;
              this.y = y;
         public void addPrintJobListener(PrintJobListener pjl) {
              pjlListeners.addElement(pjl);
         public void removePrintJobListener(PrintJobListener pjl) {
              pjlListeners.removeElement(pjl);
         public void addPrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.addElement(psal);
         public void removePrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.removeElement(psal);
         public boolean printJEditorPane(JEditorPane jep, PrintService ps) {
                   if (ps == null || jep == null) {
                        System.out.println("printJEditorPane: jep or ps is NULL, aborting...");
                        return false;
                   // get the root view of the preview pane
                   View rv = jep.getUI().getRootView(jep);
                   // get the size of the view (hopefully the total size of the page to be printed
                   int x = (int) rv.getPreferredSpan(View.X_AXIS);
                   int y = (int) rv.getPreferredSpan(View.Y_AXIS);
                   // find out if the print has been set to colour mode
                   DocPrintJob dpj = ps.createPrintJob();
                   PrintJobAttributeSet pjas = dpj.getAttributes();
                   // get the DPI and printable area of the page. use default values if not available
                   // use this to get the maximum number of pixels on the vertical axis
                   PrinterResolution pr = (PrinterResolution) pjas.get(PrinterResolution.class);
                   int dpi;
                   float pageX, pageY;
                   if (pr != null)
                        dpi = pr.getFeedResolution(PrinterResolution.DPI);
                   else
                        dpi = DEFAULT_DPI;
                   MediaPrintableArea mpa = (MediaPrintableArea) pjas.get(MediaPrintableArea.class);
                   if (mpa != null) {
                        pageX = mpa.getX(MediaPrintableArea.INCH);
                        pageY = mpa.getX(MediaPrintableArea.INCH);
                   } else {
                        pageX = DEFAULT_PAGE_WIDTH_INCH;
                        pageY = DEFAULT_PAGE_HEIGHT_INCH;
                   int pixelsPerPageY = (int) (dpi * pageY);
                   int pixelsPerPageX = (int) (dpi * pageX);
                   int minY = Math.max(pixelsPerPageY, y);
                   // make colour true if the user has selected colour, and the PrintService can support colour
                   boolean colour = pjas.containsValue(Chromaticity.COLOR);
                   colour = colour & (ps.getAttribute(ColorSupported.class) == ColorSupported.SUPPORTED);
                   // create a BufferedImage to draw on
                   int imgMode;
                   if (colour)
                        imgMode = BufferedImage.TYPE_3BYTE_BGR;
                   else
                        imgMode = BufferedImage.TYPE_BYTE_GRAY;
                   BufferedImage img = new BufferedImage(pixelsPerPageX, minY, imgMode);
                   Graphics myGraphics = img.getGraphics();
                   myGraphics.setClip(0, 0, pixelsPerPageX, minY);
                   myGraphics.setColor(Color.WHITE);
                   myGraphics.fillRect(0, 0, pixelsPerPageX, minY);
                        java.awt.Rectangle rectangle=new java.awt.Rectangle(0,0,pixelsPerPageX, minY);
                   // call rootView.paint( myGraphics, rect ) to paint the whole image on myGraphics
                   rv.paint(myGraphics, rectangle);
                   try {
                        // write the image as a JPEG to the ByteArray so it can be printed
                        Iterator writers = ImageIO.getImageWritersByFormatName("jpeg");
                        ImageWriter writer = (ImageWriter) writers.next();
                                       // mod: Added the iwparam to create the highest quality image possible
                        ImageWriteParam iwparam = writer.getDefaultWriteParam();
                        iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ;
                        iwparam.setCompressionQuality(1.0f); // highest quality
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
                        ImageOutputStream ios = ImageIO.createImageOutputStream(out);
                        writer.setOutput(ios);
                        // get the number of pages we need to print this image
                        int imageHeight = img.getHeight();
                        int numberOfPages = (int) Math.ceil(minY / (double) pixelsPerPageY);
                        // print each page
                        for (int i = 0; i < numberOfPages; i++) {
                             int startY = i * pixelsPerPageY;
                             // get a subimage which is exactly the size of one page
                             BufferedImage subImg = img.getSubimage(0, startY, pixelsPerPageX, Math.min(y - startY, pixelsPerPageY));
                                                 // mod: different .write() method to use the iwparam parameter with highest quality compression
                             writer.write(null, new IIOImage(subImg, null, null), iwparam);
                             SimpleDoc sd = new SimpleDoc(out.toByteArray(), DocFlavor.BYTE_ARRAY.JPEG, null);
                             printDocument(sd, ps);
                             // reset the ByteArray so we can start the next page
                             out.reset();
                   } catch (PrintException e) {
                        System.out.println("Error printing document.");
                        e.printStackTrace();
                        return false;
                   } catch (IOException e) {
                        System.out.println("Error creating ImageOutputStream or writing to it.");
                        e.printStackTrace();
                        return false;
                   // uncomment this code and comment out the 'try-catch' block above
                   // to print to a JFrame instead of to the printer
                   /*          JFrame jf = new JFrame();
                             PaintableJPanel jp = new PaintableJPanel();
                             jp.setImage( img );
                             JScrollPane jsp = new JScrollPane( jp );
                             jf.getContentPane().add( jsp );
                             Insets i = jf.getInsets();
                             jf.setBounds( 0, 0, newX, y );
                             jf.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
                             jf.setVisible( true );*/
                   return true;
              * Print the document to the specified PrintService.
              * This method cannot tell if the printing was successful. You must register
              * a PrintJobListener
              * @return false if no PrintService is selected in the dialog, true otherwise
              public boolean printDocument(Doc doc, PrintService ps) throws PrintException {
                   if (ps == null)
                   return false;
                   addAllPrintServiceAttributeListeners(ps);
                   DocPrintJob dpj = ps.createPrintJob();
                   addAllPrintJobListeners(dpj);
                   dpj.print(doc, attributes);
                   return true;
              public PrintService showPrintDialog() {
                   return ServiceUI.printDialog(gc, x, y, services, defaultService, flavor, attributes);
              private void addAllPrintServiceAttributeListeners(PrintService ps) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < psalListeners.size(); i++) {
                   PrintServiceAttributeListener p = (PrintServiceAttributeListener) psalListeners.get(i);
                   ps.addPrintServiceAttributeListener(p);
              private void addAllPrintJobListeners(DocPrintJob dpj) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < pjlListeners.size(); i++) {
                   PrintJobListener p = (PrintJobListener) pjlListeners.get(i);
                   dpj.addPrintJobListener(p);
              // uncomment this also to print to a JFrame instead of a printer
              /* protected class PaintableJPanel extends JPanel {
                   Image img;
                   protected PaintableJPanel() {
                        super();
                   public void setImage( Image i ) {
                        img = i;
                   public void paint( Graphics g ) {
                        g.drawImage( img, 0, 0, this );
    Thanks
    Ram

    Ram,
    I have had printing problems too a year and a half ago. I used all printing apis of java and I still find that it is something java lacks. Now basically you can try autosense. To check whether your printer is capable of printing the docflavor use this PrintServiceLookup.lookupPrintServices(flavor, aset); . If it lists the printer then he can print the document otherwise he can't. I guess that is why you get the error.
    Regards,
    Kevin

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

  • How to print html file on client system without viewing data on client syst

    I want to print html data from database.
    i am not able to print it using java code,
    javascript can do that.
    but in javascript window is opened on client browser.
    but i dont want to open that
    var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
           disp_setting+="scrollbars=no,width=0,height=0";
         var docprint = window.open("","",disp_setting);
         //docprint = new PopUpWindow() ;
         docprint.document.write('<%= mm %>');
         docprint.document.close();
            docprint.focus();
         docprint.document = null; mm contents the data to be printed. it prints well but window is shown
    in mm there is <BODY self.print() > so it prints on printer but i am viewing window i donot want to view window....
    and print Dialog box also.. I want to by pass this both.
    please send me code or any help regarding that.
    ....

    1. Post a javascript question on a javascript forum please.
    2. Don't think you can bypass without some plugin/setting on the client browser.

  • Print HTML from Popup

    Hello!
    I have a Problem. I would like to print the HTML Content of a Popup using the recommandations from http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e12419/tagdoc/af_showPrintablePageBehavior.html
    But when I klick the Print Button I get the Content from the Page in Background and not from the Popup. Has somebody an Idea how I could resolve this?
    Thank you!

    You can use below javascript
    <af:resource type="javascript">
    function openWindow(printEvent){
    self.print();
    </af:resource>
    <af:clientListener method="openWindow" type="load"/>
    The above code will popup print window with form load. you can call the javascript with button click.

Maybe you are looking for

  • SetPromptsFailed Error while running Deskireport in Infoview

    Hi all, I have migrated a 5.1.7 deski report to XI - R3 deski and it successfully gets refreshed in Deski environment. When I export the XI R3 report to the CMC, I'm not able to refresh the report. It throws the error as "Set Prompts Failed Error. Th

  • I need help on what ram memory should I buy for my Macbook Pro.

    I am planning to upgrade my ram from 4gb to 8gb for my Macbook Pro Mid-2012. I just wanna ask which one is a better ram Crucial or Corsair?? this: http://www.amazon.com/Crucial-PC3-12800-204-Pin-Notebook-CT2KIT51264BF160B/dp/B0 05LDLVAO/ref=cm_cr_pr_

  • CALL FUNCTIONS

    HI ALL WHERE CAN I FIND ALL THE FUNCTION MODULES USED IN ABAP AND I ALSO NEED EXPLANATIONS ....CAN ANYONE HELP WITH REGARDS VIJAY

  • Lifeproof case with iPhone 4s - headphone controls?

    Just reached out the long dollar for a lifeproof case.  So far I like it, with a few reservations.  Biggest issue is that with Apple earbuds plugged into Lifeproof's adapter, the controls on the buds don't seem to work.  Anyone else have this issue?

  • Motion 5 with FCP 7?

    Hi If I buy MOTION 5 will it work with my FCP 7.0.3? Can I import MOTION 4 projects into 5 as well?