fileio

package
v0.0.0-...-3c7c33e Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHTMLtoPDF

func ConvertHTMLtoPDF(htmlFilePath string, pdfFilePath string, pageSize string) error

ConvertHTMLtoPDF converts the supplied HTML file to a PDF file

func CopyAllAssetsToTempDir

func CopyAllAssetsToTempDir(tempDir string, template string) error

CopyAllAssetsToTempDir stages HTML, CSS, and images to the temp directory for templating

func DecodeRequestBody

func DecodeRequestBody(rbody io.ReadCloser) (map[string]interface{}, error)

DecodeRequestBody takes the http.Request body and decodes it to a map

func GenerateHTMLFromData

func GenerateHTMLFromData(data interface{}, tempDir string, templateName string, htmlPath string) error

GenerateHTMLFromData takes a map of data and performs the HTML templating

func GetPdfBytes

func GetPdfBytes(pdfPath string) ([]byte, error)

GetPdfBytes returns a []byte of the requested file to return in the http.ResponseWriter

func GetTempDirAndPaths

func GetTempDirAndPaths(filename string) (string, string, string, error)

GetTempDirAndPaths creates a temp directory and HTML and PDF filepaths in that order: TempDir, HTMLPath, PDFPath

func OptimizePDF

func OptimizePDF(pdfPath string, metadata interface{}) (string, error)

OptimizePDF optimizes the PDF, reusing images, and reducing the overall size and applies metadata & bookmarks

Types

This section is empty.

Jump to

Keyboard shortcuts

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