DocImageProc

package
v0.7.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func Exists

func Exists(name string) bool

Exists returns true if the file or directory exists in the file system.

func GetFilenames

func GetFilenames(dir string) (filenames, dirs []string)

GetFilenames returns a slize of files and directories for the specified path.

func HashFile

func HashFile(fn string) []byte

func HashImages

func HashImages(imageList []imageTypeList) []byte

func HashStrngOf

func HashStrngOf(data string) (h []byte)

HashStringOf calcualtes the hash of the 'data' and returns it.

func HashStrngOfReturnHex

func HashStrngOfReturnHex(data string) (s string)

HashStringOfReturnHex calcualtes the hash of the 'data' and returns it.

func InsertImage

func InsertImage(pdf *gofpdf.Fpdf, fn string, pos int) *gofpdf.Fpdf

InsertImage adds an image to the document on the current page. The image will be sized to fit in the page.

func Keccak256

func Keccak256(data ...[]byte) []byte

Keccak256 use the Ethereum Keccak hasing fucntions to return a hash from a list of values.

func MatchFn

func MatchFn(need imageTypeList, fns []string) bool

MatchFn returns true if the 'need' file is in the list of avaiable files.

func MerkleHash

func MerkleHash(data [][]byte) []byte

MerkleHash calcualtes a Merkle tree hash for the [][]byte input.

func MerkleLeaves

func MerkleLeaves(hLeaf [][]byte) []byte

MerkleLeaves calculates the hash of the passed leaf hashes.

func MoveFile

func MoveFile(from, to string) (err error)

MoveFile will move a file from one path to a new path - this is a rename.

func NewReport

func NewReport() *gofpdf.Fpdf

NewReport retunes an initialized pdf document with a title of 'Document'.

func SavePDF

func SavePDF(pdf *gofpdf.Fpdf, fn string) error

SavePDF writes the pdf to the specified file name.

func SearializeDocumentType

func SearializeDocumentType(dt documentType) []byte

SearializeDocumentType searalizes a documentType for hashing.

func SearializeMetaDocument

func SearializeMetaDocument(doc metaDocumentType) []byte

SearializeMetaDocumentType searalizes a metaDocumentType for hashing.

func SizeOfImg

func SizeOfImg(fn string) (h, w float64)

SizeOfImage returns the height and width of the image in pixels.

func Table

func Table(pdf *gofpdf.Fpdf, tbl [][]string) *gofpdf.Fpdf

Types

type DocImageProcType

type DocImageProcType struct {
	Next           http.Handler //
	Paths          []string     //
	RedisPrefix    string       //
	InputPath      string       //
	OutputPath     string       //
	OutputURL      string       //
	ArchivePath    string       //
	IsProd         string       //
	RedisQ         string       // Q that push to Geth is put on.
	RedisGetQ      string       // Signal to outside world that data is ready. ((incomplete))
	GetEventURL    string       // URL to do GET on to signal that data is ready. ((incomplete))
	RedisID        string       // ID to increment for temp file names
	SingedOnceAddr string       // Address of loaded proxy contract
	AppID          string       // ID of this app
	LineNo         int          //
	// contains filtered or unexported fields
}

func NewDocImageProcTypeServer

func NewDocImageProcTypeServer(n http.Handler, p []string, redisPrefix, realm string) *DocImageProcType

NewDocImageProcTypeServer will create a copy of the server for testing.

func (*DocImageProcType) GeneratePDF

func (hdlr *DocImageProcType) GeneratePDF(
	TheDoc documentType,
	DocHash []byte,
	documentID, categoryID string,
	imageList []imageTypeList,
	InputPath, OutputPath string,
) (pdfFn string, err error)

func (*DocImageProcType) InitializeWithConfigData

func (hdlr *DocImageProcType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*DocImageProcType) PreValidate

func (hdlr *DocImageProcType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*DocImageProcType) RedisPushQ

func (hdlr *DocImageProcType) RedisPushQ(key, someData string)

func (*DocImageProcType) ServeHTTP

func (hdlr *DocImageProcType) ServeHTTP(www http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL