reader

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PDFTypeNull means “no type”
	PDFTypeNull = iota
	// PDFTypeNumeric is a numeric type
	PDFTypeNumeric
	// PDFTypeToken is a name or something similar
	PDFTypeToken
	// PDFTypeHex is a hexadecimal encoded string such as <0012>
	PDFTypeHex
	// PDFTypeString is a string in parenthesis
	PDFTypeString
	// PDFTypeDictionary represents a Dictionary in double angle brackets << ... >>. The keys are strings and the values are PDF values
	PDFTypeDictionary
	// PDFTypeArray is an array [ ... ]
	PDFTypeArray
	// PDFTypeObjDec is a decimal (integer) object
	PDFTypeObjDec
	// PDFTypeObjRef is an indirect reference to an object such as 1 0 R
	PDFTypeObjRef
	// PDFTypeObject ...
	PDFTypeObject
	// PDFTypeStream is a slice of bytes representing a PDF stream
	PDFTypeStream
	// PDFTypeBoolean is either true or false
	PDFTypeBoolean
	// PDFTypeReal is a numeric with decimal places
	PDFTypeReal
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PdfReader

type PdfReader struct {
	SourceFile string
	// contains filtered or unexported fields
}

A PdfReader reads a PDF file for importing

func NewPdfReader

func NewPdfReader(filename string) (*PdfReader, error)

NewPdfReader opens a PDF file and returns a PdfReader

func NewPdfReaderFromStream

func NewPdfReaderFromStream(rs io.ReadSeeker) (*PdfReader, error)

NewPdfReaderFromStream opens the io.ReadSeeker and returns a PdfReader object

func (*PdfReader) GetAllPageBoxes

func (pr *PdfReader) GetAllPageBoxes(k float64) (map[int]map[string]map[string]float64, error)

GetAllPageBoxes returns all pages boxes

func (*PdfReader) GetContent

func (pr *PdfReader) GetContent(pageno int) (string, error)

GetContent reaturns the stream for the given page (i.e. PDF drawing instructions)

func (*PdfReader) GetNumPages

func (pr *PdfReader) GetNumPages() (int, error)

GetNumPages returns the number of pages in the PDF file

func (*PdfReader) GetPageBoxes

func (pr *PdfReader) GetPageBoxes(pageno int) (map[string]map[string]float64, error)

GetPageBoxes gets all page box data

func (*PdfReader) GetPageResources

func (pr *PdfReader) GetPageResources(pageno int) (*PdfValue, error)

GetPageResources gets references to page resources for a given page number

func (*PdfReader) GetPageRotation

func (pr *PdfReader) GetPageRotation(pageno int) (*PdfValue, error)

GetPageRotation returns the page rotation for a page number

func (*PdfReader) ResolveObject

func (pr *PdfReader) ResolveObject(objSpec *PdfValue) (*PdfValue, error)

ResolveObject returns the direct object referenced from objSpec or objSpec if it is not a reference to an object.

type PdfValue

type PdfValue struct {
	Type       int
	String     string
	Token      string
	Int        int
	Real       float64
	Bool       bool
	Dictionary map[string]*PdfValue
	Array      []*PdfValue
	ID         int
	NewID      int
	Gen        int
	Value      *PdfValue
	Stream     *PdfValue
	Bytes      []byte
}

A PdfValue holds any data structure found within a PdF file. The used file is provided by the Type attribute

Jump to

Keyboard shortcuts

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