Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
6.74k stars 645 forks source link

Improve unicode support #1528

Open nicbou opened 10 months ago

nicbou commented 10 months ago

What were you trying to do?

I learned the hard way that PDF Lib can't write unicode characters to a PDF (by default). This issue made it to production because I took unicode support for granted. Removing the offending characters as in #548 is not an option because they are part of people's names.

This seems to be a common issue (#1152 and others).

How did you attempt to do it?

I used an existing PDF form, and followed the instructions on the examples page.

What actually happened?

A user reported that the form generation "didn't work", and after much investigation, I traced it to a unicode character in the word "Kadıköy".

What did you expect to happen?

Filling a form with Unicode value should work without additional effort, as it does in PDF software like Firefox's

How can we reproduce the issue?

It would be helpful to:

Thank you for maintaining this library. It still works like black magic to me and I'm truly amazed that it even exists.

Version

1.17.1

What environment are you running pdf-lib in?

Browser

Checklist

Additional Notes

No response

nicbou commented 10 months ago

Concretely, I would recommand adding it to the "limitations" section, and moving that section further up the README.md.

I got everything up and running by following the instructions in the README and the ticket above. It's a bigger bundle size of course, but it seems to work flawlessly.

Dude29 commented 10 months ago

I am facing the same issue and it would be amazing to get default fonts that support unicode characters out of the box