jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.34k stars 787 forks source link

Is it possible to change cp1252 to utf-8? #190

Closed devEntrega closed 6 years ago

devEntrega commented 6 years ago

Hi, I'd like to know if is it possible to change cp1252 to utf-8 with pdf.UnicodeTranslatorFromDescriptor("utf-8"), when I type that it appears open utf-8.map: The system cannot find the file specified.

The problem is I want to write those unicodes ☑ ☐ inside string and generate pdf then I doesn't show.

Thanks for your time.

jung-kurt commented 6 years ago

The problem you'll face is that gofpdf works only with code pages, that is, fixed size tables that contain at most 256 glyphs. You can manually create your own code page with the glyphs you select from the full unicode pool; see the documentation for UnicodeTranslator and the makefont utility (in subdirectory makefont) for more details. Even then, with some of these new utf-8 glyphs you'll be in uncharted territory.

For checkboxes and common symbols, you may also want to check out Zapf Dingbats. These are included without any special preparation.