[Html2PdfConverter] HtmlToPdfConverter setting font

[Html2PdfConverter] HtmlToPdfConverter setting font

Forge Component
Published on 23 Jun (4 weeks ago) by Guilherme Pereira
42 votes
Published on 23 Jun (4 weeks ago) by Guilherme Pereira
Is it possible to set the font for the downloaded PDF file?

I assume UTF-8 is supported. But it doesn't seem to be the default.

What about Shift-JIS?
Hi Mark,

The component is a wrapper to the library wkhtmltopdf so you may want to check on their site what is supported and how to set any special options.

In the options there's one that allow you to set the enconding so you may want to test that one.

 --encoding <encoding>           Set the default text encoding, for input
As for the fonts you should create your pages and use any font available (or import additional) because the component itself all it does is to render your page in HTML and export it to pdf.

Hope this helps

With the Execute Action, what is the systax for the expression used by OtherArgs?
I've tried "--encoding UTF-8", but the characters are unreadable.
And "encoding=UTF-8" corrupts the file.
Hi Mark,

The OtherArgs parameter passes anything as command line parameters and generically is --XXXXX YYYYY.

I recommend you to install wkhtmltopdf directly on your pc and test via command line until you nail it and then pass the same arguments when using the component.


Okay - I'll give that a try.


it's possible, but you have to include the fonts yourself.

on that note, italics/bold fonts are somewhat trickier.


I was able to install 
wkhtmltopdf locally and I was able the make a pdf of locally installed webpage using the option

wkhtmltopdf --encoding UTF-8 C:\path\to\index.html C:\path\to\file\location\myIndex.pdf

Just make sure <meta charset="UTF-8" /> is set in the header of index.html

But - still doesn't work in my application.

I'll keep trying and post here when I'm successful.

I'm passing the URL info to HtmlToPdfConverter like so

And pass the --encoding UTF-8 option like this

Hi Mark,

I suggest you try to render the same page you're on the server instead of a local copy because like that you'll try to replicate what happens in the server.

something like: wkhtmltopdf --encoding UTF-8 http://path_to_my_page C:\path\to\file\location\myIndex.pdf.

If you do it like this does it work?


Good morning,

I wasn't able to get see any of my pages on the OutSystems cloud. I suspect passwords are needed.

But I was able to make a good pdf file of my company's homepage. That website uses Shift_JIS encoding.

So, the problem is not with wkhtmltopdf; it's with my pages.

Outsystem automatically puts this header tag into all pages.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
So it's a puzzle.
And I'm about to be pulled off this project (such is the wizdom of project managers). So, we don't need to put any more effort into this.
Thank you very much for all your help.

Hi Mark,

You need to set your pages as anonymous in order for it to work. The request done by tge component is from a webkit headless browser and does not share the session with your own browser as such a new login would be necessary and as you don't have control over the execution for example to input a username and password in said execution you need to set tge page anonymous and use other kinds of protection (e.g a generated token on the url).

if you do return to the project feel free go reach out to us again and we'll do our best to assist you.



I have a similar problem which I my page contains chinese characters. When the page print to PDF, the chinese characters shows square shape. 

This is convert to PDF:

The font can be seen in the webpage: 

I tried to set "--encoding UTF-8" in OtherArgs also doesn't work.

Anyone successfully to encode chinese character in html2pdf?