summaryrefslogtreecommitdiff
path: root/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'doc.go')
-rw-r--r--doc.go144
1 files changed, 65 insertions, 79 deletions
diff --git a/doc.go b/doc.go
index 6492f7e..78afc23 100644
--- a/doc.go
+++ b/doc.go
@@ -1,20 +1,4 @@
/*
- * 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
Package gofpdf implements a PDF document generator with high level support for
text, drawing and images.
@@ -60,9 +44,9 @@ 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.
+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
@@ -84,8 +68,9 @@ The following Go code generates a simple PDF file.
pdf.Cell(40, 10, "Hello, world")
err := pdf.OutputFileAndClose("hello.pdf")
-See the functions in the fpdf_test.go file (shown as examples in this
-documentation) for more advanced PDF examples.
+See the functions in the
+fpdf_test.go
+file (shown as examples in this documentation) for more advanced PDF examples.
Errors
@@ -96,17 +81,18 @@ facilitates PDF generation since individual method calls do not need to be
examined for failure; it is generally sufficient to wait until after Output()
is called. For the same reason, if an error occurs in the calling application
during PDF generation, it may be desirable for the application to transfer the
-error to the Fpdf instance by calling the SetError() method or the SetErrorf()
-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().
+error to the Fpdf instance by calling the SetError() method or the
+SetErrorf() 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
-This package is a relatively straightforward translation from the original FPDF
-library written in PHP (despite the caveat in the introduction to Effective
-Go). The API names have been retained even though the Go idiom would suggest
-otherwise (for example, pdf.GetX() is used rather than simply pdf.X()). The
+This package is a relatively straightforward translation from the original
+FPDF library written in PHP (despite the caveat in the
+introduction to Effective Go). The
+API names have been retained even though the Go idiom would suggest otherwise
+(for example, pdf.GetX() is used rather than simply pdf.X()). The
similarity of the two libraries makes the original FPDF website a good source
of information. It includes a forum and FAQ.
@@ -121,13 +107,14 @@ rather than PHP.
Example PDFs
-A side effect of running "go test ./..." is the production of a number of
+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
complete.
Please note that these examples run in the context of a test. In order run an
-example as a standalone application, you'll need to examine fpdf_test.go for
-some helper routines, for example exampleFilename() and summary().
+example as a standalone application, you'll need to examine
+fpdf_test.go for some helper routines, for example
+exampleFilename() and summary().
Example PDFs can be compared with reference copies in order to verify that they
have been generated as expected. This comparison will be performed if a PDF
@@ -151,9 +138,9 @@ times, zapfdingbats) in your documents other than calling SetFont().
In order to use a different TrueType or Type1 font, you will need to generate a
font definition file and, if the font will be embedded into PDFs, a compressed
-version of the font file. This is done by calling the MakeFont function or
+version of the font file. This is done by calling the MakeFont() function or
using the included makefont command line utility. To create the utility, cd
-into the makefont subdirectory and run "go build". This will produce a
+into the makefont subdirectory and run go build. This will produce a
standalone executable named makefont. Select the appropriate encoding file from
the font subdirectory and run the command as in the following example.
@@ -162,13 +149,13 @@ the font subdirectory and run the command as in the following example.
In your PDF generation code, call AddFont() to load the font and, as with the
standard fonts, SetFont() to begin using it. Most examples, including the
package example, demonstrate this method. Good sources of free, open-source
-fonts include http://www.google.com/fonts/ and http://dejavu-fonts.org/.
+fonts include Google Fonts and DejaVu Fonts.
Related Packages
-The draw2d package (https://github.com/llgcode/draw2d) is a two dimensional
-vector graphics library that can generate output in different forms. It uses
-gofpdf for its document production mode.
+The 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
@@ -176,7 +163,7 @@ 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
contributing your change to the project. A contribution that does not directly
pertain to the core functionality of gofpdf should be placed in its own
-directory directly beneath the `contrib` directory.
+directory directly beneath the contrib directory.
Here are guidelines for making submissions. Your change should
@@ -184,18 +171,17 @@ Here are guidelines for making submissions. Your change should
• be properly documented
-• be formatted with `go fmt`
+• be formatted with go fmt
• include an example in fpdf_test.go if appropriate
-• conform to the standards of golint (https://github.com/golang/lint) and
-go vet (https://godoc.org/golang.org/x/tools/cmd/vet), that is, `golint .` and
-`go vet .` should not generate any warnings
+• conform to the standards of golint and
+go vet, that is, golint . and
+go vet . should not generate any warnings
-• not diminish test coverage (https://blog.golang.org/cover)
+• not diminish test coverage
-Pull requests (https://help.github.com/articles/using-pull-requests/) work
-nicely as a means of contributing your changes.
+Pull requests are the preferred means of accepting your changes.
License
@@ -204,39 +190,39 @@ the contributors acknowledged below.
Acknowledgments
-This package's code and documentation are closely derived from the FPDF library
-(http://www.fpdf.org/) created by Olivier Plathey, and a number of font and
-image resources are copied directly from it. Bruno Michel has provided valuable
-assistance with the code. Drawing support is adapted from the FPDF geometric
-figures script by David Hernández Sanz. Transparency support is adapted from
-the FPDF transparency script by Martin Hall-May. Support for gradients and
-clipping is adapted from FPDF scripts by Andreas Würmser. Support for outline
-bookmarks is adapted from Olivier Plathey by Manuel Cornes. Layer support is
-adapted from Olivier Plathey. Support for transformations is adapted from the
-FPDF transformation script by Moritz Wagner and Andreas Würmser. PDF
-protection is adapted from the work of Klemen Vodopivec for the FPDF product.
-Lawrence Kesteloot provided code to allow an image's extent to be determined
-prior to placement. Support for vertical alignment within a cell was provided
-by Stefan Schroeder. Ivan Daniluk generalized the font and image loading code
-to use the Reader interface while maintaining backward compatibility. Anthony
-Starks provided code for the Polygon function. Robert Lillack provided the
-Beziergon function and corrected some naming issues with the internal curve
-function. Claudio Felber provided implementations for dashed line drawing and
-generalized font loading. Stani Michiels provided support for multi-segment
-path drawing with smooth line joins, line join styles, enhanced fill modes, and
-has helped greatly with package presentation and tests. Templating is adapted
-by Marcus Downing from the FPDF_Tpl library created by Jan Slabon and Setasign.
-Jelmer Snoeck contributed packages that generate a variety of barcodes and help
-with registering images on the web. Jelmer Snoek and Guillermo Pascual
-augmented the basic HTML functionality with aligned text. Kent Quirk
-implemented backwards-compatible support for reading DPI from images that
-support it, and for setting DPI manually and then having it properly taken into
-account when calculating image size. Paulo Coutinho provided support for static
-embedded fonts. Dan Meyers added support for embedded JavaScript. David Fish
-added a generic alias-replacement function to enable, among other things, table
-of contents functionality. Andy Bakun identified and corrected a problem in
-which the internal catalogs were not sorted stably. Paul Montag added encoding
-and decoding functionality for templates, including images that are embedded in
+This package's code and documentation are closely derived from the FPDF
+library created by Olivier Plathey, and a number of font and image resources
+are copied directly from it. Bruno Michel has provided valuable assistance with
+the code. Drawing support is adapted from the FPDF geometric figures script by
+David Hernández Sanz. Transparency support is adapted from the FPDF
+transparency script by Martin Hall-May. Support for gradients and clipping is
+adapted from FPDF scripts by Andreas Würmser. Support for outline bookmarks is
+adapted from Olivier Plathey by Manuel Cornes. Layer support is adapted from
+Olivier Plathey. Support for transformations is adapted from the FPDF
+transformation script by Moritz Wagner and Andreas Würmser. PDF protection is
+adapted from the work of Klemen Vodopivec for the FPDF product. Lawrence
+Kesteloot provided code to allow an image's extent to be determined prior to
+placement. Support for vertical alignment within a cell was provided by Stefan
+Schroeder. Ivan Daniluk generalized the font and image loading code to use the
+Reader interface while maintaining backward compatibility. Anthony Starks
+provided code for the Polygon function. Robert Lillack provided the Beziergon
+function and corrected some naming issues with the internal curve function.
+Claudio Felber provided implementations for dashed line drawing and generalized
+font loading. Stani Michiels provided support for multi-segment path drawing
+with smooth line joins, line join styles, enhanced fill modes, and has helped
+greatly with package presentation and tests. Templating is adapted by Marcus
+Downing from the FPDF_Tpl library created by Jan Slabon and Setasign. Jelmer
+Snoeck contributed packages that generate a variety of barcodes and help with
+registering images on the web. Jelmer Snoek and Guillermo Pascual augmented the
+basic HTML functionality with aligned text. Kent Quirk implemented
+backwards-compatible support for reading DPI from images that support it, and
+for setting DPI manually and then having it properly taken into account when
+calculating image size. Paulo Coutinho provided support for static embedded
+fonts. Dan Meyers added support for embedded JavaScript. David Fish added a
+generic alias-replacement function to enable, among other things, table of
+contents functionality. Andy Bakun identified and corrected a problem in which
+the internal catalogs were not sorted stably. Paul Montag added encoding and
+decoding functionality for templates, including images that are embedded in
templates; this allows templates to be stored independently of gofpdf. Paul
also added support for page boxes used in printing PDF documents. Wojciech
Matusiak added supported for word spacing.