Is Flying Saucer's treatment of images in cells a bug? - html

I managed to whittle my example down to the following (it uses some reasonably hefty data URLs but stackoverflow should flow them off the side nicely...):
static
{
String oldValue = System.getProperty("java.protocol.handler.pkgs");
if (oldValue == null)
{
System.setProperty("java.protocol.handler.pkgs", "org.xhtmlrenderer.protocols");
}
else if (!oldValue.contains("org.xhtmlrenderer.protocols"))
{
System.setProperty("java.protocol.handler.pkgs", oldValue + "|org.xhtmlrenderer.protocols");
}
}
#Test
public void testLegacyCellSpacing() throws Exception
{
ITextRenderer renderer = new ITextRenderer();
renderer.setDocumentFromString("<html>\n" +
" <head>\n" +
" <title>Some title</title>\n" +
" </head>\n" +
" <body>\n" +
" <div>\n" +
"<table cellpadding=\"0\" cellspacing=\"0\">\n" +
"<tr>\n" +
"<td>\n" +
" <img src=\"data:image/png;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAHgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQAEAsLCwwLEAwMEBcPDQ8XGxQQEBQbHxcXFxcXHx4XGhoaGhceHiMlJyUjHi8vMzMvL0BAQEBAQEBAQEBAQEBAQAERDw8RExEVEhIVFBEUERQaFBYWFBomGhocGhomMCMeHh4eIzArLicnJy4rNTUwMDU1QEA/QEBAQEBAQEBAQEBA/8AAEQgAUwC5AwEiAAIRAQMRAf/EAJQAAAEFAQEAAAAAAAAAAAAAAAIAAQMEBQYHAQADAQEBAAAAAAAAAAAAAAAAAQIDBAUQAAEDAwIDBgQEBgEFAAAAAAERAgMAIQQxEkETBVFhcYEiMpFCFAahscHR4VIjM2M08fBygqIVEQACAgEDAgUDBAMBAAAAAAAAARECMSFBEnEDUWGBIjKRQoKhwRMz4VJyBP/aAAwDAQACEQMRAD8Ayl/5pwUShA8+6nW9eqecHuQ0bfitQrf8hVfNzXQpDAN07u3RtDaSljSbcIvlhbcrTFBWOB1lQ4SFexf0q1j5mTu5GXHtcR6JALHuNSry4dbV6obrG9X0Li6FKZSaZTqAgpJddF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OAtg4BcSBFFYuI94aVnmaAOruHQWpHUx4YGayD7fdY93tqoByiPUU9LbNcAYQM5p10MWVEaB50AA3fFvRCFcjNXbgQIwGZFE1m5I04jiKFn7WeEnLzoAW+2S63bkhWPUefhQ/+PtP+M/Ktu3VSweQeXEya2RROYHGJJZZbNtbKCAoxjnRTJOHUePGsxLgtpMcWamWXU9KY6R1N41k67LT0MgTA9KuDGcUKSCTMk5mjLg4cqTGglGEE1GYLkJ8aHUoOeNWYNSUUpZ2ygcTTRFJLEQFpb3jqKjGKfa2Lug0sVzNJddXSAceNc3eb+5ZKlhnlFI/9HdIveZDpOCDP51a+trZLunoLfrs7FxbSmbrZKPpGcmsPct2iCzTics5NTc33uXA3b03OJ8Kz3WRrwmAFHU3ia0Rmxl99ZlXJnCP3mlPb0jrzABwyqu5Z2vcZxrZhCBcaXrvRN1CpbhTAYzTCA4nhwNCbo0STqIyBg/OlziGYRh8hR27aAG42Jn2+FACrT2QzFiUkYim7fcql2MgfZhHzpJhX1FZGRn9tZrl0OzKxhcYOU8KQHZP3FLVwK0uGyIOFbLd3q1p515/YWrRcC4cG9s11rVy5bftwXtmPOmB0lutEg48qqHuYnTC5k0plKdUyuYBoluyRrXDkDhQBp20mQMDhHLxrZDc6w2m7d0Nhjy4VplvxFLY9EaO2conx9eNPtf4x7f7cqlSs7cbLXOic6H8YVKlJACtW04RP9sfnUqVW/cWvYJchVLxy/OpUqRmDd5XPbMcc/wC3hQW47CT/ALp9IqVK1Rmzn3v8pzyOX51zt177n9P0eXGpUpgL2cd+zz/1+XDhNdLdzJ93CMv9tSpSAyH/ABmZ4+7P04ULz21zjwqVKYF49sZ5N7orntHcGXHOYqVKAGW8hnmfwK7P2/24T+OU1KlAHQu+3H1/hQ248PhNSpQBH/yifD8YVtw8PWpUpAf/2Q==\" width=\"185\" height=\"83\"/>\n" +
"</td>\n" +
"</tr>\n" +
"</table>\n" +
" </div>\n" +
" </body>\n" +
"</html>", null);
renderer.layout();
File pdfFile = File.createTempFile("TestFlyingSaucer", ".pdf");
OutputStream output = new BufferedOutputStream(new FileOutputStream(pdfFile));
try
{
renderer.createPDF(output, true);
}
finally
{
output.close();
}
System.out.println(); // breakpointing here to look at the output. no good assertions available for checking this problem yet. :(
}
This code runs, and generates a PDF which has incorrect spaces between each image. I can't figure out what is causing the spaces, but I can't figure out if it's a bug either. What I do know:
Web browsers don't show spaces between the images.
If you remove the images and replace it with something like a fixed size div, the problem magically goes away (this proves that flying saucer is doing the right thing with the legacy cellpadding and cellspacing attributes, which was my initial concern.)
If you add a 1 pixel border to the cells (td { border: 1px solid red; }), it shows that the extra space is outside the td elements.
If you remove the whitespace between <td> and <img the problem appears to vanish.
It seems odd to me that extra space inside the element could result in extra padding/margins outside the element. Perhaps I'm completely misunderstanding HTML though, so I'm hoping that someone will set me straight here before I jam an issue in their tracker.
(Also: Preempting the typical knee-jerk answer of "don't use tables for that" - this is not my HTML, I'm trying to render real world HTML to PDF after cleaning it up. This example shows post-cleanup HTML to rule out the problem being in the cleanup code.)

Browsers are sensitive to white space in HTML in many places, including inside and in between elements, and even in places you would not expect. For instance, if you had a ul with li elements, if you use CSS to style the items with li {display:inline} to make a horizontal menu, any white space between </li> and the next <li> will space the menu items apart!
In this particular case, seeing the white space indenting the first child element is certainly unusual but I can't say categorically if it would be considered a bug according to the HTML standards. Your best solution is indeed to simply eliminate white space where it causes issues.

Related

Putting HtmlWidget elements in a paragraph

May I know how to put the elements I get from HtmlWidget(allwordlist![0].ivakavakayagataki.toString()), HtmlWidget(allwordlist![0].ivakavakayagataki.toString()), in a paragraph?
I am making a dictionary application and the above HTML render code works but problem is that I cannot seem to find a way to put these two in a paragraph as in side by side like a sentence.
May I get some help un knowing how to do this please.
Thanks in advance.
Ok so I made it work.
So I first made this function and not that <p> tags so the problem thats was making my HtmlWidget statement not inline and having line breaks was because of the p tag so I first took it out.
Widget mergehtml(String html1, String html2,){
html1 = html1.replaceAll("<p>", "").replaceAll("</p>", "");
html2 = html2.replaceAll("<p>", "").replaceAll("</p>", "");
String mergedHtml = "<p style='font-size:18px;'>" + html1 + " " + "[" + html2 + "], " + "</p>" ;
return HtmlWidget(mergedHtml);
}
and then I called it and put my two variables there.
mergehtml("${allwordlist![0].tina}","${allwordlist![0].itavi}",)
it then started working inline.
Thanks :)

