dompdf font family issue - dompdf

I'm using Bamboo invoice as an invoice generator, and I'm trying to customize the invoice template, but no matter what I do, the font just won't seem to adjust.
currently I have
body {
margin: 0.5in;
font-family: 'helvetica';
font-size: 10pt;}
I've read up on it, and helvetica is an installed font, so it should work
to make sure I changed it to 'courier'; which is also in the lib/fonts directory, but the font remains the same.
Any help?

Kinda late, but still applicable for google visitors
I had a similar problem with DomPDF, but since BambooInvoice uses it... Anyway DomPDF has trouble with the font-family definition in the CSS. I applied inline style to the top div box to solve the problem.
<div id="container" style="font-family:sans-serif;">
....
</div>

I solved my problem by removing a font: inherit that was applied as a 'css-reset' to almost all elements as a first declariation. Apparently this is not overridden by later declarations, and/or inherit doesn't work properly.

I had similar problem with DomPDF 6b3 when trying to use font-family or font-size. Finally discovered that using font instead of those seems to be working.

Remove the quotes around helvetica.

Related

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.

Adblock. Add css class or remove attribute from element

Is it possible to add css rule to an element at some page by adblock?
Something like this
#myElement {
color: white !important;
}
I tried to find a script that updates style of this element on page load but it seems that it is not a best way.
It's possible to do it on uBlock Origin and Adguard (as far as I know). Each has its own syntax for the styling rules, but uBlock is capable understanding both.
Here is an example of a CSS rule that changes Twitter background:
twitter.com#$#body.logged-in{ background-color: #8c8787 !important; }
The styling filters should be constructed like this:
<domain> + #$# + <selector> + { <style> }
Just avoid puting a space between the selector and the opening brace. Cause it can give you some trouble. Reference:
https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#style
https://adguard.com/en/filterrules.html#cosmetic-css-rules
The other answers weren't working for me but there is a way to change an element's style:
example.com##h1:style(background-color: blue !important)
Make sure not to use curly brackets.
There is also some documentation on GitHub.
EDIT: As BeeLabeille mentioned this advice seems specific to uBlock.
I don't think it's possible for AdBlock to change CSS properties, you can use an extension like Stylish (available for Firefox and Chrome) to do just that though.
For AdBlock Plus, you can try this:
##.ytp-pause-overlay, .ytp-scroll-min
##.html5-endscreen, .ytp-player-content, .videowall-endscreen, .ytp-endscreen-paginate, .ytp-show-tiles
##.ytp-endscreen-content
This should disable the display of ads during the pause, and recommended videos, at the end of the video.
PS: Ah.. this is not the subject of the question.. this removes the class from the div element. Well, maybe someone will come in handy, to delete unnecessary blocks in the Youtube player.

Add inline css style to JHTML_ (joomla) object

I don't have a lot of experience with Joomla and I'm sure how this will be a really simple question to someone who was work in Joomla before.
I'm working on existing project where I need to add inline css style to elements which are created on this way:
JHTML::_('grid.sort', $name[$id], 'a.'.$name[$id], $this->listDirn, $this->listOrder)
So I need something like this:
JHTML::_('grid.sort', $name[$id], 'a.'.$name[$id], $this->listDirn, $this->listOrder, 'style: height 500px; color: blue;')
Thanks in advance
Every kind of help will be appreciated
There is no way to pass styles to the sort element directly as you can see here in the code
https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/html/grid.php#L74.
What you can do is to add the style on the document directly:
JFactory::getDocument()->addStyleDeclaration('#myelement {height 500px; color: blue;}');
perhaps you want to add !important to the style to enforce it.

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..

Masks not working in Gecko

I am trying to mask an element that has some images inside of it, using only css.
i have done this and it works fine in webkit using -webkit-mask-box-image and its doing just what i want, but im having trouble using other browsers.
gecko is supposed to work using mask, and that tag does show up in firebug, but it doesnt actually use the mask.. i've also tried converting the png im using to base64 data uri, but to no avail.
example: http://jsfiddle.net/nNLta/
does anyone know the correct way for doing this?
HTML
<div id='wrap'>
<div class='masked flashing-anim'>
<div class='the-mask' >
<ul>
<li class='blink_1'></li>
<li class='blink_2'></li>
</ul>
</div>
</div>
<div class='the-outline'>
<img src='img/real-stuff.png' height=500 />
</div>
</div>
CSS
#wrap {
position: relative;
}
.the-outline, the-mask {
position: absolute;
top: 0;
}
.the-mask {
height: 500px;
width: 360px;
-webkit-mask-box-image: url(../img/the-mask.png);
-moz-mask-box-image: url(../img/the-mask.png);
-o-mask-box-image: url(../img/the-mask.png);
mask-box-image: url(../img/the-mask.png);
mask: url(data:lotsofchars);
}
example: http://jsfiddle.net/nNLta/
Part 1
mask is not the same as mask-box-image unfortunately. If you read the (rather sparse) docs you will see it is applicable to SVG only. More on this later.
Currently Gecko doesn't support 'mask-box-image' - if you search the MDN you'll see it applies to -webkit- only.
Additionally I don't think this is actually spec. Webkit has had this capability/concept for ages (in various forms like -webkit-box-reflect) and I think that it's just a hangover from those days. I'm not sure whether this will even be adopted by all browser vendors (although I hope, and it makes sense that, it will).
Part 2
To use the svg dependant mask: css property you need to create an SVG element and reference that. Here is a guide. I've not used this technique before so I'm afraid that's all the detail I'm going to go into right now.
An alternate option
If you don't need a clever repeating/growing mask why not create a large png and overlay the text/image you wish to hide. I'm not sure I understand what you are ultimately trying to do but this seems pretty simple to me. The obvious issue is when you need the stuff behind the mask to be selectable/interactable (err..interactive that is...); for instance when you wish to apply masking to text or links. A way around this is to use pointer-events:none which is supported in Gecko and Webkit (but nothing else...). Here's more from the MDN
Sorry I don't have better news - if none of the above is helpful please feel free to leave a comment with your specific requirement and we'll see if we can't work around the browser limitations.
Hope this is helpful!

Resources