Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/atkinsonbg/go-goji-templating-pdf-generation

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/atkinsonbg/go-goji-templating-pdf-generation

  • v0.0.0-20210123163442-3c7c33eb60fd
  • Source
  • Go
  • Socket score

Version published
Created
Source

ko-fi

Go Goji Templating/PDF Generation

This repo is used to experiment with Go's templating engine and use it to generate PDFs. One of the goals is to get a fully accessible PDF, in the least amount of time and memory/CPU footprint. The API uses HTML templates that are combined with data, then converted to PDFs and optimized.

The tools used are:

  • Goji: https://github.com/goji/goji - Goji was selected for its minimal footprint.
  • Go text/template package: https://golang.org/pkg/text/template/ - text/template was used over html/template since the final output is a PDF. text/template is faster than html/template. We are not concerned with generating "safe" HTML, since we do not serve this to a browser.
  • WKHTMLTOPDF: https://wkhtmltopdf.org/ - This is used to perform the HTML to PDF conversion.
  • Ghostscript: https://www.ghostscript.com/ - This is used to optimize and apply PDF metadata. It is also used to apply pdfmarks to support accessibility.

Accessibility

I tried hard to create a fully accessible PDF, however I'm sure there is a lot of work left to do here. The following online checkers were utilized during the development of this code:

Resources

The following blogs, Stack Overflow posts, etc were used to help solve a lot of problems.

License

The MIT License (MIT)

Copyright (c) 2021 Brandon Atkinson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FAQs

Package last updated on 23 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc