Gecko Engine in ABCPDF not rendering text color - gecko

I'm using ABCPDF + Gecko to render some PDFs within an HTML->PDF templating engine I'm writing. I switched to Gecko specifically to be able to render embedded SVG graphics for things like signatures. However, it seems that now all font colors have changed to black,regardless of the style sheet, class names, or even inline styles being used. Is this a gecko configuration problem, a problem with ABCPDF, or ... ??
Example HTML:
<span style="color:blue;">This should be blue</span>
I'm specifying no options besides browser size, and didn't customize anything in the XULRunner21_0 folder. I'm using AddImageHtml to add the html to a PDF document.
Update: after some more research looks like this may be tied to how Gecko treats text upon printing (not the same as media type). Is there a setting that will prevent it from mucking with the visuals?

This ended up being caused by including bootstrap css in my little project. Removing the print media bits from my copy of bootstrap resolved the issue.

Related

style of asciidoc Admonition missing while using Hugo ? ( syntax not supported? )

I'm using Hugo to generate static pages in Gitlab, seems the syntax of asciidoc not supported well (such as Admonition)? or it's just about the theme I'm using?
for code [TIP]
Expected:
Current:
Please enable font-based icons by adding
:icons: font
to your document. See Font Icon Mode in AsciiDoc docs for details.
Depending on the CSS you use, the tool tip might look different. See below for the "classic" CSS of Asciidoctor.
Once you add the :icons: font, it is a matter of updating the CSS to make it look like your screenshot above.

How to reformat a Vue.js component in VS Code?

I'm using Visual Studio Code to code a Vue.js component and need to reformat the code of that component.
I did not find any built-in formatters, and the first choice for a plugin was vue-buetify which informs after installation that
There are many bugs in the extension, please do not use it, the better choice is vetur
I then tried Vetur by installing it but there is no place where I see an option to beautify the code currently in the editor. The Shift + Alt + F command has no effect.
How can I actually beautify (reformat) the code for a Vue component?
I've been fiddling with formatting quite a bit since my previously working project stopped formatting one day. Here's what I think the current state of the art is:
Use extensions vetur and prettier (specifically, esbenp.prettier-vscode Prettier - Code formatter). (You get these preinstalled by Vue.js Extension Pack esbenp.prettier-vscodeand others.)
Vetur is the (current) mandatory default tooling for vue. Accept no substitutes.
Prettier doesn't support .vue files per se, so that filetype is disabled by default: https://github.com/prettier/prettier-vscode/issues/338.
But Vetur understand its limitations and instead delegates formatting of individual sections of the .vue file to a potentially different formatter. By default, though, it delegates everything other than HTML sections to Prettier. https://vuejs.github.io/vetur/formatting.html. It disables formatting for HTML sections.
Vetur developers are down on js-beautify-html, although it is still apparently functional: https://vuejs.github.io/vetur/formatting.html. And they don't make an alternative recommendation at this time.
Prettier support for HTML, which would be the obvious choice if only it existed, is a long, sad story. Currently (May 2018), prettier formats HTML as JSX. Many subtleties are mentioned, but one issue that I have grasped is that JSX converts begin/empty/end tags to empty tags, e.g to . Apparently React and (I believe) Vue, do not like this, hence vetur disables Prettier for HTML.
So I'm going forward with enabling js-beautify-html in vetur settings, hoping for the best and keeping my eyes peeled. But I'm such a superficial coder that I may never trip over its known issues.
In 2022, the situation regarding formatting Vue files regaled in another answer has vastly improved.
Vetur is still the de facto solution for managing .vue files in VS Code, but in the time since this question was asked, Prettier added full support for them (and HTML proper). This means you can format them using Prettier without Vetur if you so desire.
Note that Vetur does not support VS Code's "Format Selection" functionality, even though Prettier does (for a small set of languages):
Vetur only has a "whole document formatter" and cannot format arbitrary ranges. As a result, only the Format Document command is available.
The Format Selection command does not work.
If you do decide to use Vetur, you shouldn't need any other extensions to get formatting to work, as the extension comes bundled with all of its available formatters. As long as you have the extension installed and enabled, formatting with the "Format Document" command or Shift + Alt + F should work out of the box.
Vetur's settings allow the user to configure which of its available formatters is used for each language it supports (Prettier is the default for all but Sass and Stylus). The formatters can also be toggled off per language, or entirely, if you prefer to use some other formatting solution instead.
If you have installed the Vetur extension on VS Code,
Go to the VS Code extension area.
Find Vetur and select the gear icon to enter settings of Vetur.
Scroll down until you find
Vetur › Format › Default Formatter: JS
Default formatter for <script> region
Select pretter-eslint from dropdown menu
(if you don't see that option you can install Prettier extension).
Now you can see it formats your code automatically whenever you save.

X Displayed in dijit.form.Select

I am working on an application build on Dojo 1.4 and currently used on IE8.
When tried to run IE10 Compatibility view, I observer some X (to clear the data) are being show in the fields like dijit.form.Select. While in IE8 it doesn't display them
Please guide to remove them or what basically is happening
Thanks in Advance
If this is the same problem I just fixed then the question isn't referring to the IE10 "clear field" X. It's referring to a very large text "X" character that is displayed in the Select widget in addition to the options that are supposed to be there, making the widget twice as tall as it should be.
In my case it was because I was mixing the CSS stylesheet from one Dojo version with the API's from another. Check to make sure that your stylesheet and dojo.js versions match. For example, in my case the stylesheet was:
...href="//ajax.googleapis.com/ajax/libs/dojo/1.7.5/dijit/themes/claro/claro.css" media="screen">
while the script being included was
... src="//ajax.googleapis.com/ajax/libs/dojo/1.10.1/dojo/dojo.js"></script>
I blame the fact that I was modifying Dijit sample code without knowing what the heck I was doing...

PhantomJS not exactly rendering Sankey diagram HTML to PNG

I'm having trouble adjusting PhantomJS to create a PNG file that matches the original browser presentation.
Here is the entire sample html file. It's a sankey diagram creating using rCharts and d3-sankey. (You'll need to save the file to your hard drive and view it from there.)
I'm running on Windows and using rasterize.js:
>> phantomjs.exe rasterize.js test.html test.png
ISSUE: Below is a snip of one of the text strings when viewed in a browser:
And here is a snip of the same string from the PNG created by PhantomJS:
How do I make the text-shadow go away? I've played around with various CSS attributes (text-shadow) and webkit-specific attributes (e.g., -webkit-text-rendering), but can't seem to make it go away.
Is this a setting in PhantomJS? in the underlying webkit? or somewhere else?
rCharts has an undocumented function called take_screenshot that uses CasperJS (which in turn uses PhantomJS to take screenshots of rCharts created visualizations on a given html page.
For example, I forked the example you provided, renamed it as a html file, which you can view here.
I ran rCharts::take_screenshot('http://rcharts.io/viewer/?7063641'), which results in the following screenshot. The take_screenshot function uses system commands, and work well on a Mac. I have not tested it on Windows, so YMMV.
NOTE: You will need to install the dev branch for this feature.
OK - I found the issue. It is related to browser display differences. SANKEY.CSS sets the text shadow:
.node text {
pointer-events: none;
text-shadow: 0 1px 0 #fff;
}
The text-shadow is ignored in Firefox (my default browser) and is properly rendered using Chrome (thanks #ramnath for cluing me into the browser differences!). PhantomJS uses webkit to render pages (which works properly) while Firefox uses gecko (which obviously doesn't implement text-shadow properly.) Fiddling with text-shadow in my original post didn't affect any changes - because Firefox wasn't rendering any changes and I was experimenting in the browser.
SO, the fix is to override .node text-shadow in my main HTML file. After the change, all is rendering as I prefer in the PhantomJS-created PNG.
.node text {
pointer-events: none;
text-shadow: 0 0px 0 #fff;
}
Lesson: to properly test HTML for rendering in PhantomJS on Windows, use Chrome to preview. Both use webkit as the underlying rendering engine.

Using a <style> definition makes a font unfindable in jasper reports pdf export?

I have a jar I include with my application with some fonts. If I paste around
<font fontName="NimbusSansGlobal Light" size="12" pdfFontName="NimbusSansGlobal Light" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
into all my text elements, PDF output works fine. If I switch them all to use a style which defines the font as such:
<style name="SansFontStyle" isDefault="true" pdfFontName="NimbusSansGlobal Light" pdfEncoding="Identity-H" isPdfEmbedded="true"/>, then the font can't be found by the JRLoader when I try to generate reports. Interesting enough, if I use JRLoader within my application directly, the font is found fine.
Why would styles break PDF export?
Using Font Extensions should solve this problem.
Once you use font extensions, then you can set the font in the text element or in the style. You will not specify pdfFontName, pdfEncoding, or isPdfEmbedded in the report. That gets specified in the font extension.
Note: In a strict interpretation, this doesn't actually answer the question. I have no idea why styles work differently from directly setting the fonts. It seems like a bug, but maybe it's unexpected yet intentional for some reason we aren't thinking of. Therefore, I started to enter this as a comment rather than an answer. But it got too long.
Regardless, this should allow you to use styles as you want to. So I expect that it will solve the heart of the problem.
Font extensions are documented in the JasperReports (and iReport) samples and documentation, so it should be pretty easy to use them once you know that you ought to.