Html Table Caption problem in conversion to pdf - itext7

I am converting html to pdf by using HtmlConverter.convertToElements and then adding the iElements to the document. And it works with every html element except a caption element directly inside a table.
<table>
<caption>Some text</caption>
... TRs with TDs here ...
</table>
The error is
java.lang.IllegalStateException: FontProvider and FontSet are empty.
Cannot resolve font family name (see ElementPropertyContainer#setFontFamily)
without initialized FontProvider (see RootElement#setFontProvider).
I have identified that the error occurs at com.itextpdf.layout.renderer.TextRenderer.resolveFonts when the FontProvider has no fonts. It does not help to explicitly define the font for caption in a style and all other elements use the same font just fine. If I hide the caption by using display: none; everything else (h3, p, div, th, td) renders correctly in the pdf and uses the fonts just fine. It feels like something is wrong in iText, but a work-around would be welcome in the meantime.
I am using Linux, Java and itext7-core 7.2.3 and html2pdf 4.0.3

Related

Oracle Apex 5.1: Styling the Region Title

I have created a Login page using Oracle Apex 5.1 where the region template is "Login". I want my region title to be bold and also want to increase the size of the title text. How can I achieve this?
I am sorry if this question is very noob level question. I am new to Oracle Apex and have spent several hours to achieve this. Could anyone help me solve this problem?
You can use HTML in any text fields like titels, headers, region text etc.
<p><font size="20" face="verdana" color="green"><b>This is some text!</b></font></p>
Also you can put region static ID and make custom styling with CSS (in page Inline CSS or in ThemeRoller)
Edit:
Just simple example:
I have Colapsible region with static id: reg
Region title is h2 elemnt in the Div so in inline CSS section put something like this:
#reg h2{
color:red;
font-style: bold;
font-size: 24px;
}
Change color, size, style or delete some lines until you are happy with the result.
You can use many style properties like drop shadows, font type, margins, paddings etc.
Use google search for more about CSS styling.

How to embed image in RTE componet in CQ5

I have a CQ5 component where the users can write some text with a richtext editor. It is also possible to paste Image script code into source editor available in RTE.
When I am pasting the source code as below
<div style="background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='); height:100;width:100;"></div>
into RTE, It's getting converted as shown below and it is not rendering the image.
<div style="background: url('data:image/png; base64,ivborw0kggoaaaansuheugaaaauaaaafcayaaacnbyblaaaaheleqvqi12p4//8/w38giaxdibke0dhxgljnbaao9txl0y4ohwaaaabjru5erkjggg=='); height: 100; width: 100;"> </div>
Has anybody a suggestion what can be the cause of this problem?
I believe the code that is formatting the HTML is in /libs/cq/ui/rte/core/HtmlSerializer.js and/or /libs/cq/ui/rte/core/HtmlProcessor.js so you may need to override that by copying that file to apps as /apps/cq/ui/rte/core/HtmlSerializer.js and/or /libs/cq/ui/rte/core/HtmlProcessor.js. This code is doing toLowerCase in several places, though I don't know specifically where it would be altering a style attribute value. But I suspect it is. One of those files has a comment that seems suspicious:
// IE < 9 will report uppercase style names; hence normalize to
lowercase
So perhaps there is some code added to work around an IE bug that is messing up what you are wanting to do--essentially introducing a different bug while fixing an IE issue.

CKEditor moving br tags

I'm having a problem with CKEditor changing my original paragraph formatting with negative side effects.
I start with a basic paragraph loaded into CKEditor using setData():
<p><span style="font-size:50px">My Text</span></p>
... more document content ...
In the editor, I move the cursor to the end of the phrase "My Text" and press enter (with config.enterMode=CKEDITOR.ENTER_BR setting enabled). Inspecting the markup inside the editor I now see:
<p><span style="font-size:50px">My Text<br><br></span></p>
... more document content ...
Then, when I call getData() to pull the contents from the editor and save the document to a database, the HTML extracted by getData() looks like this:
<p><span style="font-size:50px">My Text</span><br> </p>
... more document content ...
This is a problem because while editing, the <br> tag was inside the <span> and was subject to the 50px font size style. The user saw a 50px blank line before the next piece of document content. After saving the HTML to a database and reloading later the <br> tag is now outside the <span> and is not subject to the 50px font sizing and the blank line appears much smaller than before.
The round trip fidelity of the text formatting is not preserved and the user is frustrated by the results.
Can someone help me understand the results I'm seeing with <br> tags being reformatted and moved around during the editing life cycle, and how I might fix this problem?
Using CKEditor v4.4.1

Dropdown falls behind jPlayer (IE7)

I'm working on a new website re-design; so far every browser compatibility issue has been resolved no problem - but there's one that remains in IE7.
The client has a dropdown menu from the header which extends over the content, but the problem occurs when the client has a related video on the page as this is often displayed first; the video [being displayed just below the header] pushes the menu behind.
The dropdown is created in CSS using a high z-index value (1000).
JavaScript is used to hide and show the menu by altering the 'visibility' value.
The video uses jPlayer, given the age of IE7 it doesn't use HTML5 to display the video but instead includes a .swf file.
I have tried altering the z-index of the header, jPlayer, etc to the suggestions on this site but had no luck. I have also tried changing the position from absolute to relative but this broke the dropdown.
I have modified the parameter 'wmode' so that it's property is 'transparent', I've also tried 'opaque'.
The only difference I have made so far is adding hours to the work-log.
The page is question can be found here:
http://www.newforest.gov.uk/healthandleisure/
Thanks!
Have you tried an iframe shim? I had a similar experience with the google earth plugin, and adding the shim to the pieces that need to go on top of the swf elements as:
<iframe class="bgi" frameborder="0" scrolling="no" src="about:blank">
<html><head></head><body></body></html>
</iframe>
where bgi is a class that has
height:100%;
width:100%;
z-index:-1;

Outlook 2010 overriding font-family from Arial to Times New Roman

I'm programmatically sending HTML-formatted email, and setting the font as Arial throughout (font-family: Arial;). When the messages arrive in Outlook 2010, text in table elements is in Times New Roman. Text in div elements is fine in Arial. If I View Source, copy into an HTML file, and view in a browser, all fonts function as expected (it's all Arial).
Some Google results show that Outlook will fall back to its default font (Times New Roman) when none is specified, but that's not what's happening here.
Why is Outlook forcing my email to display in Times New Roman when specified otherwise?
Even if you set font-family: arial to table, it still wont work. You need to specifically set the font for each td inside your table to get it right.
<!--[if mso]>
<style> body,table tr,table td,a, span,table.MsoNormalTable { font-family:Arial, Helvetica, sans-serif !important; }</style>
<!--<![endif]-->
The table in question was nested in a div that had font-family:Arial; in its style, but the table did not have a font set. So tables don't inherit fonts (and perhaps other things) from their containers in HTML emails in some clients.
This issue was happening from outlook 2007 and the previous solutions didn't work for me, the only solution that seems to work is wrapping the text with <font face="arial, sans-serif">My text with arial</font>
If you're working with Outlook 2007, you must define font-family on table . Otherwise it will set to default serif font.
The <font> tag is deprecated but since Outlook 2010 is removing (almost all) styles, this is the only way it works.
table.MsoNormalTable
{font-size:12.0pt;
font-family:"Times New Roman";}
Open your HTML with Text Pad, and change it to Arial.
None of above methods worked for me, using a custom font linked with #font-face. had to work with conditional tags for Outlook. Took me quite some time to figure out how exactly. So I've set up a code example: I was still having some troubles implementing this in my situation so I've shared a code example for this: https://stackoverflow.com/a/21626196/135654
You can put your style to "span" tag, It will works good.
<td>
<span style="font-family: "Times New Roman"></span>
</td>
I had the same problem....all text in the body of the email was Arial, but the table defaulted to word. I had to wrap the font in each each cell......time consuming..

Resources