PhantomJs specifying custom font (.ttf) location - phantomjs

We are using PhantomJs 2.1.1 on Unix server to convert HTML pages to PDF files. The font we want to use is a proprietary font, hence for UI we are sending the font file along with html content. However, due to some known issues (Issue1, Issue2) PhatomJs does not work properly if the font is not being fetched locally.
By default Unix font are stored at usr/share/fonts/. However, we do not have access to this location, can I provide custom font file location directly to PhantomJs?

Related

Nuxt: displaying an image from contents directory

I have a use-case wherein the contents directory besides the markdown and yaml files I have images too. Reason being it is convenient to have a set of related files in a subdirectory. I am aware of displaying images using the assets and static directories.
The Content directory is as shown:
content
- topics
- topic-a
content.yaml
cover.png
- topic-b
content.yaml
cover.png
Is there a way to access the png and display it? Thanks.

Grails save pdf of rendered page

Is it possible to render view with all css, js... and
then save all generated html page in pdf?
I've tried solution with python libs:
grails run-app localhost:3030
dfkit/weasyprint visit page localhost:3030
pdfkit/weasyprint save html as pdf
But weasyprint have problems with my local css and pdfkit fails too.
So I'd like to know wheter it is possible to render pdf for generated html from grails and what libs should I use?

BIRT report PDF font

I am trying to embed a font in my BIRT pdf export. I am running the report from my webserver in the Tomcat/webapps/birt dir.
I checked the Fontsconfig.xml which points to the dir path
<path="/usr/share/fonts/default/TrueType" />
I have created the dir on my server as usr/share/fonts/default/TrueType and placed the (.ttf) font that I use in the report. I have updated my fonts cache via sudo fc-cache -fv, and I have restarted Tomcat. However, when I export my report to PDF form, the font does not get not used in the pdf.
Am I missing something?

Load PDF in Vaadin from Resource

I designed a Document Viewer in Vaadin that displays PDF files to the user. I successfully added the PDF to the viewer by specifying the system path. The problem is when I run the Viewer in a remote system, the PDF isn't displayed. So is there any way to load the PDF using the resource like we load the images.
Here is my code:
File pdfFile = new java.io.File ("D:/WorkFiles/PDF Books/newsletter.pdf");
The pdf is loading only from the local system. I have tried adding the pdf in the themes folder, but it doesn't work.
Thanks in advance.
What about the https://vaadin.com/api/com/vaadin/server/StreamResource.html. You can use this for on demand generated PDF files.

Worklight: Windows 8 store certification issues for UTF-8 file encoding

We have developed a hybrid app using worklight 6.1. We have set up our environment in eclipse juno.
While verifying the app using windows app cert kit, we are getting following error -
The UTF-8 file encoding test detected the following errors:
...\www\default\worklight\worklight.css is not properly UTF-8 encoded. Re-save the file as UTF-8 (including Byte Order Mark).
and many more such errors for dojo files as well.
Is there any settings, that we can do in eclipse, that will make all the files in app to use UTF-8 encoding.
I tried Window -> Preferences -> General -> Workspace : Text file encoding and set it to use "UTF-8". But this didn't helped.
Update:
It appears that for a Windows 8 store application, HTML/CSS/JS files must be encoded in UTF-8 with BOM marker, however Worklight Studio does not generate these files with the BOM marker.
To have this fixed, you'll need to create a PMR so that the development team could investigate & provide a fix.
In the meanwhile you can follow Microsoft's suggestion:
Corrective Action
Open the affected file and select Save As from the
File menu in Visual Studio. Select the drop-down control next to the
Save button and select Save with Encoding. From the Advanced save
options dialog, choose the Unicode (UTF-8 with signature) option and
click OK.
Previously:
If you have already created your Worklight project and then changed the encoding to UTF-8, this will not help this pre-existing project.
Delete the native windows8\native folder and re-build the project in Eclipse. This will then re-generate the native folder with the mentioned CSS file, in UTF-8 encoding.
I've tested this, and the file was created as mentioned, encoded in UTF-8.