pdf

package
v0.0.0-...-c5bcced Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

The pdf package enables creating and manipulating PDF documents.

var lib = require('pdf');
var pdf = lib("xxxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx");
var doc = new pdf({
	masterpassword: '123456',
	permissions: "noprint nohiresprint nocopy nomodify noaccessible noassemble",
});

doc.page(595, 842);

doc.pipe(context.res.body);

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(orb *orbit.Orbit) interface{}

Types

type Doc

type Doc struct {
	Graphics *Graphics
	// contains filtered or unexported fields
}

func NewDoc

func NewDoc(orb *orbit.Orbit, lib *Lib, opt optlist) *Doc

func (*Doc) Embed

func (this *Doc) Embed(call otto.FunctionCall) otto.Value

func (*Doc) Find

func (this *Doc) Find(callback otto.Value)

Find adds a callback function which is used to load fonts.

var lib = require('pdf')();
var doc = new lib();
doc.find(function(name) {
	console.log('Searching for font:', name);
	return require('file').load("fonts/" + name + ".ttf");
});

func (*Doc) Flow

func (this *Doc) Flow(call otto.FunctionCall) otto.Value

func (*Doc) Font

func (this *Doc) Font(name string, rdr io.Reader) *Font

Font loads a font which can be used in a subsequent text area. The specified name of the font is the same name which must be used in subsequent text calls.

var lib = require('pdf')();
var doc = new lib();
doc.font("Arial", require('file').load("arial.ttf"));

func (*Doc) Load

func (this *Doc) Load(rdr io.Reader) *File

Load loads a file for processing, enabling page manipulation, copying, and placement.

var lib = require('pdf')();
var doc = new lib();
var pdf = doc.Load( require('file').load("other.pdf") );
for (var i=1; i<=pdf.pages(); i++) {
	console.log( pdf.page(i).width(), 'x', pdf.page(i).height() );
}

func (*Doc) Page

func (this *Doc) Page(call otto.FunctionCall) otto.Value

func (*Doc) Pipe

func (this *Doc) Pipe(wtr io.Writer)

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(orb *orbit.Orbit, lib *Lib, doc *Doc, rdr io.Reader) *File

func (*File) Page

func (this *File) Page(call otto.FunctionCall) otto.Value

func (*File) Pages

func (this *File) Pages(call otto.FunctionCall) otto.Value

type Flow

type Flow struct {
	// contains filtered or unexported fields
}

func NewFlow

func NewFlow(orb *orbit.Orbit, lib *Lib, doc *Doc, txt string, opt optlist) *Flow

func (*Flow) Box

func (this *Flow) Box(call otto.FunctionCall) otto.Value

func (*Flow) Place

func (this *Flow) Place(llx, lly, urx, ury float64, opts optlist)

type Font

type Font struct {
	// contains filtered or unexported fields
}

func NewFont

func NewFont(orb *orbit.Orbit, lib *Lib, doc *Doc, fnt string, rdr io.Reader) *Font

type Graphics

type Graphics struct {
	// contains filtered or unexported fields
}

func NewGraphics

func NewGraphics(orb *orbit.Orbit, lib *Lib) *Graphics

func (*Graphics) New

func (this *Graphics) New(call otto.FunctionCall) otto.Value

func (*Graphics) Restore

func (this *Graphics) Restore()

func (*Graphics) Save

func (this *Graphics) Save()

func (*Graphics) Set

func (this *Graphics) Set(state *State)

func (*Graphics) Use

func (this *Graphics) Use(call otto.FunctionCall) otto.Value

type Leaf

type Leaf struct {
	// contains filtered or unexported fields
}

func NewLeaf

func NewLeaf(orb *orbit.Orbit, lib *Lib, doc, pge int) *Leaf

func (*Leaf) Height

func (this *Leaf) Height() float64

func (*Leaf) Width

func (this *Leaf) Width() float64

type Lib

type Lib struct {
	// contains filtered or unexported fields
}

func NewLib

func NewLib(orb *orbit.Orbit, key string) *Lib

func (*Lib) New

func (this *Lib) New(call otto.FunctionCall) otto.Value

type Module

type Module struct {
	// contains filtered or unexported fields
}

func (*Module) Init

func (this *Module) Init(call otto.FunctionCall) otto.Value

type Page

type Page struct {
	// contains filtered or unexported fields
}

func NewPage

func NewPage(orb *orbit.Orbit, lib *Lib, doc *Doc, w, h float64) *Page

func (*Page) Block

func (this *Page) Block(call otto.FunctionCall) otto.Value

func (*Page) Image

func (this *Page) Image(call otto.FunctionCall) otto.Value

func (*Page) Place

func (this *Page) Place(call otto.FunctionCall) otto.Value

func (*Page) Text

func (this *Page) Text(call otto.FunctionCall) otto.Value

type State

type State struct {
	// contains filtered or unexported fields
}

func NewState

func NewState(orb *orbit.Orbit, lib *Lib, opt optlist) *State

type Table

type Table struct {
	// contains filtered or unexported fields
}

func NewTable

func NewTable(orb *orbit.Orbit, lib *Lib, doc *Doc) *Table

func (*Table) Cell

func (this *Table) Cell(col, row int, text string, opts optlist) *Table

Jump to

Keyboard shortcuts

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