wkhtmltopdf amazon linux won't encode emoji - encoding

I'm trying to generate a PDF via wkhtmltopdf in an Amazon Linux os, everything works fine, but when i try to use emoji on the HTML, the fonts break and the emoji is displayed as a black box.
Before deploying, i tried locally and it works, locally i have Ubuntu, so my guess is that i'm missing something (fonts?) in the production (the amazon linux instance) server. I tried to install Google Noto font but nothing happened. I'll attach 2 screens of the same HTML page, generated by the same command via wkhtmltopdf:
Local (Ubuntu):
Production (Amazon Linux):
As you can see, even the font below the broken emoji is not rendered as aspected, i'll add the command i use in both servers:
/my/path/to/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'file:///my/path/to/page-test-pdf.html' '/home/user/test.pdf'
Thanks for your time.

You can find a solution to a similar issue here basically twemoji.min.js replace the emoji with the corresponding image. Regarding the weird font spacing issue, you can use a monospaced font like roboto mono or something you like.

If you are running PHP 7.x, I have been having problems with the wkhtmltopdf extension within a dockerized image. We were trying to use font awesome and the text just did not render correctly. There were some compilation issues that caused this.
The problem was resolved when using the following binary https://github.com/madnight/docker-alpine-wkhtmltopdf
Hope this helps you forward.
EDIT: You will also have to have all fonts used installed as system fonts iirc otherwise wkhtmltopdf will refuse to work as it cannot find the font

Related

Converting a Japanese doc to pdf outputs boxes instead of hieroglyphs

I'm developing a service which is supposed to convert a document of different formats to pdf. All works just fine with English documents, but with Japanese the result leaves much to be desired. Namely, instead of hieroglyphs I'm getting just empty boxes - 🬀
My service is running as a Windows container and the base image is mcr.microsoft.com/dotnet/framework/runtime:4.7.2-20210209-windowsservercore-ltsc2019
I tried to install different fonts like MS Mincho or MS Gothic with no luck
Have you checked if the installation of these fonts succeeded? Installing fonts on Server Core is not trivial. We're currently working on putting out an official guidance on how to install fonts on Server Core for Windows containers. In the meantime, have you tried the Windows or Server images? They are larger images, but they contain other fonts.
The caveat, is that DotNet did not build an image on this base, so you'd have to build one leveraging the docker file they publish. For example, for the image you referenced, this is the dockerfile: https://github.com/microsoft/dotnet-framework-docker/blob/d4095f39459c58f1951abbf21cf0a2b95458fac4/src/runtime/4.7.2/windowsservercore-ltsc2019/Dockerfile
You'd have to change the FROM statement on the dockerfile to mcr.microsoft.com/windows/server:ltsc2022 for Windows Server 2022 or mcr.microsoft.com/windows:1809 for Windows Server 2019.

incorrect coding, php unit, symfony

