Node-html-pdf: Text on pdf is unselectable after creating one from html

Created on 11 May 2018  路  5Comments  路  Source: marcbachmann/node-html-pdf

Is there a way to make text selectable? Can some option be passed?

Most helpful comment

Can confirm this issue is solved by installing fonts locally.

Follow this steps (after downloading custom fonts to server):
cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip (Unzip to googlefonts folder)
sudo chmod -R --reference=/usr/share/fonts/opentype /usr/share/fonts/googlefonts (can be truetype instead of opentype)

Register fonts with:
sudo fc-cache -fv

Check if installed:
fc-match OpenSans

Also it's important to check that html template you're using has the original font tag removed, otherwise it'll not use the local.

All 5 comments

@lukasamd Thanks for your reply. Yes I do use Custom fonts and Open Sans. But none of those are selectable. I'll try your approach if I need to develop my templates further.

@lukasamd I tried your approach but it is not working , Phantom not taking local font which I placed on
/usr/local/share/fonts/
and
/usr/share/fonts/

@tahv0 @lukasamd @abhinava3
I have the same issue, my custom google font is directly on the server and is generated well in the PDF but I cannot select the text from the generated PDF.
Do you have any workaround that issue ?
Thanks

Can confirm this issue is solved by installing fonts locally.

Follow this steps (after downloading custom fonts to server):
cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip (Unzip to googlefonts folder)
sudo chmod -R --reference=/usr/share/fonts/opentype /usr/share/fonts/googlefonts (can be truetype instead of opentype)

Register fonts with:
sudo fc-cache -fv

Check if installed:
fc-match OpenSans

Also it's important to check that html template you're using has the original font tag removed, otherwise it'll not use the local.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmoulliard picture cmoulliard  路  3Comments

anmolgoyal74 picture anmolgoyal74  路  4Comments

aminjoharinia picture aminjoharinia  路  4Comments

jimit-hothi picture jimit-hothi  路  4Comments

tsp1996 picture tsp1996  路  5Comments