HTML Printing with JEditorPane table borders is missing...

Hi,
My application prints HTML reports that was rendered on a JEditorPane,
actually the printing is working fine (almost)...
After reading a lot of posts and the Printing API i've found a very god aproach to print HTML documents... the DocumentRenderer:
http://www.fawcette.com/javapro/2002_12/online/print_kgauthier_12_10_02/
I'm having a strange problem that I was unable to figure out by myself...
Table borders and table background images never get printed...
ex: <TABLE BORDER=1 ...
<td background="image.gif" ...
On the JEditorPane it shows just fine but, when the page is printed there's no border or table background pictures...
Everything else is printed ok including images, small fonts, etc...
Does anyone else had the same problem ?
Thanks for any help

The borders present an interesting problem created by the way the DocumentRenderer class finds for printable Views in the HTML. DocumentRenderer searches recursively down the tree of Views starting with the Document's root view looking for leaf views, those with no children. The DocumentRenderer only paints these smallest chunks of text to the printer graphics context. This usually works because leaf views do not usually contain anything paintable.
The problem with borders is that they represent paintable areas of branch views, those with children. When we only print leaf views, these areas get ignored.
I see two logical solotions to the problem:
I. Change the code of the recursive printView method of Document Renderer to print any border that intersects with the current printable clip rectangle.
II. A much more elegant solution would be to print any view, branch or leaf, that fits within the current printable area, and cease the recursion there. This would include the borders.
It would also increase efficiency by terminating the recursive method earlier by painting larger chunks of the HTML. A strange problem pops up when I try this, however. When the size of the chunk to be printed gets too big, nothing is printed at all. In the article this is mentioned in the area of large images. "Lastly, large icons do not print. Java simply refuses to render them on the page. Small icons work quite well, however." The same holds true for any large View.
I have not been able to quantify the exact size where this failure occurs, nor what is causing it. If anyone can tell me what causes this problem, it should be fairly easy, depenging on the cause of the problem, to rewrite the class to print borders and also does lots of other good stuff. I have already coded the new and improved printView method, but this size limitation has made it unworkable.
Simply stated, if I can figure out why the class does not print large icons, the rest should be easy.
Any suggestions would be appreciated.
Thanks,
Kei Gauthier

