galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Encoding bug in the filling-form-example #197

Open cjnqt opened 6 years ago

cjnqt commented 6 years ago

(Moving this from here since it should be a bug with HummusJS not the example files...).

I think there is a text encoding bug in the filling-form-example, at least on OS X & Ubuntu.

If you run the provided example and fill the form with any non-english characters (for example å ö ä), the output is garbled.

Steps to reproduce Run the example with var data = { "Given Name Text Box": "åäö" }

cjnqt commented 6 years ago

would be interesting to hear if someone else can reproduce/confirm this issue?

cjnqt commented 6 years ago

I'd like to have a go at patching this, but would be great if someone could confirm they see the same issue?

DamickDoni commented 6 years ago

Have the same issue: For "äüöâáà etc" the output is garbled

DamickDoni commented 6 years ago

I have fixed the scrambled "Output" with simple Use of fonts

cjnqt commented 6 years ago

@DamickDoni cool! can you show an example of what you did?

cjnqt commented 6 years ago

ping @DamickDoni did you see this?

DamickDoni commented 6 years ago

Hi, sry for my late response :-)

My fix is quite simple. Instead of using Tj I use writeText and added a font (I used Arial) into this.

.writeText(text,0,0,{size: 8,colorspace: 'rgb',color: 000000,font: font})

Don't forget to create a font!