Git Product home page Git Product logo

golang-html-to-pdf-converter's Introduction

Golang HTML to PDF Converter

License: MIT

For reading any document, one prefers PDF format over any other formats as it is considered as a standard format for any document in our day to day life. We often come across converting any form details or previews on the website in the form of HTML to PDF. For GoLang, understanding such usability, Developers at Mindinventory made an effort for making one HTML to PDF Converter which can be used for converting HTML content to PDF.

What it is?

It is a repository, integrating which one can offer HTML to PDF Conversion to their customers.

Prerequisite

Install wkhtmltopdf using below command

  • sudo apt install wkhtmltopdf - for Ubuntu
  • brew install Caskroom/cask/wkhtmltopdf - For Mac

Steps to Follow

  1. Create a sample HTML file inside of your project.

  2. Get go package using the below command for parsing the HTMl template.

    • go get github.com/SebastiaanKlippert/go-wkhtmltopdf
  3. Get another go package for converting this html parse data to pdf using the below command.

    • go get html/template
  4. Run below command

    • go run main.go

###The previous version of golang was deprecated and not supporting the converter library so dependencies are updated with the new updates.

#Steps by step:

  • Install golang (1.16)
  • Check go version (Make Sure it is latest = 1.16)
  • go mod vendor
  • go build

##To Run the project:

  • go run main.go

Update project dependencies

  • go get github.com/SebastiaanKlippert/go-wkhtmltopdf v1.6.1
  • go get html/template

After finish above steps, You can generate pdf file from html.

NOTES: The pdf will be generated in the storage directory. Don't forget to mention your html and pdf path details inside your code. If you want to generate pdf for static data then it is not mandatory to generate another html for clone data. Use that same sample html inside the code.

LICENSE!

Golang HTML to PDF Converter is MIT-licensed

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding our work.

golang-html-to-pdf-converter's People

Contributors

malvikiran avatar zubin7771 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.