|
<SPAN> tags are not recognized by the Java HTMLFactory. Therefore, a default inline empty element is displayed as to not disturb layout. However, CSS classes, styles and other attributes are ignored. Hopefully, new releases of Java will fix this. In the meantime, a work-around is in the works. Java does interpret the <FONT> tag, now deprecated in HTML 4.0, and all attributes as an inline element. This can be used as as substitute for <SPAN>.
<STYLE> tags are ignore in the body of an HTML document. This is one of those situations that is forgiven by most browsers. Java will only interpret a <STYLE> tag in the head of the document where it was intended. In addition, the contents of the <STYLE> tag (stylesheet classes) will be displayed as body content in the PDF document. This is easy to circumvent by placing your <STYLE> tags in the head of the HTML document.
Stylesheet borders do not display for tables. Java only interprets the default raised table borders display.
Multiple CSS class inheritance does not work. As with MS Word and Excel, only the first class is recognized in an object. only the class "myclass" will be recognized and rendered in the following: <div class="myclass myotherclass">
Fonts are limited to the 14 embedded Adobe Acrobat fonts to avoid missing client fonts, substitution errors, and issues like the dreaded "Bad BBox" error. The method FontSupport() can be called to allow unsupported fonts to be utilized. However, this is not recommended as the PdfFile class cannot generate dynamic font descriptors for fonts within the HTML source document. A "Missing Font" or "Bad BBox" error will occur upon opening the resulting PDF. The fonts may display properly after ignoring the Acrobat Reader error.
The preceeding issue is the most impactful because of its effect on rendering. In this situation, Java swing is interpretting the actual font size and styles within the source HTML. The resulting rendered page within the PdfFile virtual browser is based on the actual declared source fonts and their sizes. These areas are calculated prior to font substitution. Hence, the substituted font within the PDF document may require more area than the original font, causing overlap or gaps between HTML object containers. Please read the portion on fonts in the Tips & Tricks section below.
Font sizes declared in points render in pixels and vice-versa. It appears as though the developers at SUN have confused pixels and points. If a font-size attribute is declared as 12px it is rendered at 12pt; 12pt as 12px. The remedy for this is to simply dispose of the unit size in your size declaration. When declared as 12 with no unit, Java will render the font or object in pixels. By default, browsers will do the same.
If image size attributes ( WIDTH and HEIGHT ) for an HTML <IMG> tag are not specified, some images will not properly display at their default size. This only occurs for images created in certain image editors that do not create a proper size header. This is a rare issue, and ONLY occurs when size attributes are omitted. Always use width and height attributes when possible.
Some styles within class objects may be ignored in <TD> tags. This is puzzling and unfortunate, although easily remedied. So far, it appears that padding and margin styles declared in a custom class object will be ignored, but recognized and rendered properly when placed in a style attribute. Rather than doing <td class="pad">, use <td style="padding: 10;"> instead.
Only characters 1 through 255 are displayed properly. Double-byte characters will not display as expected.
Using the RELOADABLE context attribute in Apache Tomcat can often cause ClassLoader Lifecycle issues. One of the effected classes is the DefaultUI in Java swing. This will cause form elements to fail rendering. Because of the overhead, RELOADABLE is not recommended by Apache in production environments. Dan Oross Consulting urges setting RELOADABLE to false.
|