Manage liste separator while the screen change size (media query)

I try to manage separators (like a "-") between each element of a list.
It's relatively simple when we only have one line, but I can't do it with more than one line.
When the site is displayed on a big screen I have:
Example center aligned
Listitem1 - listitem2 - listitem3 - ... - listitemX
The last item having no separator "-"
html
<p>
<a>listitem1</a>
<a>listitem2</a>
<a>listitem3</a>
<a>listitem4</a>
<a>listitem5</a>
<a>listitem6</a>
<a>listitem7</a>
...
<a>listitemX</a>
</p>
CSS
a:nth-child(n+2)::before {
content: " - "
}
This is relatively easy in CSS using :: before from the 2nd child...
But with media queries, when my screen shrinks and this same list spans multiple lines, I would like to remove the last "-" separator from each line.
Example center aligned
Listitem1 - listitem2 - listitem3 - listitem4 (without the separator here)
Listitem5 - listitem6 - listitem6 - listitem8 (without separator here either)
Listitem9 - etc ...
Does anyone have an idea?
Thank you in advance. Sebastian
There doesn’t seem to be a pure CSS solution, but you can use a bit of JS to set or unset a class based on whether an item is the first in a line.
Here I’m setting the text color to transparent rather than the content to "" because changing the content affects width, which then jumps around as it wraps/resizes.
a.firstInLine::before {
color: transparent;
}
The Javascript goes through the nodes and checks whether it’s lower on the page than the previous node. If it is (by more than a small margin of error), it sets the class firstInLine:
function calcY() {
document.querySelectorAll("p a").forEach((n, i, nodes) => {
if(i > 0) {
const thisY = n.getClientRects()[0].y;
const prevY = nodes[i - 1].getClientRects()[0].y;
if(thisY - prevY > 4) {
n.classList.add("firstInLine");
}
else {
n.classList.remove("firstInLine");
}
}
});
}
window.addEventListener("resize", calcY);
calcY();
I should add that there are a couple of other CSS things to set. We don’t want it to wrap, and in order for getClientRects to work right, it can’t be a purely inline element, so:
a {
white-space: nowrap;
display: inline-block;
}
CodePen

