Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeString ¶
Types ¶
type Boolean ¶
type Boolean bool
Boolean represents a PDF boolean object (true or false).
func (Boolean) WriteEncrypted ¶
type Dictionary ¶
Dictionary is a PDF dictionary object.
func (Dictionary) String ¶
func (d Dictionary) String() string
func (Dictionary) WriteEncrypted ¶
func (d Dictionary) WriteEncrypted(w io.Writer, ec *EncryptionContext, objNum, objGen int) (int64, error)
type EncryptionContext ¶
type EncryptionContext struct {
O []byte // Owner key
U []byte // User key
P int32 // Permissions
FileID []byte // ID from trailer
EncryptKey []byte // Global encryption key
Algorithm int // 1 (RC4), 2 (RC4 128), 4 (AES 128), 5 (AES 256)
Revision int // 2 (40-bit), 3 (128-bit), 4 (Acrobat 7), 5 (Acrobat 9), 6 (Acrobat X)
}
EncryptionContext holds keys and data for PDF encryption.
func NewEncryptionContext ¶
func NewEncryptionContext(password string, fileID []byte) *EncryptionContext
NewEncryptionContext creates a new EncryptionContext from a password and file ID.
func (*EncryptionContext) Encrypt ¶
func (ec *EncryptionContext) Encrypt(data []byte, objNum, objGen int) []byte
Encrypt encrypts data using the object's ID and generation.
func (*EncryptionContext) WriteEncrypted ¶
func (ec *EncryptionContext) WriteEncrypted(w io.Writer, data []byte, objNum, objGen int) (int64, error)
WriteEncrypted writes data as a hex string or literal string, encrypted if necessary.
type Float ¶
type Float float64
Float represents a PDF real number object.
func (Float) WriteEncrypted ¶
type IndirectObject ¶
IndirectObject is a PDF indirect object.
func (*IndirectObject) String ¶
func (io *IndirectObject) String() string
func (*IndirectObject) WriteEncrypted ¶
func (io *IndirectObject) WriteEncrypted(w io.Writer, ec *EncryptionContext, objNum, objGen int) (int64, error)
type Name ¶
type Name string
Name represents a PDF name object.
func (Name) WriteEncrypted ¶
type Object ¶
type Object interface {
// String returns the PDF representation of the object.
String() string
// WriteTo writes the PDF representation to the writer.
WriteTo(w io.Writer) (int64, error)
// WriteEncrypted writes the PDF representation to the writer, encrypted if needed.
WriteEncrypted(w io.Writer, ec *EncryptionContext, objNum, objGen int) (int64, error)
}
Object is the base interface for all PDF objects. Primitives include Name, Integer, String, Array, and Dictionary.
type ObjectManager ¶
type ObjectManager struct {
Objects []IndirectObject
// contains filtered or unexported fields
}
ObjectManager handles PDF objects and their generation.
func NewObjectManager ¶
func NewObjectManager() *ObjectManager
NewObjectManager creates a new ObjectManager.
func (*ObjectManager) AddObject ¶
func (m *ObjectManager) AddObject(obj Object) Reference
AddObject adds an object and returns its reference.
type PDFString ¶
type PDFString string
PDFString is a PDF literal string object. Renamed from String to avoid conflict with string type.
func (PDFString) WriteEncrypted ¶
type Stream ¶
type Stream struct {
Dict Dictionary
Data []byte
}
Stream represents a PDF stream object.