pendrafusion

package module
v0.0.0-...-e1ad4e2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MPL-2.0 Imports: 12 Imported by: 0

README

PenDraFusion

PenDraFusion is a Go HTML to PDF converter. It will work both as package for native code and as a Web Assembly library. It is a pre-alpha work in progress, please expect more to come soon.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGenerating error = errors.New("Error generating pdf data")
View Source
var FontFace map[string]string = map[string]string{
	"arial": "notoSans",
}
View Source
var FontSizes []float64 = []float64{
	0,
	6,
	9,
	12,
	16,
	20,
	26,
	32,
}

Arbitrary values, feel free to fix it to more realist values

View Source
var Handler map[atom.Atom]func(*Converter, Node)

Functions

func Apply_Class

func Apply_Class(cnv *Converter, sel Node)

func Convert

func Convert(stop chan struct{}) func(this js.Value, p []js.Value) interface{}

func Handler_A

func Handler_A(cnv *Converter, sel Node)

func Handler_Big

func Handler_Big(cnv *Converter, sel Node)

func Handler_Body

func Handler_Body(cnv *Converter, sel Node)

func Handler_Br

func Handler_Br(cnv *Converter, sel Node)

func Handler_Font

func Handler_Font(cnv *Converter, sel Node)

func Handler_Head

func Handler_Head(cnv *Converter, sel Node)

func Handler_P

func Handler_P(cnv *Converter, sel Node)

func Handler_SCRIPT

func Handler_SCRIPT(cnv *Converter, sel Node)

func Handler_Small

func Handler_Small(cnv *Converter, sel Node)

func Handler_Strike

func Handler_Strike(cnv *Converter, sel Node)

func Handler_Strong

func Handler_Strong(cnv *Converter, sel Node)

func Handler_Table

func Handler_Table(cnv *Converter, sel Node)

func Handler_Tr

func Handler_Tr(cnv *Converter, sel Node)

func SetTextDecoration

func SetTextDecoration(old string, new byte) string

Types

type Attribute

type Attribute interface {
	Key() string
	Val() string
}

type Box

type Box struct {
	X, Y, W, H, LH float64
}

type Buffer

type Buffer struct {
	Buffer *bytes.Buffer
}

func NewBuffer

func NewBuffer() *Buffer

func (Buffer) Bytes

func (b Buffer) Bytes() []byte

func (Buffer) Read

func (b Buffer) Read(p []byte) (n int, err error)

func (Buffer) Write

func (b Buffer) Write(p []byte) (n int, err error)

type BufferReader

type BufferReader interface {
	io.Reader
	Bytes() []byte
}

type Color

type Color struct {
	R, G, B int
}

type Converter

type Converter struct {
	Doc       Node
	Pdf       *gofpdf.Fpdf
	UseScript bool
	Format    []Format
}

func NewConverter

func NewConverter(n Node) *Converter

func (*Converter) AddText

func (cnv *Converter) AddText(txt string)

func (*Converter) Apply

func (cnv *Converter) Apply()

func (*Converter) Convert

func (cnv *Converter) Convert() (BufferReader, error)

func (*Converter) GetFontSize

func (cnv *Converter) GetFontSize(txt string) float64

func (*Converter) Rollback

func (cnv *Converter) Rollback()

type Format

type Format struct {
	Box            Box
	FontFace       string
	TextDecoration string
	FontSize       float64
	FontColor      Color
	TextAlign      string
	LinkStr        string
	LinkId         int
}

type GooseG

type GooseG struct {
	Init     goose.Alert
	Generate goose.Alert
}
var Goose GooseG

type Node

type Node interface {
	Attr(string) (string, bool)
	//   Attrs() []Attribute
	FirstChild() Node
	NextSibling() Node
	Type() html.NodeType
	Data() string
	DataAtom() atom.Atom
	Find(string) []Node
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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