CSS Report display HtmlPage.Window.Eval( "window.print()" ); in Silverlight 5 - html

Has anyone used HtmlPage.Window.Eval( "window.print()" ); to print pages in Silverlight 5.I understand that Silverlight has its own PrintDocument class and support for printing technologies.
But since our clients upgraded from using HtmlPage.Window.Eval( "window.print()" ); to silverlight 5's print document, they have been having issues with printing and is not usable.
I am planning to still keep the version of Silverlight 5 but use HtmlPage.Window.Eval( "window.print()" ) for printing. We use IE 10. It does not need to work on other browsers.
Can anyone recommend some good videos or tutorials about HtmlPage.Window.Eval( "window.print()" ).Currently it is printing blank pages for me.
What should I look for?
Is there something in the silverlight.js which tells it to print?
There is css file but all it has is some fonts.
Can someone help me with why the first report wraps. It is cutting off the width of the report after a certain width Is it the width of the report or the font
This is the problem I am having:
Scrre HtmlPage.Window.Eval( "window.print()" ) does not keep the format
See screenshot: printDocument
See how both of the are so different. One uses HtmlPage.Window.Eval( "window.print()" ) and the other uses PrintDocument
These are the code details for Eval method.
private HtmlDocument m_HtmlDoc;
private HtmlElement m_PrintReport;
private HtmlElement m_Div;
private HtmlElement m_Table;
private HtmlElement m_TR;
private HtmlElement m_TD;
this.m_HtmlDoc = HtmlPage.Document;
this.m_PrintReport = this.m_HtmlDoc.GetElementById( "printReport" );
HtmlPage.Window.Eval( "window.print()" );
Report Viewer
body
{
background:#ffffff;
color:#000000;
font-family: rvConsolas;
}
#font-face
{
font-family: rvConsolas;
font-style: normal;
font-weight: normal;
src: url(EmConsola.eot);
}
rptViewer
{
display: none;
visibility: hidden;
}
printReport
{
visibility: visible;
font-family: rvConsolas;
overflow: hidden;
}
td
{
font-family: rvConsolas;
overflow: hidden;
font-size: 52%;
}
Page
{
page-break-after: always
}

Related

use custom fonts in tilemill?

It seems like this can be done... but all the suggestions I've seen online aren't working for me. I have a customFont.ttf tile that I'm putting in this dir: 'home/greg/Documents/MapBox/project/myproject/customFont.ttf'
Then I'm using this code:
Map { font-directory: url(customFont.ttf); }
or
Map { font-directory: url(''); }
or
Map { font-directory: url(fonts/customFont.ttf); }
but nothing is working. I just get en error message such as:
"Invalid value for text-face-name, the type font is expected. comicSansMs, Arial Regular (of type string) was given. (line 71)"
any tips?
place your fonts in the folder app/assets/fonts, lib/assets/fonts or vendor/assets/fonts
If Rails 4+, you can only place your fonts in the folder app/assets/fonts.
In css:
#font-face {
font-family: 'customFont';
src:url('customFont.ttf');
font-weight: normal;
font-style: normal;
}

LESScss if condition when variable is not empty

I am trying to put font family for a div if the variable is not equal to null.
my less code is
div.content {
& when (isstring(#contentFont)) {
font-family: #contentFont;
}
}
the output that I get from css is
div.content when (isstring(#contentFont)) {
font-family: Abel;
}
my problem is, the style is not applying for the div.content, not sure what i am doing wrong. Any help would be greatly appreciated.
As discussed in the comments, you're using version 0.4.0 of lessphp – which doesn't seem to support the shorthand guard (when) syntax that you're trying to use.
It looks like it does support guards on mixins, however.
Try splitting your code into a mixin and a usage of this mixin, like this:
/* the mixin */
.fontIfString(#font) when (isstring(#font)) {
font-family: #font;
}
/* usage */
#contentFont: "hello";
div.content {
.fontIfString(#contentFont);
}

Adding footer for printing web pages and setting margins without media print

How can set bottom margin for web page without using class when document print.
for some reason i can not create document head. i cant use code something like this because i have no access to head of document.
#media print {
p.note {
bottom: 0; position: fixed;
}
}
If you can't, or, for some reason, don't want to use css #media, you can always use some jquery:
window.onafterprint = function() {
$("p.note").css("position","fixed");
$("p.note").css("bottom","0");
}; // IE5+
window.matchMedia('print').addListener(function(change) {
if !(change.matches) {
$("p.note").css("position","fixed");
$("p.note").css("bottom","0");
}
}); // Chrome 9+, Safari 5.1+
Here you can find some more info: http://tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/
And also there nearly exists a plugin: https://code.google.com/p/jmediatype/

Entire (completely) overwrite CSS styles

How can I overwrite an entire CSS style for a class, id or other CSS selector?
For example:
If in styles1.css I have:
/* also, this file contains a lot of styles used on other pages */
.one-great-class {
background: white
...
/* a lot of properties */
}
... and in styles2.css (that is used only in one web page) I want to overwrite the class one-great-class completely what have I do to write?
.one-great-class {
/* Is possible that a line of code to delete all styles from this class? */
}
It's not possible in CSS at the moment.
But there may eventually be a property that does this: all
It can take three values:
initial | inherited | unset
Taken from the Cascading and Inheritance Module:
"For example, if an author specifies all: initial on an element it will block all inheritance and reset all properties, as if no rules appeared in the author, user, or user-agent levels of the cascade. "
According to the MDN documentation as of June 2017, all is currently supported by Chrome, Firefox/Mobile, and Opera. Safari supports only the CSS4 value revert, which is not supported by the other browsers.
.one-great-class {
border-radius: 50% 35% / 20% 25% 60%;
color: red;
font: 12px/14px Arial, serif;
height: 20em;
width: 20em;
/*... etc. */
}
.one-great-class {
all: initial;
}
Tested to work with IE9, Chrome and Opera. I had a problem with this when I wrote it, so decided that rather than changing existing rules, that I'd just append a new rule after the existing ones. From memory, the problem was with the default browser found in Android 2.3
Altering an existing rule seemed to be a better(cleaner) solution, though appending new rules ultimately proved to be chosen path. (I was changing background images by creating images with a canvas and then setting the background-image property. The images could be quite large, hence the preference for update)
Function
function replaceRuleAttrib(ruleSelector, attribText, newValue)
{
var nSheets, nRules, sheetNum, curSheet, curStyle, curAttrib;
var nSheets = document.styleSheets.length;
if (nSheets == 0)
document.head.appendChild(document.createElement('style'));
else
for (sheetNum = 0; sheetNum<nSheets; sheetNum++)
{
curSheet = document.styleSheets[sheetNum];
nRules = curSheet.cssRules.length;
for (ruleNum=0; ruleNum<nRules; ruleNum++)
{
curRule = curSheet.cssRules[ruleNum];
if (curRule.selectorText == ruleSelector)
{
for (styleI=0; styleI<curRule.style.length; styleI++)
{
styleName = curRule.style[styleI];
styleVal = curRule.style[styleName];
if (styleName == attribText)
{
curRule.style[styleName] = newValue;
return true;
}
}
}
}
}
document.styleSheets[0].insertRule( ruleSelector+'{' + attribText + ": " + newValue + "; }", 0);
}
Sample CSS (before)
<style>
h1
{
color: red;
}
</style>
Usage:
function onHeadingClick()
{
replaceRuleAttrib('h1', 'color', 'green');
}
Sample CSS (after)
<style>
h1
{
color: green;
}
</style>
Browser will apply css that come last.
.class {
font-size: 16px;
font-size: 14px;
}
The class will get font-size value 14px.
You can decleare a css as final.
.class {
font-size: 14px !important;
}
no genarel css rule can alter it.
Browser uses this method to give priority
inline < embeded < external < user-agent.
If you think you need more controll on css then use javascript to directly modfy dom.

first-letter initial quote doesn't work in firefox

I quite dont get it here, firefox doesn't want to accept ❝ (U-275D) as my first letter dispite the fact that they are supposed to accept initial quote.
Does anybody have any idea ? http://jsfiddle.net/DXn3B/1/
.who
{
font-family: 'Open Sans', sans-serif;
font-weight:lighter;
color:#565656;
font-size:1em;
}
.who:first-letter
{
float: left;
font-size: 2.5em;
line-height: 1;
margin-right: 0.2em;
}
.who:before
{
content: '\275d';
color:#272727;
}
.who:after
{
content: '\275e';
color:#272727;
font-size: 2.5em;
font-family: 'Coverdale-Condensed', sans-serif;
}
The notation '\275d' denotes U+275D HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT, which has General Category So [Symbol, Other]. Hence, the CSS 2.1 rule on :first-letter does not apply to it:
“Punctuation (i.e, characters defined in Unicode [UNICODE] in the "open" (Ps), "close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po) punctuation classes), that precedes or follows the first letter should be included”.
You could try put them as text:
.who:before
{
content: '❝';
color:#272727;
}
.who:after
{
content: '❞';
color:#272727;
font-size: 2.5em;
font-family: 'Coverdale-Condensed', sans-serif;
}
jsFiddle.
Try this site for more cool stuff.
I can’t see why you are using both .who:first-letter and .who:before here. (.who:before already allows you to format the content you are inserting almost any way you like, so using :first-letter as well is kinda redundant, or in this case, maybe even the cause of the error.)
Add the declaration you have set for the first one into the rule for the latter (and delete the first completely), then you should get what you want.
Really, I have no idea why it doesn't work. But maybe that's somewhere near your desired result. http://jsfiddle.net/DXn3B/4/
I used the :before itself instead of :first-letter and it works fine. Maybe those two aren't meant to work together like that.