I have a problem with encoding characters when I'm trying to run test. I'm using Symfony 4 framework with package symfony/phpunit-bridge.
I'm running test by command like below:
php bin/phpunit tests/WhovianTest.php
The results looks like below:
As we can see there is a problem with encoding in test's results. I'm using windows 10 operating system and PHPStorm IDE.
How could I solve this problem?
I would be grateful for help.
A standard Windows 10 shell has some issues with the ANSI control characters that are used to display colors (they are quite recognisable with the ?[31; characters being displayed). There are some packages to add them, or you can just turn them off.
The phpunit docs suggest:
On Windows, use ANSICON or ConEmu
Alternatively, you can set colors="false" in the opening tag of your phpunit.xml, or as a command line parameter: --colors=never (try auto as well).

Pylint in Sublime Text 2

So, I've been using Sublime for a while as a simple text editor, but I'm venturing into the land of plugins for work and I've run into an issue getting pylint to work. Specifically I have it installed and have the Sublime package manager working, but I'm not sure how to include paths in my sublime settings.
I haven't found very useful documentation on this point, but if you are willing to point me towards it that would be a perfectly acceptable answer. My basic issue is that currently every time I save a file, the following error message shows up:
"Please define the full path to 'lint.py' in the settings"
I understand this error message which is great, I just have no idea where the sublime settings are or what the standard format for defining a path is. Any help would be appreciated.
There are quite complete directions at the SublimeLinter GitHub page that should describe how to set everything up. Briefly, go to Preferences->Package Settings->SublimeLinter->Settings - Default to see where the different settings are defined. Then, open Preferences->Package Settings->SublimeLinter->Settings - User to change anything, as the main settings will be overwritten when the package is updated. Remember that settings files are in JSON format, so you'll need opening and closing curly brackets to enclose settings, and a comma between them:
{
"sublimelinter_delay": 30,
"sublimelinter_mark_style": "none"
}
I haven't gotten the error you have, are you sure you're using the regular SublimeLinter and not the new beta version? I just installed it fresh on my work machine (I've been using it for a while at home) and after restarting ST2 it's working like a charm with Python.
I had the same problem. I found it to be coming from the package "Pylinter". I removed Pylinter and added SublimeLinter, it covers more than python and is well used. I'm enjoying it quite a bit.
From your command line just run:
sudo easy_install pylint
sudo easy_install pep8
After that restart your sublime.
I encounter the same situation today. In my case, that is because I have not installed the 'pylint' in my system yet. It works fine after I installed the 'pylint' through pip.
Just for other people reference.

Eclipse is formatting javadoc tooltips very poorly on Ubuntu

I've been using Eclipse on Windows a lot, and recently started using it on Ubuntu for work.
My problem is, that the Javadoc tool til mostly is unformatted, E.g. <code> tags, links, etc. have no effect. Only line chages by b, br or ,pre tags plus bold seems to be rendered. (pre don't change font.). See the first example below.
Are there any tweaks I can do, to get something like the second image?
Extra: A fix to the colors, would be also be awesome, but not as important.
Thanks.
What I see now:
What I'll like to see
Soruce: http://codeblessyou.com/wp-content/uploads/2011/07/2011-07-01_115631.jpg
Got the same problem with the rendering of HTML inside the tooltips. After some fiddling around I got the solution:
Install libwebkitgtk-1.0-0 from the official Ubuntu repositories. It'S used by eclipse (and most likely other GTK applications) to render the HTML, but neither pre-installed on Kubuntu nor listed as a dependency in the eclipse packages.
It turns out this is caused by two problems:
Eclipse needs webkitgtk
Eclipse color scheme is messed up on ubuntu.
The solution is thus two-fold.
Part 1: Install webkitgtk
Just run this command in the terminal
sudo apt-get -y install libwebkitgtk-1.0-0 libwebkitgtk-3.0-0
Thanks to Johannes H. for this bit
Part 2: Update the color scheme
First create a new configuration in your home directory.
gedit ~/.gtkrc-eclipse
And paste this content:
# Customs color settings for Eclipse.
# Load Eclipse as follows:
# GTK2_RC_FILES=~/.gtkrc-eclipse eclipse
#
# Sources:
# http://stackoverflow.com/a/24043778/722929
# http://askubuntu.com/a/131348/18533
# http://weblog.avp-ptr.de/20120728/how-to-fix-eclipse-colors-for-autocompletion-and-tooltips/
# Tooltip background color.
style "eclipse-tooltips" {
bg[NORMAL] = "#f5f5b5"
fg[NORMAL] = "#000000"
}
# Load settings.
widget "gtk-tooltip*" style "eclipse-tooltips"
Find the eclipse43.desktop file and edit it (If you are using another version of Eclipse than 4.3 update the commands accordingly):
locate eclipse43.desktop
# Use the location from above
sudo gedit /usr/share/applications/eclipse43.desktop
Find the line that starts with Exec=... and change it from something like this:
Exec=/usr/bin/eclipse43
to something like this
Exec=/bin/bash -c "GTK2_RC_FILES=~/.gtkrc-eclipse /usr/bin/eclipse43"
Voila, beautiful colors. (or as beautiful as Eclipse gets)
For the question of background color, the problem certainly comes from the GTK settings.
You should get a solution here https://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity
For Eclipse Mars methods with GTK2 don't work anymore. You should only edit usr/share/themes/Ambiance/gtk-3.0/gtk-main.css section with name /*default color scheme */. Change #define-color tooltip_bg_color and #define-color tooltip_fg_color for your favorite color.

Sublime Text 2 FTP crashing

I'm running ubuntu 11.10 with a gnome-shell and sublime text 2 Beta Build 2180.
When I connect to an FTP server (with login) and I open a file with sublime text 2, I can edit it just fine, that is until I switch to another window. Then when I switch back sublime text 2 has frozen. No error message, it just stops responding.
Check Google, Sublime Text forums, to no avail.
Would love some help, it's important to me to be able to edit files over ftp. Work Arounds would be wonderful as well.
It's difficult to diagnose your problem from stackoverflow, since it's more Q&A and you seem to have a problem with a specific plugin. Your best bet is to contact Will Bond, the creator of the plugin. He will probably want a bug report [i.e. what was displayed in ST2's console (control+`), and any info to reproduce it.] Here's the support page for the plugin: http://wbond.net/sublime_packages/sftp/support
As a workaround for the problem, you can use FUSE (Filesystem in Userspace). It will allow you to edit files, like they are on your local machine.
Here is some description on how to setup FTP with FUSE:
http://linux.byexamples.com/archives/344/mounting-ftp-host-to-local-directory-on-top-of-fuse/