content

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIDRange added in v0.5.0

type CIDRange struct {
	StartCID  uint16
	EndCID    uint16
	StartChar rune
}

CIDRange はCIDの範囲マッピング

type FontInfo added in v0.5.0

type FontInfo struct {
	Name          string         // PDF内部名(例: F1, F2)
	BaseFont      string         // 実際のフォント名(例: Helvetica, Times-Roman)
	ToUnicodeCMap *ToUnicodeCMap // nilの場合は通常のエンコーディングを使用
}

FontInfo はフォント情報を保持する

type FontManager added in v0.5.0

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

FontManager はページ内のフォント情報を管理する

func NewFontManager added in v0.5.0

func NewFontManager(r *reader.Reader) *FontManager

NewFontManager は新しいFontManagerを作成する

func (*FontManager) GetFont added in v0.5.0

func (fm *FontManager) GetFont(fontName string, pageResources core.Dictionary) (*FontInfo, error)

GetFont はフォント名から FontInfo を取得する pageResources はページの /Resources ディクショナリ

type GraphicsState

type GraphicsState struct {
	CTM          Matrix     // Current Transformation Matrix
	LastCMMatrix *Matrix    // 最後のcm操作のパラメータ(画像配置用)
	ColorSpace   string     // 色空間
	StrokeColor  [3]float64 // 線の色(RGB)
	FillColor    [3]float64 // 塗りつぶし色(RGB)
	LineWidth    float64    // 線幅
}

GraphicsState は現在のグラフィックス状態

func NewGraphicsState

func NewGraphicsState() GraphicsState

NewGraphicsState は新しいGraphicsStateを作成する

func (GraphicsState) Clone

func (gs GraphicsState) Clone() GraphicsState

Clone はGraphicsStateのコピーを作成する(スタック用)

type ImageBlock

type ImageBlock struct {
	ImageInfo            // 画像情報
	X            float64 // 配置X座標
	Y            float64 // 配置Y座標
	PlacedWidth  float64 // 配置された幅
	PlacedHeight float64 // 配置された高さ
	Transform    Matrix  // 変換行列
}

ImageBlock は画像の配置情報(位置情報付き)

type ImageExtractor

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

ImageExtractor は画像を抽出する

func NewImageExtractor

func NewImageExtractor(r *reader.Reader) *ImageExtractor

NewImageExtractor は新しいImageExtractorを作成する

func (*ImageExtractor) ExtractImages

func (e *ImageExtractor) ExtractImages(page core.Dictionary) ([]ImageInfo, error)

ExtractImages はページから画像を抽出する

func (*ImageExtractor) ExtractImagesWithPosition

func (e *ImageExtractor) ExtractImagesWithPosition(page core.Dictionary, operations []Operation, pageLevelCTM *Matrix) ([]ImageBlock, error)

ExtractImagesWithPosition は位置情報付きで画像を抽出する pageLevelCTM: ページレベルの変換行列(nilの場合は単位行列として扱う)

type ImageFormat

type ImageFormat string

ImageFormat は画像フォーマット

const (
	ImageFormatJPEG    ImageFormat = "jpeg"
	ImageFormatPNG     ImageFormat = "png"
	ImageFormatUnknown ImageFormat = "unknown"
)

type ImageInfo

type ImageInfo struct {
	Name        string      // リソース名(例: "Im1")
	Width       int         // 画像の幅
	Height      int         // 画像の高さ
	ColorSpace  string      // 色空間(DeviceRGB, DeviceGray, DeviceCMYK)
	BitsPerComp int         // ビット深度
	Filter      string      // 圧縮フィルター
	Data        []byte      // 画像データ
	Format      ImageFormat // 画像フォーマット
}

ImageInfo は画像の情報

type Matrix

type Matrix struct {
	A, B, C, D, E, F float64 // [a b c d e f]
}

Matrix は変換行列(CTM: Current Transformation Matrix)

func Identity

func Identity() Matrix

Identity は単位行列を返す

func (Matrix) Inverse added in v0.12.0

func (m Matrix) Inverse() Matrix

Inverse はマトリックスの逆行列を計算する CTM適用後の座標を元の座標に戻すために使用

func (Matrix) Multiply

func (m Matrix) Multiply(other Matrix) Matrix

Multiply は行列の乗算を行う 新しいCTM = 現在のCTM × 新しい変換行列

func (Matrix) TransformPoint

func (m Matrix) TransformPoint(x, y float64) (float64, float64)

TransformPoint は座標を変換する

func (Matrix) TransformRect

func (m Matrix) TransformRect(x, y, width, height float64) (minX, minY, maxX, maxY float64)

TransformRect は矩形を変換する(4隅を変換)

type Operation

type Operation struct {
	Operator string        // オペレーター名(例: "Tj", "Td")
	Operands []core.Object // オペランド
}

Operation はコンテンツストリームのオペレーション

type StreamParser

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

StreamParser はコンテンツストリームをパースする

func NewStreamParser

func NewStreamParser(data []byte) *StreamParser

NewStreamParser は新しいStreamParserを作成する

func (*StreamParser) ParseOperations

func (p *StreamParser) ParseOperations() ([]Operation, error)

ParseOperations はコンテンツストリームからオペレーションを抽出する

type TextElement

type TextElement struct {
	Text string  // テキスト内容
	X    float64 // X座標
	Y    float64 // Y座標
	Font string  // フォント名
	Size float64 // フォントサイズ
}

TextElement はテキスト要素

func (TextElement) GetSize added in v0.21.1

func (e TextElement) GetSize() float64

GetSize はフォントサイズを返す(SortableTextElementインターフェース実装)

func (TextElement) GetX added in v0.21.1

func (e TextElement) GetX() float64

GetX はX座標を返す(SortableTextElementインターフェース実装)

func (TextElement) GetY added in v0.21.1

func (e TextElement) GetY() float64

GetY はY座標を返す(SortableTextElementインターフェース実装)

type TextExtractor

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

TextExtractor はテキストを抽出する

func NewTextExtractor

func NewTextExtractor(operations []Operation, r *reader.Reader, page core.Dictionary) *TextExtractor

NewTextExtractor は新しいTextExtractorを作成する

func (*TextExtractor) Extract

func (e *TextExtractor) Extract() ([]TextElement, error)

Extract はテキストを抽出する

func (*TextExtractor) GetPageLevelCTM added in v0.12.0

func (e *TextExtractor) GetPageLevelCTM() *Matrix

GetPageLevelCTM はページレベルのCTMを返す

type ToUnicodeCMap added in v0.5.0

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

ToUnicodeCMap はCIDからUnicodeへのマッピング

func ParseToUnicodeCMap added in v0.5.0

func ParseToUnicodeCMap(data []byte) (*ToUnicodeCMap, error)

ParseToUnicodeCMap はToUnicode CMapをパースする

func (*ToUnicodeCMap) Lookup added in v0.5.0

func (cm *ToUnicodeCMap) Lookup(cid uint16) (rune, bool)

Lookup はCIDをUnicodeに変換

func (*ToUnicodeCMap) LookupString added in v0.5.0

func (cm *ToUnicodeCMap) LookupString(data []byte) string

LookupString はCIDバイト列をUnicode文字列に変換

Directories

Path Synopsis
Package image provides image processing utilities for PDF.
Package image provides image processing utilities for PDF.
png
Package layout provides internal layout processing utilities.
Package layout provides internal layout processing utilities.
Package markdown provides Markdown parsing functionality for gopdf.
Package markdown provides Markdown parsing functionality for gopdf.
Package text はテキスト処理機能を提供します
Package text はテキスト処理機能を提供します
Package translate はPDF翻訳機能を提供します
Package translate はPDF翻訳機能を提供します

Jump to

Keyboard shortcuts

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