{"id":13393823,"url":"https://github.com/jung-kurt/gofpdf","last_synced_at":"2025-10-05T17:31:39.871Z","repository":{"id":28634487,"uuid":"32153390","full_name":"jung-kurt/gofpdf","owner":"jung-kurt","description":"A PDF document generator with high level support for text, drawing and images","archived":true,"fork":false,"pushed_at":"2021-11-13T13:53:41.000Z","size":6122,"stargazers_count":4411,"open_issues_count":56,"forks_count":809,"subscribers_count":106,"default_branch":"master","last_synced_at":"2025-08-21T13:39:23.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://godoc.org/github.com/jung-kurt/gofpdf","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jung-kurt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-13T11:57:30.000Z","updated_at":"2025-08-19T17:25:36.000Z","dependencies_parsed_at":"2022-08-03T05:30:30.834Z","dependency_job_id":null,"html_url":"https://github.com/jung-kurt/gofpdf","commit_stats":null,"previous_names":[],"tags_count":88,"template":false,"template_full_name":null,"purl":"pkg:github/jung-kurt/gofpdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jung-kurt%2Fgofpdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jung-kurt%2Fgofpdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jung-kurt%2Fgofpdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jung-kurt%2Fgofpdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jung-kurt","download_url":"https://codeload.github.com/jung-kurt/gofpdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jung-kurt%2Fgofpdf/sbom","scorecard":{"id":542658,"data":{"date":"2025-08-11","repo":{"name":"github.com/jung-kurt/gofpdf","commit":"0c885ad361937863b15ef25241fb7f5a5e282c3c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 6/24 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-1572 / GHSA-qgc7-mgm3-q253","Warn: Project is vulnerable to: GO-2023-1990 / GHSA-j3p8-6mrq-6g7h","Warn: Project is vulnerable to: GO-2023-1989 / GHSA-x92r-3vfx-4cv3","Warn: Project is vulnerable to: GO-2024-2937 / GHSA-9phm-fm57-rhg8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T08:37:28.204Z","repository_id":28634487,"created_at":"2025-08-20T08:37:28.204Z","updated_at":"2025-08-20T08:37:28.204Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278487194,"owners_count":25995127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:01:00.819Z","updated_at":"2025-10-05T17:31:39.360Z","avatar_url":"https://github.com/jung-kurt.png","language":"Go","funding_links":[],"categories":["Misc","Template Engines","Go","GO","others","Programming Languages","\u003cspan id=\"模板引擎-template-engines\"\u003e模板引擎 Template Engines\u003c/span\u003e","模板引擎","模板引擎`模版渲染和模版生成处理库`","Relational Databases"],"sub_categories":["Advanced Console UIs","HTTP Clients","Go","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","交流","查询语"],"readme":"# GoFPDF document generator\n\n[![No Maintenance\nIntended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n[![MIT\nlicensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/jung-kurt/gofpdf/master/LICENSE)\n[![GoDoc](https://img.shields.io/badge/godoc-GoFPDF-blue.svg)](https://pkg.go.dev/github.com/jung-kurt/gofpdf)\n\n![](https://raw.githubusercontent.com/jung-kurt/gofpdf/master/image/logo_gofpdf.jpg)\n\nPackage gofpdf implements a PDF document generator with high level\nsupport for text, drawing and images.\n\n## Features\n\n  - UTF-8 support\n  - Choice of measurement unit, page format and margins\n  - Page header and footer management\n  - Automatic page breaks, line breaks, and text justification\n  - Inclusion of JPEG, PNG, GIF, TIFF and basic path-only SVG images\n  - Colors, gradients and alpha channel transparency\n  - Outline bookmarks\n  - Internal and external links\n  - TrueType, Type1 and encoding support\n  - Page compression\n  - Lines, Bézier curves, arcs, and ellipses\n  - Rotation, scaling, skewing, translation, and mirroring\n  - Clipping\n  - Document protection\n  - Layers\n  - Templates\n  - Barcodes\n  - Charting facility\n  - Import PDFs as templates\n\ngofpdf has no dependencies other than the Go standard library. All tests\npass on Linux, Mac and Windows platforms.\n\ngofpdf supports UTF-8 TrueType fonts and “right-to-left” languages. Note\nthat Chinese, Japanese, and Korean characters may not be included in\nmany general purpose fonts. For these languages, a specialized font (for\nexample,\n[NotoSansSC](https://github.com/jsntn/webfonts/blob/master/NotoSansSC-Regular.ttf)\nfor simplified Chinese) can be used.\n\nAlso, support is provided to automatically translate UTF-8 runes to code\npage encodings for languages that have fewer than 256 glyphs.\n\n## We Are Closed\n\nThis repository will not be maintained, at least for some unknown\nduration. But it is hoped that gofpdf has a bright future in the open\nsource world. Due to Go’s promise of compatibility, gofpdf should\ncontinue to function without modification for a longer time than would\nbe the case with many other languages.\n\nForks should be based on the [last viable\ncommit](https://github.com/jung-kurt/gofpdf/commit/603f56990463f011cb1dbb64ef7f872c1adc009a).\nTools such as\n[active-forks](https://techgaun.github.io/active-forks/index.html#jung-kurt/gofpdf)\ncan be used to select a fork that looks promising for your needs. If a\nparticular fork looks like it has taken the lead in attracting\nfollowers, this README will be updated to point people in that\ndirection.\n\nThe efforts of all contributors to this project have been deeply\nappreciated. Best wishes to all of you.\n\n## Installation\n\nTo install the package on your system, run\n\n``` shell\ngo get github.com/jung-kurt/gofpdf\n```\n\nLater, to receive updates, run\n\n``` shell\ngo get -u -v github.com/jung-kurt/gofpdf/...\n```\n\n## Quick Start\n\nThe following Go code generates a simple PDF file.\n\n``` go\npdf := gofpdf.New(\"P\", \"mm\", \"A4\", \"\")\npdf.AddPage()\npdf.SetFont(\"Arial\", \"B\", 16)\npdf.Cell(40, 10, \"Hello, world\")\nerr := pdf.OutputFileAndClose(\"hello.pdf\")\n```\n\nSee the functions in the\n[fpdf\\_test.go](https://github.com/jung-kurt/gofpdf/blob/master/fpdf_test.go)\nfile (shown as examples in this documentation) for more advanced PDF\nexamples.\n\n## Errors\n\nIf an error occurs in an Fpdf method, an internal error field is set.\nAfter this occurs, Fpdf method calls typically return without performing\nany operations and the error state is retained. This error management\nscheme facilitates PDF generation since individual method calls do not\nneed to be examined for failure; it is generally sufficient to wait\nuntil after `Output()` is called. For the same reason, if an error\noccurs in the calling application during PDF generation, it may be\ndesirable for the application to transfer the error to the Fpdf instance\nby calling the `SetError()` method or the `SetErrorf()` method. At any\ntime during the life cycle of the Fpdf instance, the error state can be\ndetermined with a call to `Ok()` or `Err()`. The error itself can be\nretrieved with a call to `Error()`.\n\n## Conversion Notes\n\nThis package is a relatively straightforward translation from the\noriginal [FPDF](http://www.fpdf.org/) library written in PHP (despite\nthe caveat in the introduction to [Effective\nGo](https://golang.org/doc/effective_go.html)). The API names have been\nretained even though the Go idiom would suggest otherwise (for example,\n`pdf.GetX()` is used rather than simply `pdf.X()`). The similarity of\nthe two libraries makes the original FPDF website a good source of\ninformation. It includes a forum and FAQ.\n\nHowever, some internal changes have been made. Page content is built up\nusing buffers (of type bytes.Buffer) rather than repeated string\nconcatenation. Errors are handled as explained above rather than\npanicking. Output is generated through an interface of type io.Writer or\nio.WriteCloser. A number of the original PHP methods behave differently\nbased on the type of the arguments that are passed to them; in these\ncases additional methods have been exported to provide similar\nfunctionality. Font definition files are produced in JSON rather than\nPHP.\n\n## Example PDFs\n\nA side effect of running `go test ./...` is the production of a number\nof example PDFs. These can be found in the gofpdf/pdf directory after\nthe tests complete.\n\nPlease note that these examples run in the context of a test. In order\nrun an example as a standalone application, you’ll need to examine\n[fpdf\\_test.go](https://github.com/jung-kurt/gofpdf/blob/master/fpdf_test.go)\nfor some helper routines, for example `exampleFilename()` and\n`summary()`.\n\nExample PDFs can be compared with reference copies in order to verify\nthat they have been generated as expected. This comparison will be\nperformed if a PDF with the same name as the example PDF is placed in\nthe gofpdf/pdf/reference directory and if the third argument to\n`ComparePDFFiles()` in internal/example/example.go is true. (By default\nit is false.) The routine that summarizes an example will look for this\nfile and, if found, will call `ComparePDFFiles()` to check the example\nPDF for equality with its reference PDF. If differences exist between\nthe two files they will be printed to standard output and the test will\nfail. If the reference file is missing, the comparison is considered to\nsucceed. In order to successfully compare two PDFs, the placement of\ninternal resources must be consistent and the internal creation\ntimestamps must be the same. To do this, the methods `SetCatalogSort()`\nand `SetCreationDate()` need to be called for both files. This is done\nautomatically for all examples.\n\n## Nonstandard Fonts\n\nNothing special is required to use the standard PDF fonts (courier,\nhelvetica, times, zapfdingbats) in your documents other than calling\n`SetFont()`.\n\nYou should use `AddUTF8Font()` or `AddUTF8FontFromBytes()` to add a\nTrueType UTF-8 encoded font. Use `RTL()` and `LTR()` methods switch\nbetween “right-to-left” and “left-to-right” mode.\n\nIn order to use a different non-UTF-8 TrueType or Type1 font, you will\nneed to generate a font definition file and, if the font will be\nembedded into PDFs, a compressed version of the font file. This is done\nby calling the MakeFont function or using the included makefont command\nline utility. To create the utility, cd into the makefont subdirectory\nand run “go build”. This will produce a standalone executable named\nmakefont. Select the appropriate encoding file from the font\nsubdirectory and run the command as in the following example.\n\n``` shell\n./makefont --embed --enc=../font/cp1252.map --dst=../font ../font/calligra.ttf\n```\n\nIn your PDF generation code, call `AddFont()` to load the font and, as\nwith the standard fonts, SetFont() to begin using it. Most examples,\nincluding the package example, demonstrate this method. Good sources of\nfree, open-source fonts include [Google\nFonts](https://fonts.google.com/) and [DejaVu\nFonts](http://dejavu-fonts.org/).\n\n## Related Packages\n\nThe [draw2d](https://github.com/llgcode/draw2d) package is a two\ndimensional vector graphics library that can generate output in\ndifferent forms. It uses gofpdf for its document production mode.\n\n## Contributing Changes\n\ngofpdf is a global community effort and you are invited to make it even\nbetter. If you have implemented a new feature or corrected a problem,\nplease consider contributing your change to the project. A contribution\nthat does not directly pertain to the core functionality of gofpdf\nshould be placed in its own directory directly beneath the `contrib`\ndirectory.\n\nHere are guidelines for making submissions. Your change should\n\n  - be compatible with the MIT License\n  - be properly documented\n  - be formatted with `go fmt`\n  - include an example in\n    [fpdf\\_test.go](https://github.com/jung-kurt/gofpdf/blob/master/fpdf_test.go)\n    if appropriate\n  - conform to the standards of [golint](https://github.com/golang/lint)\n    and [go vet](https://golang.org/cmd/vet/), that is, `golint .` and\n    `go vet .` should not generate any warnings\n  - not diminish [test coverage](https://blog.golang.org/cover)\n\n[Pull requests](https://help.github.com/articles/using-pull-requests/)\nare the preferred means of accepting your changes.\n\n## License\n\ngofpdf is released under the MIT License. It is copyrighted by Kurt Jung\nand the contributors acknowledged below.\n\n## Acknowledgments\n\nThis package’s code and documentation are closely derived from the\n[FPDF](http://www.fpdf.org/) library created by Olivier Plathey, and a\nnumber of font and image resources are copied directly from it. Bruno\nMichel has provided valuable assistance with the code. Drawing support\nis adapted from the FPDF geometric figures script by David Hernández\nSanz. Transparency support is adapted from the FPDF transparency script\nby Martin Hall-May. Support for gradients and clipping is adapted from\nFPDF scripts by Andreas Würmser. Support for outline bookmarks is\nadapted from Olivier Plathey by Manuel Cornes. Layer support is adapted\nfrom Olivier Plathey. Support for transformations is adapted from the\nFPDF transformation script by Moritz Wagner and Andreas Würmser. PDF\nprotection is adapted from the work of Klemen Vodopivec for the FPDF\nproduct. Lawrence Kesteloot provided code to allow an image’s extent to\nbe determined prior to placement. Support for vertical alignment within\na cell was provided by Stefan Schroeder. Ivan Daniluk generalized the\nfont and image loading code to use the Reader interface while\nmaintaining backward compatibility. Anthony Starks provided code for the\nPolygon function. Robert Lillack provided the Beziergon function and\ncorrected some naming issues with the internal curve function. Claudio\nFelber provided implementations for dashed line drawing and generalized\nfont loading. Stani Michiels provided support for multi-segment path\ndrawing with smooth line joins, line join styles, enhanced fill modes,\nand has helped greatly with package presentation and tests. Templating\nis adapted by Marcus Downing from the FPDF\\_Tpl library created by Jan\nSlabon and Setasign. Jelmer Snoeck contributed packages that generate a\nvariety of barcodes and help with registering images on the web. Jelmer\nSnoek and Guillermo Pascual augmented the basic HTML functionality with\naligned text. Kent Quirk implemented backwards-compatible support for\nreading DPI from images that support it, and for setting DPI manually\nand then having it properly taken into account when calculating image\nsize. Paulo Coutinho provided support for static embedded fonts. Dan\nMeyers added support for embedded JavaScript. David Fish added a generic\nalias-replacement function to enable, among other things, table of\ncontents functionality. Andy Bakun identified and corrected a problem in\nwhich the internal catalogs were not sorted stably. Paul Montag added\nencoding and decoding functionality for templates, including images that\nare embedded in templates; this allows templates to be stored\nindependently of gofpdf. Paul also added support for page boxes used in\nprinting PDF documents. Wojciech Matusiak added supported for word\nspacing. Artem Korotkiy added support of UTF-8 fonts. Dave Barnes added\nsupport for imported objects and templates. Brigham Thompson added\nsupport for rounded rectangles. Joe Westcott added underline\nfunctionality and optimized image storage. Benoit KUGLER contributed\nsupport for rectangles with corners of unequal radius, modification\ntimes, and for file attachments and annotations.\n\n## Roadmap\n\n  - Remove all legacy code page font support; use UTF-8 exclusively\n  - Improve test coverage as reported by the coverage tool.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjung-kurt%2Fgofpdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjung-kurt%2Fgofpdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjung-kurt%2Fgofpdf/lists"}