Removing Quote inside <title> tag

The code I used to Produce This is the same as the one WITHOUT this problem
(just pulling from a different database column)
if (!string.IsNullOrEmpty(childspec.titlew)) {
wtitle = childspec.titlew;
ltlMasterPageTitle.Text = HttpUtility.HtmlDecode(wtitle) + "";
} else {
wtitle = childspec.laytitle;
ltlMasterPageTitle.Text = "Company Name - " + HttpUtility.HtmlDecode(wtitle);
}
here is the code that does the output.
When its the ELSE case then the content does not have a wrapper around this
not sure if this is a serious SEO issue as well**
ALSO how do i remove this extra Tab space infront of the text?
I still don't know where the extra space came from but I just applied
Trim()
again before the output code and it removed all extra spacing and quotes

Is it possible to apply different colours to different parts of an Indic character?

Being inspired by Is it possible to apply CSS to half of a character? I was wondering if something similar could be done with Indic text? As an example, in Sinhala ක + ා = කා (consonant + vowel). Is it possible to render the vowel stroke as a different colour from the base consonant? Other combinations:
ක + ෙ = කෙ
ක + ු = කු
ක + ො = කො
ක + ් = ක්
ම + ් = ම්
ම + ු = මු
ද + ා = දා
ක + ්‍ර = ක්‍ර
ර්‍ + ක = ර්‍ක
ක + ්‍ය = ක්‍ය
ර්‍ + ක + ්‍ර + ො = ර්‍ක්‍රො
I'm looking for an effect similar to this:
Thanks in advance for your awesome answers!
I've had a play with the code from the previous question and come up with this:
http://experimental.haujuseiit.com/vowelstroke.html
If you go to the link you'll see that some combinations don't work but most of them do. The other issue is when the vowel stroke is completely or partially before the consonant. I've had to set explicit widths for "e" (yellow) and "ee" (dark green) which will probably break with different fonts.
I'll post the source code when I've automated the solution.
Improvements anyone?
As far as I know it is not possible to apply a css style to half a character, but I bet you could fake it using two z-indexed graphics, or even glyphs, of differing color. Using one to mask the other.
That would work, but would be a huge amount of work.

Displaying div tag in a textbox

I am saving the below div tag into SQL DB:
String StrDiv = "<div STYLE=" + "''"+"font-family: " + lblPreviewPane.Font.Name + "; font-size: " + lblPreviewPane.Font.Size + "; color: " + ColorPicker1.Color + ""+"''" + ">" + lblPreviewPane.Text + "</div>";
The below query is used to update the message:
String sqlUpdate = "update iweb_messages set message='" + StrDiv +
"'where site_id ='" + mSiteID + "' and page_id ='" + ddlSitePage.SelectedValue + "'";
I retrieve the div from DB and display it in a textbox and a label.
In the label, the div tag is displayed as: messagetoday21
But in the textbox, the div tag is displayed as:
<div STYLE='font-family: Times New Roman; font-size: 18pt; color: #CC3399'>today21</div>
I need to display the text alone in the textbox also(same as displayed in the Label).
Kindly help me with some suggestions.
I use the below code to display the text from the DB in the textbx and label:
String sqlMsg = "select message from iweb_messages where site_id='" + mSiteID + "' and page_id='" + ddlSitePage.SelectedValue + "'";
DataView dvMsg = dbLib.GetDateView(sqlMsg);
if (dvMsg.Table.Rows.Count > 0)
{
txtOutputMessage.Text = dvMsg.Table.Rows[0]["message"].ToString();
lblPreviewPane.Text = dvMsg.Table.Rows[0]["message"].ToString();
}
I assume your "textbox" is a textarea? If so, the behavior you're seeing is expected, because you're generating HTML that looks like this:
<textarea><div STYLE='font-family.....></div></textarea>
The content of a TEXTAREA is displayed without HTML rendering. Whereas the label (assuming it's a span or another div) will render the HTML.
So, as a quick fix, you need to save lblPreviewPane.Text to your database in addition to the full <div>; then display the value of lblPreviewPane.Text in your text box instead of the <div>.
But I would also question the wisdom of storing the full <div> in the database. If the font attributes need to be determined ahead of time, then I think you would be better off storing those attribute values in the table, then building the formatted <div> when it is being displayed.