Thanks to visit codestin.com
Credit goes to github.com

Skip to content

inkitio/gosdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

Get the package

go get github.com/inkitio/[email protected]

Import the Inkit Sdk into your project

import (
	"github.com/inkitio/gosdk/client"
	"github.com/inkitio/gosdk/render"
)

Initialize your Inkit client

If you don't have an Inkit account yet, click here to create an account and grab your Api key: https://app.inkit.com/

client := client.NewClient("your_api_key")

Create a render

Define your render using CreateRenderOptions

options := render.CreateRenderOptions{
			Html:   "<html>hello</html>",
			Width:  9,
			Height: 11,
			Unit:   "in",
}

// you can also convert a file from your local file system
options := render.CreateRenderOptions{
			FileName:   "test.html",
			Width:  9,
			Height: 11,
			Unit:   "in",
}

Submit your render to Inkit

render, err := client.Render.Create(&options)

Retrieve your render content

Retrieve data about the render (including status). Make sure your render status is Completed before retrieving file data from it. You will recieve a 404 if the render is still In Progress

render , err := client.Render.Get(render.Id)

Retrieve Pdf

pdfData, err := client.Render.GetPdf(render.id)
// or if you want to save it locally to a file
err := client.Render.GetPdfAndSaveToFile(render.id, "test.pdf")

Retrieve Html

htmlData, err := client.Render.GetHtml(render.id)
// or if you want to save it locally to a file
err := client.Render.GetHtmlAndSaveToFile(render.id, "test.html")

View a list of all renders in your organization

// You can provide pagination options if you want to overwrite the defaults
/*
options := render.RenderListOptions{
	Page:     1,
	PageSize: 1,
}
*/
renders, err := client.Render.List(nil)

if err != nil {
	fmt.Println(err)
	return
}

for _, x := range renders.Items {
	fmt.Println(x)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages