Documentation
¶
Overview ¶
Package writer provides functionality to write PDF documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFileID ¶
GenerateFileID generates a random 16-byte file ID
Types ¶
type EncryptionInfo ¶
type EncryptionInfo struct {
UserPassword string
OwnerPassword string
Permissions security.Permissions
KeyLength int // 40 or 128 bits
FileID []byte
EncryptionKey []byte
OValue []byte // Owner password string
UValue []byte // User password string
}
EncryptionInfo holds encryption-related information for PDF generation
func SetupEncryption ¶
func SetupEncryption(userPassword, ownerPassword string, permissions security.Permissions, keyLength int) (*EncryptionInfo, error)
SetupEncryption initializes encryption parameters and computes O, U values
func (*EncryptionInfo) CreateEncryptDictionary ¶
func (ei *EncryptionInfo) CreateEncryptDictionary() core.Dictionary
CreateEncryptDictionary creates the Encrypt dictionary for the PDF
func (*EncryptionInfo) CreateFileIDArray ¶
func (ei *EncryptionInfo) CreateFileIDArray() core.Array
CreateFileIDArray creates the file ID array for the trailer
type Serializer ¶
type Serializer struct {
// contains filtered or unexported fields
}
Serializer converts PDF objects to their textual representation.
func NewSerializer ¶
func NewSerializer(w io.Writer) *Serializer
NewSerializer creates a new Serializer that writes to the given writer.
func (*Serializer) Serialize ¶
func (s *Serializer) Serialize(obj core.Object) error
Serialize writes the PDF object to the output in its textual format.
func (*Serializer) SerializeIndirectObject ¶
func (s *Serializer) SerializeIndirectObject(obj *core.IndirectObject) error
SerializeIndirectObject writes an indirect object definition.
type TTFFontEmbedder ¶
type TTFFontEmbedder struct {
// contains filtered or unexported fields
}
TTFFontEmbedder handles embedding TrueType fonts into PDF
func NewTTFFontEmbedder ¶
func NewTTFFontEmbedder(w *Writer) *TTFFontEmbedder
NewTTFFontEmbedder creates a new TTF font embedder
func (*TTFFontEmbedder) EmbedTTFFont ¶
func (e *TTFFontEmbedder) EmbedTTFFont(ttfFont *font.TTFFont, usedGlyphs map[uint16]rune) (*core.Reference, error)
EmbedTTFFont embeds a TTF font into the PDF and returns a reference to the font object
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer handles PDF document writing and output.
func (*Writer) SetEncryption ¶
func (w *Writer) SetEncryption(encryptionInfo *EncryptionInfo)
SetEncryption sets up encryption for the PDF
func (*Writer) WriteHeader ¶
WriteHeader writes the PDF header (%PDF-1.7).
func (*Writer) WriteTrailer ¶
func (w *Writer) WriteTrailer(trailer core.Dictionary) error
WriteTrailer writes the xref table and trailer.