Similar Messages

  • Problem Printing html page with JEditorPane...

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

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

  • Custom html tags with JEditorPane

    I'm trying, to use my own tags within html in the JEditorPane. An insert parses without exception but the html in the pane is missing the custom tags that I attempted to insert. I have tried to use the 'setPreservesUnknownTags' command on the html document, but it appears to have no affect. This is the code I have been trying to use:
    edtHTML.insertHTML(docHTML, 0, "<p><my:link id=\"12\">ABC</my:link></p>", 0, 0, HTML.Tag.P);
    I have also tried
    edtHTML.insertHTML(docHTML, 0, "<my:link id=\"12\">ABC</my:link>", 0, 0, new HTML.UnknownTag("my:link"));
    Can anyone help?
    Thanks

    I have no example for custom Tags but I found out that every tag is stored as an attribute.
    You can access the attributes if you use a JTextPane. There is a method (i don't know the name yet I will find out tomorrow in the office) which gives you the AttributeSet of each Character at the Carent position. All characters have an attribute "name" and the value of this attribute should be the name of the tag you've inserted.
    The only problem is that I had to read out every character so it's quit slow.
    If you could find a better solution please let me know ([email protected]).
    Thank you.
    J&ouml;rn

  • HTML editing with JEditorPane - HTMLEditorKit actions

    I am trying to make a component that will allow the user to edit styled text, use some buttons to change text properties - font/color settings, allow him to insert tables and so on.
    From reading through the Swing tutorial and searching around I came to a conclusion that JEditorPane(or JTextPane - I haven't chosen one yet) is the component I must use. I intend to use HTMLEditorKit with it. What worries me are some fields in HTMLEditorKit - some public static String members that are documented as action identifiers(like FONT_CHANGE_BIGGER, FONT_CHANGE_SMALLER...).
    How to use those actions? I saw an example from O'Reilly 'Java Swing' book where they took the actions out of the editorPane's action map, but I could not find actions with names like above in the ActionMap of the JTextPane after I installed HTMLEditorKit /calling setEditorKit(new HTMLEditorKit())/.
    I also want to know how to insert tables and stuff like this. I think I must use HTMLEditorKit.InsertHTMLTextAction class and pass it HTMLEditorKit.INSERT_TABLE_HTML, but I am not sure this is the way to go.
    Can someone lead me to a good resource where I can better understand the details about using the actions of the HTMLEditorKit?
    Thank you for your time
    Mike

    .

  • Shaded table borders

    If you look at this page as an example,
    http://www.share.ca/, how do you
    get the shaded borders around the table? Is it something to do with
    the background color or with the table borders?
    Thanks.

    OK, I have fiddled with the image from the site I'm using as
    an example so I better understand now how it works. That image is
    700 wide. I'm still having trouble tho in Dreamweaver adding a
    repeated border to my centered table 700 wide so that the shaded
    borders are exactly on the edges of the table.
    Do I have to create my own image? If someone could help me
    out with the steps, that would be great. I think I've gone as far
    as I can in trying this.
    Thanks.

  • Tables without borders print with borders

    I have had trouble getting right-aligned graphics to print
    when I print my documentation. So I am inserting the graphics into
    tables, which eliminates that problem. My new problem is that,
    although I have configured the tables to have no cell borders and
    no table borders, they print with a thin border anyway.

    If you are defining the borders and shading in the Table
    Properties, you might want to consider also using the regular
    Borders and Shading menu option. They seem to both apply, and I've
    found it more reliable to set the "normal" borders than specific
    table borders.
    Hope that helps.

  • JEditorPane/HTMLEditorKit displays weird html-table-borders

    Hi there,
    I am currently fighting with JEditorPane and its HTML functionality.
    I would like to create a table with padding:2 and border:1 - every browser displays that correctly (even HotJava the father of HTMLEditorKit's functionality), however JEditorPane paints the border really ugly adding a 1993-style 3D effect to my table :-/
    Any ideas how I could tell JEditorPane to just draw a single 1px line as table border?
    Thank you in advance, lg Clemens

    I guess you need to use a CSS file binded to you HTML doc,
    JEditorPane view = new JEditorPane("text/html","<p>empty</p>");
    StringBuffer l_sb = new StringBuffer();
    sb.append("<head>" +
    "<link rel=stylesheet href=&apos;mystyle.css&apos;>" +
    </head>");
    view.setText(sb.toString());
    then you can control the border using :
    body {
    background-color: #f0fff0;
    font-family: Arial;
    font-size: 12pt;
    table {
    border-width: 1px;
    border-style: solid;
    border-color: #000000;
    and NOT as the standard way (doesnt work)
    border: 1px solid #000000;
    Hope this help.

  • How do I print photos with mats or borders in 9.5.1

    I have been printing photos in iPhoto for years. I have just downloaded 9.5.1 and I cannot find the option for printed mats or colored borders. Also I cannot see where you would print two photos on one page. Seems so simple. What have I missed?

    You'll need a 3rd party app  as that feature has been removed from iPhoto 9.5.
    If you have Pages 09 or earlier  the photo can be added to a Pages page, resized to the print size and a frame added. 
    The newer Pages version, 5.1, has a very limited frame selection but does have some borders. 
    Additional frames can be added to Pages 09 with this free add-on: Frames and strokes installer for : iWork ’08, iWork ’09, iWeb ’08 et iWeb ’09
    OT

  • Table borders for html Page

    HEllo ABAPERS,
    KINDLY HELP .
    I have developed a report which displays a html page in a custom control .But while printing it not displaying table borders . I have used method display_document ffor printing .Can anyone tell me the reason why is it not printing borders ?
    Following code is the code for subroutine and PBO : -
    MODULE status_0322 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
      IF first_display EQ 'X'.
        SET PF-STATUS 'PMENU'.
    create document
        CREATE OBJECT do.
    fill document
        PERFORM display_data USING do t_no.
    merge document
        CALL METHOD do->merge_document.
    display the document inside the container named 'mmscr
        CALL METHOD do->display_document
          EXPORTING
            container          = 'MMSCR'
          EXCEPTIONS
            html_display_error = 1.
        " do some exception handling ...
        CLEAR first_display.
      ENDIF.
    ENDMODULE.                 " STATUS_0322  OUTPUT
    *&      Form  display_data
    FORM display_data USING p_do TYPE REF TO cl_dd_document P_no type n.
      DATA ta1 TYPE REF TO cl_dd_table_element.
      DATA col11 TYPE REF TO cl_dd_area.
      DATA col12 TYPE REF TO cl_dd_area.
      DATA col13 TYPE REF TO cl_dd_area.
      DATA col14 TYPE REF TO cl_dd_area.
      DATA col15 TYPE REF TO cl_dd_area.
      DATA head1 TYPE sdydo_text_element.
      DATA head2 TYPE sdydo_text_element.
      DATA head3 TYPE sdydo_text_element.
      DATA head4 TYPE sdydo_text_element.
      DATA text TYPE sdydo_text_element.
      CALL METHOD p_do->new_line.
          CALL METHOD p_do->add_table
            EXPORTING
              no_of_columns               = 5
              cell_background_transparent = space
              with_heading                = 'X'
              border                      = '5'
              width                       = '50%'
            IMPORTING
              table                       = ta1.
    set columns
          CALL METHOD ta1->add_column EXPORTING heading = head1
                                                width   = '10%'
                                      IMPORTING column  = col11.
          CALL METHOD ta1->set_column_style EXPORTING col_no    = 1
              sap_color = cl_dd_area=>list_background_int.
          CALL METHOD ta1->add_column EXPORTING heading = head2
                                                width   = '15%'
                                      IMPORTING column  = col12.
          CALL METHOD ta1->add_column EXPORTING heading = head3
                                                width   = '15%'
                                      IMPORTING column  = col13.
          CALL METHOD ta1->add_column EXPORTING heading = head4
                                      width   = '15%'
                                      IMPORTING column  = col14.
          CALL METHOD ta1->add_column EXPORTING heading = head4
                                                width   = '15%'
                                      IMPORTING column  = col15.
    fill columns
          text = ' '.
          CALL METHOD col11->add_text
            EXPORTING
              text = text.
          text = 'Init'.
          CALL METHOD col12->add_text
            EXPORTING
              text = text.
          text = 'Supv No'.
          CALL METHOD col13->add_text
            EXPORTING
              text = text.
          text = 'Date'.
          CALL METHOD col14->add_text
            EXPORTING
              text = text.
          text =  'Discrepancy Report Notation'.
          CALL METHOD col15->add_text
            EXPORTING
              text = text.
          CALL METHOD ta1->new_row
            EXPORTING
              sap_color = cl_dd_area=>list_background.
          text = 'Q/C by'.
          CALL METHOD col11->add_text
            EXPORTING
              text = text.
          text = ' '.
          CALL METHOD col12->add_text
            EXPORTING
              text = text.
          CALL METHOD col13->add_text
            EXPORTING
              text = text.
          CALL METHOD col14->add_text
            EXPORTING
              text = text.
          CALL METHOD col15->add_text
            EXPORTING
              text = text.
          CALL METHOD ta1->new_row.
          text = 'Received by'.
          CALL METHOD col11->add_text
            EXPORTING
              text = text.
          text = ' '.
          CALL METHOD col12->add_text
            EXPORTING
              text = text.
          CALL METHOD col13->add_text
            EXPORTING
              text = text.
          CALL METHOD col14->add_text
            EXPORTING
              text = text.
          CALL METHOD col15->add_text
            EXPORTING
              text = text.
          CALL METHOD ta1->new_row.
          text = 'Sign Off'.
          CALL METHOD col11->add_text
            EXPORTING
              text = text.
          text = ' '.
          CALL METHOD col12->add_text
            EXPORTING
              text = text.
          CALL METHOD col13->add_text
            EXPORTING
              text = text.
          CALL METHOD col14->add_text
            EXPORTING
              text = text.
          CALL METHOD col15->add_text
            EXPORTING
              text = text.
          CALL METHOD do->new_line
            EXPORTING
              repeat = 1.
    ENDFORM.
    MSK

    You can use HTTP Receiver to pass the data to the servlet that runs on the HTTP Server.  The servlet has already screen design logic written in HTML or jsp to display in HTML Table or so.  PI requires to just post data on the servlet of HTTP Server using HTTP Receiver. PI will not create screen look and feel logic while posting data.
    If you want HTML table coding logic refer this link
    http://www.w3schools.com/html/html_tables.asp

  • Printing HTML Docs with JPS ???

    Hello!
    How can I print a HTML-File with Java Printing Service (not the source, but the view of it) ???
    Some experience???
    kind regards
    pedros25

    I'm currently trying to do just that. My problem is
    that in order to get a lengthy HTML document to
    print, you have to have an object that
    implements the Pageable interface. The two methods
    I'm having trouble with are
    getNumberOfPages()
    This returns the number of pages in the Print job.
    How do I calculate the number of pages in an HTML
    document?
    getPrintable(int pageIndex)
    For this part, I just rerturn a reference to the JScrollPane which contains the JEditorPane. However,
    I also have to get it to scroll to the appropriate
    page. Right now I'm using the following:
    public void goPage(int pageIndex)
    int block = pane.getScrollableBlockIncrement(scroller.getViewport().getViewRect() ,SwingConstants.VERTICAL,1);
    int newVal = block*pageIndex;
    //scroller.getVerticalScrollBar().setValue(newVal);
    scroller.getViewport().scrollRectToVisible(new Rectangle(0,newVal,this.getSize().width,block));
    But this seems to be causing a few lines to be skipped
    between each page. Any ideas on how to implement the
    pageable interface for a JScrollPane that contains a
    JEditorPane which contains an HTMLDocument?

  • Cannot get an Apex HTML region with table with a background image to resize image to fit table

    I want to achieve this: Table whith background image but cannot get it to work in an Apex page with HTML region.
    Adding the following code to the html region:
    <table class="tableWithBackground" width="300px" height="200px" border="1">
        <tr>
            <td>
                <img class="tableBackground" src="#APP_IMAGES#Demo.jpg">
                Hello
            </td>
            <td>
                World
            </td>
        </tr>
        <tr>
            <td>How are<br><br><br><br><br>you?</td>
            <td>I am fine</td>
        </tr>
    </td>
    Results in a page with a table but without borders (at his stage I have not yet uploaded the Demo.jpg). After uploading the Demo.jpg results in a table with the entire image placed in het first cell. After placing the class code in the CSS inline property I expected to see the result as is shown in the Table whith background image  demo. For some reason this does not work (the image is no longer visible).
    Can anybody tell me how to achieve my goal?
    Thanks in advance!
    Geert

    Geert01 wrote:
    I want to achieve this: Table whith background image but cannot get it to work in an Apex page with HTML region.
    Adding the following code to the html region:
    <table class="tableWithBackground" width="300px" height="200px" border="1">
        <tr>
            <td>
                <img class="tableBackground" src="#APP_IMAGES#Demo.jpg">
                Hello
            </td>
            <td>
                World
            </td>
        </tr>
        <tr>
            <td>How are<br><br><br><br><br>you?</td>
            <td>I am fine</td>
        </tr>
    </td>
    Results in a page with a table but without borders (at his stage I have not yet uploaded the Demo.jpg). After uploading the Demo.jpg results in a table with the entire image placed in het first cell. After placing the class code in the CSS inline property I expected to see the result as is shown in the Table whith background image  demo. For some reason this does not work (the image is no longer visible).
    Can anybody tell me how to achieve my goal?
    This is a workaround. What's your real goal? Why do you want to do this?
    What browser(s)/version(s) are you using? All current browser versions have support for CSS3 background sizing which is the proper way to do this.

  • How can I be sure a table is printed with at least 1 item before page break

    I've got a form with several tables (small and large ones, depends on the selection) and I don't like to print only the header on the first page (without any items) while a page break is needed. I like to reserve lines for every table (like in smartforms) or to check a line counter of the page to trigger the page break on my own if not enough space is available
    Do you have any idea how I handle this problem?
    Thank you very much
    Lagogar

    To specify the minimum number of repetitions, select Min Count and type a number in the associated box. If this option is set to 0 and no data is provided for the objects in the subform at data-merge time, the subform is not placed when the form is rendered.

  • Printing problem when PDF is sent to the printer with certain fonts - missing text

    I'm running into a printing problem when PDFs containing certain characters of the Calibri font are used.  The text in large sections of the PDF is missing on the paper version, but the text is there on the screen.  It's also happened when the PDFs we created were e-mailed out to a client and printed on their printer.  The problem is not present when printing directly from the programs (Microsoft Word, Excel, Visio, etc.).  I've been trying to get tech support from Adobe on this, but every time I call they apologize and say they will call back in 4-6 hours with an answer.  Same result each time, no call back.  If anyone from Adobe is listening, it's case number 184891587.  The font appears as an embedded subset when I look at the document properties.  Sometimes deleting one or two Characters allows for larger text blocks to be printed - i.e. removing a long dash in bold from the heading of a paragraph makes the paragraph reappear when printed to paper from PDF.  In all cases the PDF appears correct on the screen.  Printing as an image allows the text to appear, but the image quality isn't acceptable for small text, even at the 600 dpi setting on the printer.  If the PDF is sent out by e-mail, we do not have control over the end-user's printer setup anyway, so we need this to work in all cases.  
    The setup/process I'm using is as follows:
    Windows 7 Professional SP1 64-Bit
    Microsoft Office 2013 - problem is present when printing documents from Word, Excel or Visio.  Even other variations on documents. 
    I've tried Acrobat versions 11.0.0 to 11.0.5 as well as Acrobat Pro 11.0.0 and 11.0.1.  Same Result
    Printing to Adobe PDF as the printer, from the third party application
    Printing to a Xerox printer from PDF using Acrobat - Text missing
    Client prints to Konica printer - Text missing
    I print to the wide-format Ricoh (which also does 11x17) and the text is present. 
    Is there something I'm missing?  Is the entire font not getting embedded into the PDF file?  I noticed that rolling back to a much older version of the Calibri font (1.02 compared to 5.72) makes the problem mostly go away, but it's not completely gone.  Is it possible the font is too large to be completely embedded?  Where can I go from here? 

    Success!  At least for now.  It looks like my problem was fixed with Adobe's most recent update, 11.0.06.  From the release notes:
    PDF creation
    Added support for Lotus Notes 9.
    Added support for WebCapture in IE 11.
    Added support for conversions from AutoCAD 2013.
    3652540 A blank pdf is created for files having hidden visual style.
    3601108 Flow Chart converts as a multicolored square.
    3654345 Word documents missing parts of images in conversion to PDF.
    3654572 Temporary file size increases when creating pdf by combining multiple files into one PDF.
    3670155 PDF file created with Distiller XI prints incorrectly to some printers. (Emphasis mine)
    3599407 Checkbox check marks do not appear in these files.
    3663233 IE Web Capture in localized OS: Icons and drop-down menu items are missing and conversion dialog is not localized.
    3651931 Chrome Only: Few web pages when converted to pdf from Chrome plugin doesn’t show up the Save As dialog.
    3597910 EPM Mode On: Web capture is not working on Windows 8-32 bit when cache folder is missing.
    3610644 Firefox 23.0: With Firefox version 23.0 (latest), the WebCapture icon shows up very dim as if it is disabled.
    3650244 ODA falis to convert DWG files to PDF for large files.
    I don't know if that's definately what solved the problem, but it sure sounds similar and this is the update that made the printing problem go away.  We can't get the PDFs to fail at this point with our printers, even with Calibri 5.72.  I'll come back to thread if we have printing problems at the end-user locations. 

  • Table borders show up with Firefox or IE but not Safari (Win or MAC)

    This very simple site (http://www.brandondean.net) has two table borders that show up under FF and IE but not Safari (either Win v4.0 or Safari for MAC, same result). I'm not an expert but I did the work using Dreamweaver 2004 MX as XHTML compliant, tested every page at W3C.org to make sure they comply with XHTML, and they do (except for my not putting in "alt" on images). I even downloaded Dreamweaver CS4 to run the "clean up the code" command and nothing is fixing the problem. I'm hoping someone out there has seen this before and can help us out. Thx.

    Hi Gary,
    It's probably just because the border widths you are specifying are too small (or WebKit is interpreting picas differently to Firefox/IE - I say WebKit as the same problem is visible in Google Chrome and that uses WebKit like Safari as well).
    Try setting using this instead:
    .borders {
    font-family: Verdana;
    font-size: 10px;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    color: #cccccc;
    text-decoration: none;
    border: 1px solid #888888;
    That seems to do the trick for Firefox and Chrome on this Linux machine I'm using at the moment.

  • Canon pixma pro 9500 having problems with my print out. colors are glazed and missing colors

    canon pixma pro 9500 having problems with my print out. colors are glazed and missing colors
    i have prfiled the mac and printer wiht colormunki and uplodated the profile sucessfully
    i set the printer to correct icc profile
    print out comes out same with glazed colors and missing tones/colors
    however when i use the same printer on windows and with light room, following same icc profile, colormunki calibrated profile, the print our are excellent.
    i have also tried using printer manage profile using the Mac and Aperture and get same poor prints
    can  you please assist and thanks

    I've a Pro9000 and also use Colormunki successfully.
    When I use Colormunki, I calibrate both of my monitors and the printer/paper combination. Colormunki saves the generated profiles to the correct places -- I don't load or change any profiles after that as that would mess-up what the Colormunki had just done for me, and this would likely mess-up the prints.
    Though I double-check the settings in the print dialogue, the choice for the printer handling things is already grayed-out. Colorsync handles it all just fine.

Maybe you are looking for

  • How to use PL/SQL & Forms6i for a logon screen

    i am new user to oracle. just wanna now how to create a user logon screen using SQL and Forms6i. well, i have created a table for logon with data item of username and password. in the form, i hava successfully created the data blocks but i don't know

  • Help needed in configuring Dynamic F4

    Hi All I am trying to configure Dynamic F4 help for Actvities appln. In Actvities Appln I have the Partners tab.In this Partner tab I have partner function and partner Id fields. When I make a search for partner Id  I need to launch  the search scree

  • ITUNES START-UP

    My iTunes was working fine, but now when I try to open it I get the error message "iTunes cannot run because it has detected a problem with your audio configuration." Any help is greatly appreciated. James

  • How to replicate only a subteee or a branch of complete DIT

    Hello, Is it possible to configure replication as explained below: 1. on master server single suffix dc=foo,dc=bar (single database 'userRoot' ). This suffix have branches : ou=people,dc=foo,dc=bar and ou=groups,dc=foo,dc=bar. Both these branches con

  • Flash 8: FLV

    Hi All, I have a webpage where 4 flvs can be viewed. The problem is that the playback is very stuttery. Now ive experimented with lowering the quality in the flash vid encoder but to no avail. The flv file sizes range from 500k to 2MB but there seems