node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

letter spacing issue

Open webdeveloper0429 opened this issue 5 years ago • 11 comments

after generate pdf, letter spacing is incorrect.

http://prntscr.com/llofjg

webdeveloper0429 avatar Nov 22 '18 16:11 webdeveloper0429

Absolutely. Same problem. Just using Arial Font. The bug appears to be independent of the css.

Xtrazyx avatar Nov 23 '18 18:11 Xtrazyx

I also run into the same issue, using Arial, on Windows 10.

html-pdf : 2.2.0 phantomjs-prebuilt : 2.1.16

BenjaminDish avatar Dec 11 '18 15:12 BenjaminDish

Noticing horrible spacing issues with "T" and "C" T has negative kerning it seems as it is right up to the letter that comes after it, and C has too much, it seems there is almost a space worth between it and the next letter.

hanchan07 avatar Jan 15 '19 18:01 hanchan07

I'm facing a similar issue, where the pdf gets generated absolutely fine on local machine but has weird spacing issues on ubuntu server. Any updates yet?

mayurvir avatar Feb 04 '19 09:02 mayurvir

OMG! I am facing the SAME issue. My ubuntu server is having these weird spacings with different letter combinations, but MY machine (macOS High Sierra) is working just fine with no spacing issues. I noticed that this started to happen when I switched to font Avenir.

Switching the Font helped. I am using this font: font-family: 'Sackers Gothic Std';

Not at pretty.

vplugues avatar Feb 06 '19 16:02 vplugues

I am having the same issue. My observations

  1. Works fine on macOS(local machine) with both default and custom fonts
  2. Works fine on Amazon AWS Lambda with default fonts
  3. DOES NOT Work on Amazon AWS Lambda with custom fonts

I am using https://fonts.google.com/specimen/Source+Sans+Pro?selection.family=Open+Sans font and the output spacing is not correct. See the below text

Screen Shot 2019-03-18 at 6 26 20 PM

Please let me know if any solution for this

anuj-cfra avatar Mar 18 '19 09:03 anuj-cfra

Hi @anuj-cfra , am also facing same issue . did you fount any solution for this font spacing error .

maheshatvirtusa avatar Oct 14 '19 08:10 maheshatvirtusa

Have you tried just changing the font?

vplugues avatar Oct 14 '19 14:10 vplugues

fonts.txt Mentioned all changes what i did to workout the custom fonts in lambda without any letter spacing issue . its working 100%

maheshatvirtusa avatar Oct 14 '19 15:10 maheshatvirtusa

I did what it says in that .txt but didn't work. I have to mention that my app in production is in EB, not in Lambda. Even so, I did this:

  1. downloaded a .woff font file in a folder

image

  1. In styles.js, I'm bringing the files so the generated HTML receive the corresponding style
export default styles => {
  const extraStyles = styles ? styles.map(s => files[s]).join('') : ''

  return `<style>
  @font-face {
    src: url(/fonts/NunitoSans-Regular.woff) format('woff');
    font-family: 'Nunito Sans', sans-serif;
  }
  @font-face {
    src: url(/fonts/NunitoSans-Black.woff) format('woff');
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 900;
  }
  body {
    color: #00171f;
    font-family: 'Nunito Sans', sans-serif;
  }
[...]
  1. Deploy into EB

The generated PDF still has letter separation issues.

diegoolavarria avatar Jan 06 '20 19:01 diegoolavarria

Anyone find a solution for this issue?

GuilhermeHausz avatar Aug 30 '21 18:08 GuilhermeHausz