diff options
author | Kurt Jung <kurt.w.jung@gmail.com> | 2017-05-05 07:50:30 -0400 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@gmail.com> | 2017-05-05 07:50:30 -0400 |
commit | f8e67d0ae0aa1e948a76f2ed2ffd2446d26b78a1 (patch) | |
tree | 0e73f594abdfe1ceddbb8d22d39f20e849804726 | |
parent | b572f8a6f278a31b4ff7dd03c0bb348545022f51 (diff) |
Note lack of support for Chinese, Arabic and other multi-codepage fonts
-rw-r--r-- | README.md | 47 | ||||
-rw-r--r-- | doc.go | 13 | ||||
-rwxr-xr-x | mkdoc | 1 |
3 files changed, 42 insertions, 19 deletions
@@ -9,7 +9,7 @@ Package gofpdf implements a PDF document generator with high level support for text, drawing and images. -## Features +##Features * Choice of measurement unit, page format and margins * Page header and footer management @@ -29,11 +29,17 @@ text, drawing and images. * Barcodes gofpdf has no dependencies other than the Go standard library. All tests pass -on Linux, Mac and Windows platforms. Like FPDF version 1.7, from which gofpdf -is derived, this package does not yet support UTF-8 fonts. However, support is -provided to translate UTF-8 runes to code page encodings. +on Linux, Mac and Windows platforms. + +Like FPDF version 1.7, from which gofpdf is derived, this package does not yet +support UTF-8 fonts. In particular, languages that require more than one code +page such as Chinese, Japanese, and Arabic are not currently supported. This is +explained in [issue 109](https://github.com/jung-kurt/gofpdf/issues/109). However, support is provided to automatically translate +UTF-8 runes to code page encodings for languages that have fewer than 256 +glyphs. + +##Installation -## Installation To install the package on your system, run @@ -47,7 +53,8 @@ Later, to receive updates, run go get -u -v github.com/jung-kurt/gofpdf/... ``` -## Quick Start +##Quick Start + The following Go code generates a simple PDF file. @@ -62,7 +69,8 @@ err := pdf.OutputFileAndClose("hello.pdf") See the functions in the [fpdf_test.go](https://github.com/jung-kurt/gofpdf/blob/master/fpdf_test.go) file (shown as examples in this documentation) for more advanced PDF examples. -## Errors +##Errors + If an error occurs in an Fpdf method, an internal error field is set. After this occurs, Fpdf method calls typically return without performing any @@ -76,7 +84,8 @@ method. At any time during the life cycle of the Fpdf instance, the error state can be determined with a call to Ok() or Err(). The error itself can be retrieved with a call to Error(). -## Conversion Notes +##Conversion Notes + This package is a relatively straightforward translation from the original [FPDF](http://www.fpdf.org/) library written in PHP (despite the caveat in the introduction to [Effective Go](https://golang.org/doc/effective_go.html)). The API names have been retained even though the Go idiom would suggest @@ -93,7 +102,8 @@ that are passed to them; in these cases additional methods have been exported to provide similar functionality. Font definition files are produced in JSON rather than PHP. -## Example PDFs +##Example PDFs + A side effect of running "go test ./..." is the production of a number of example PDFs. These can be found in the gofpdf/pdf directory after the tests @@ -116,7 +126,8 @@ the internal creation timestamps must be the same. To do this, the methods SetCatalogSort() and SetCreationDate() need to be called for both files. This is done automatically for all examples. -## Nonstandard Fonts +##Nonstandard Fonts + Nothing special is required to use the standard PDF fonts (courier, helvetica, times, zapfdingbats) in your documents other than calling SetFont(). @@ -138,13 +149,15 @@ standard fonts, SetFont() to begin using it. Most examples, including the package example, demonstrate this method. Good sources of free, open-source fonts include [Google Fonts](http://www.google.com/fonts/) and [DejaVu Fonts](http://dejavu-fonts.org/). -## Related Packages +##Related Packages + The [draw2d](https://github.com/llgcode/draw2d) package is a two dimensional vector graphics library that can generate output in different forms. It uses gofpdf for its document production mode. -## Contributing Changes +##Contributing Changes + gofpdf is a global community effort and you are invited to make it even better. If you have implemented a new feature or corrected a problem, please consider @@ -166,12 +179,14 @@ Here are guidelines for making submissions. Your change should [Pull requests](https://help.github.com/articles/using-pull-requests/) work nicely as a means of contributing your changes. -## License +##License + gofpdf is released under the MIT License. It is copyrighted by Kurt Jung and the contributors acknowledged below. -## Acknowledgments +##Acknowledgments + This package's code and documentation are closely derived from the [FPDF](http://www.fpdf.org/) library created by Olivier Plathey, and a number of font and image resources are copied directly from it. Drawing support is adapted from @@ -202,8 +217,10 @@ for setting DPI manually and then having it properly taken into account when calculating image size. Paulo Coutinho provided support for static embedded fonts. Bruno Michel has provided valuable assistance with the code. -## Roadmap +##Roadmap * Handle UTF-8 source text natively. Until then, automatic translation of UTF-8 runes to code page bytes is provided. * Improve test coverage as reported by the coverage tool. + + @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014 Kurt Jung (Gmail: kurt.w.jung) + * Copyright (c) 2013-2017 Kurt Jung (Gmail: kurt.w.jung) * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -53,9 +53,14 @@ Features • Barcodes gofpdf has no dependencies other than the Go standard library. All tests pass -on Linux, Mac and Windows platforms. Like FPDF version 1.7, from which gofpdf -is derived, this package does not yet support UTF-8 fonts. However, support is -provided to translate UTF-8 runes to code page encodings. +on Linux, Mac and Windows platforms. + +Like FPDF version 1.7, from which gofpdf is derived, this package does not yet +support UTF-8 fonts. In particular, languages that require more than one code +page such as Chinese, Japanese, and Arabic are not currently supported. This is +explained in issue 109. However, support is provided to automatically translate +UTF-8 runes to code page encodings for languages that have fewer than 256 +glyphs. Installation @@ -18,5 +18,6 @@ cat README.md | tr '\n' '\v' | sed \ -e 's/test.coverage.(\(https:\/\/blog\.golang\.org\/cover\))/[test coverage](\1)/g' \ -e 's/Pull.requests.(\(https:\/\/help\.github\.com\/articles\/using\-pull\-requests\/\))/[Pull requests](\1)/g' \ -e 's/Your change should\v/Your change should\v\v/g' \ + -e 's/issue 109/[issue 109](https:\/\/github.com\/jung-kurt\/gofpdf\/issues\/109)/g' \ | tr '\v' '\n' > _0 mv _0 README.md |