Page
概要
Page は Aspose.PDF の Go 用 FOSS における型です。
Page は Document 内の単一ページのライブビューです。
この型は、Go プログラムで Page オブジェクトを操作するための 58 のメソッドを提供します。利用可能なメソッドは、AddFloatingBox、AddForm、AddImage、AddImageFromStream、AddInlineImage、AddInlineImageFromStream、AddMarkdown、AddSVG、AddSVGFromStream、AddSVGObject、AddStamp、AddTOC、および追加の 46 メソッドです。Aspose.PDF の Go 用 FOSS パッケージをインストールすれば、すべての公開メンバーに任意の Go アプリケーションからアクセスできます。
メソッド
| シグネチャ | 説明 |
|---|---|
RenderBMP(w: io.Writer, opts: RenderOptions) → error | RenderBMP はページをレンダリングし、非圧縮 BMP として書き出します。 |
AddFloatingBox(box: *FloatingBox, rect: Rectangle) → error | AddFloatingBox は rect 内の絶対位置にボックスを描画します。背景と枠線を塗り、その後、パディングを除いた rect 内にボックスの内容をレイアウトします(ボックスからはみ出したコンテンツはクリップされます)。 |
Forms() → []*XForm | Forms はページのリソースで参照されている Form XObject を返します — 既に存在する再利用可能なコンテンツグループです(例: |
AddForm(form: *XForm, rect: Rectangle) → error | AddForm はページ上にフォームを配置し、そのボックスが rect に対応するようにし、軸ごとのフォーム固有のスケールを保持します。 |
ExtractImages() → ([]Image, error) | ExtractImages はページ上で見つかったすべての画像を返します。 |
ImageInfos() → ([]ImageInfo, error) | ImageInfos はページ上で見つかったすべての画像のメタデータを、ピクセルデータをデコードせずに返します。 |
AddImage(path: string, rect: Rectangle) → error | AddImage は指定された矩形内にファイルから画像をページに追加します。 |
AddImageFromStream(r: io.Reader, rect: Rectangle) → error | AddImageFromStream は指定された矩形内にリーダーから画像をページに追加します。 |
AddInlineImage(path: string, rect: Rectangle) → error | AddInlineImage は、Image XObject の代わりに、ページコンテンツストリームに直接インライン画像(BI … ID … EI、ISO 32000-1 §8.9.7)として小さな画像を描画します。 |
AddInlineImageFromStream(r: io.Reader, rect: Rectangle) → error | AddInlineImageFromStream は AddInlineImage の io.Reader バリアントです。 |
AddMarkdown(md: string, rect: Rectangle, opts: ...MarkdownOptions) → error | AddMarkdown は矩形内に Markdown フラグメントを描画します。 |
BeginLayer(layer: *Layer) → error | BeginLayer は、ページ上でレイヤーに割り当てられたマークドコンテンツ領域を開始します。この呼び出しの後に描画されるコンテンツ(AddText、Draw*、AddImage、…)は、EndLayer までそのレイヤーに属します。 |
EndLayer() → error | EndLayer は BeginLayer によって開始されたマーク付きコンテンツセクションを閉じます。 |
Number() → int | Number は文書内の 1 から始まるページ番号を返します。 |
Annotations() → *AnnotationCollection | Annotations はページのアノテーションコレクションを返します。 |
Size() → (PageSize, error) | Size は MediaBox からページの寸法を返します。 |
Rotation() → RotationAngle | Rotation は、ページの実際の回転角度(0、90、180、270)を度単位で返します。 |
MediaBox() → (Rectangle, error) | MediaBox は、ページの MediaBox を PDF ユーザー空間の Rectangle として返します。 |
CropBox() → (Rectangle, error) | CropBox は、ページのクロップボックスを Rectangle として返します。 |
TrimBox() → (Rectangle, error) | TrimBox は、ページのトリムボックスを Rectangle として返します。 |
BleedBox() → (Rectangle, error) | BleedBox はページのブリードボックスを Rectangle として返します。 |
ArtBox() → (Rectangle, error) | ArtBox はページのアートボックスを Rectangle として返します。 |
SetMediaBox(rect: Rectangle) → error | SetMediaBox は PDF ユーザー空間でページの MediaBox(ページ全体の矩形)を設定します。 |
SetCropBox(rect: Rectangle) → error | SetCropBox はページの CropBox(可視領域)を設定します。 |
SetTrimBox(rect: Rectangle) → error | SetTrimBox はページの TrimBox を設定します(意図された完成サイズ)。 |
SetBleedBox(rect: Rectangle) → error | SetBleedBox はページの BleedBox (印刷ブリード領域) を設定します。 |
SetArtBox(rect: Rectangle) → error | SetArtBox はページの ArtBox (有意味なコンテンツ範囲) を設定します。 |
SetPageSize(width: float64) → error | SetPageSize はページの MediaBox を [0 0 width height] (ポイント) に設定することでページサイズを変更します。 |
Label() → string | Label は、ドキュメントの /PageLabels 番号ツリーで定義されたこのページの書式化されたページラベルを返します (PDF 仕様 §12.4.2)。 |
Paragraphs() → (PageMarkup, error) | Paragraphs はページのテキストを列(セクション)および段落にグループ化して返します。 |
RenderImage(opts: RenderOptions) → (image.Image, error) | RenderImage はページを要求された DPI で *image.RGBA にラスタライズします。 |
RenderPNG(w: io.Writer, opts: RenderOptions) → error | RenderPNG はページをレンダリングし、PNG として書き出します。 |
RenderJPEG(w: io.Writer, opts: RenderOptions, quality: int) → error | RenderJPEG はページをレンダリングし、JPEG として書き出します。 |
RenderGIF(w: io.Writer, opts: RenderOptions) → error | RenderGIF はページをレンダリングし、GIF(256色、量子化)として書き出します。 |
ReplaceText(old: string, opts: ...ReplaceOptions) → (int, error) | ReplaceText はページ上の old のすべての出現を replacement に置き換え、置換された回数を返します。 |
AddStamp(s: Stamp) → error | AddStamp はページにスタンプを描画します。 |
AddSVG(path: string, rect: Rectangle) → error | AddSVG は SVG ファイルを読み取り、ページ上の指定された矩形にレンダリングします。 |
AddSVGFromStream(r: io.Reader, rect: Rectangle) → error | AddSVGFromStream は任意の io.Reader から SVG をレンダリングし、ページ上の指定された矩形に描画します。 |
AddSVGObject(svg: *SVG, rect: Rectangle) → error | AddSVGObject は事前に解析された SVG をページ上の指定された矩形に描画します。 |
AddTable(t: *Table, rect: Rectangle) → (int, error) | AddTable は指定された矩形内にテーブルを描画します。 |
TagContent(parent: *StructElement, t: StructType, draw: func() error) → (*StructElement, error) | TagContent はマークドコンテンツシーケンス内にページコンテンツのブロック(draw コールバックが出力するすべて)を描画し、タイプ t の対応するリーフ構造要素を parent の子として追加します(nil = ドキュメントルート)。 |
TagArtifact(draw: func() error) → error | TagArtifact はページ描画のブロックを /Artifact マークドコンテンツシーケンスとして括り、装飾として扱われ、論理構造ツリーから除外されます。 |
AddTaggedList(tc: *TaggedContent, parent: *StructElement, items: []string, style: TextStyle, rect: Rectangle, ordered: bool) → (*StructElement, error) | AddTaggedList は rect 内に箇条書き(ordered=false)または番号付きリスト(ordered=true)を描画し、そのアクセシブル構造を構築します:親要素の下に /L 要素(nil = ドキュメントルート)を配置し、各項目に /LI を作成し、そこに /Lbl(箇条書き記号/番号)と /LBody(項目テキスト)を含めます。 |
AddTaggedTable(tc: *TaggedContent, parent: *StructElement, t: *Table, rect: Rectangle) → (*StructElement, int, error) | AddTaggedTable は AddTable のように rect 内に t を描画し、同時にテーブルの論理構造(/Table → /TR → /TH/TD)を親要素(nil = ドキュメントルート)の下に構築します。各セルのコンテンツをマークドコンテンツとしてタグ付けし、セルの背景と枠線を /Artifact として括ります。 |
ExtractText(opts: ...TextExtractOptions) → (string, error) | ExtractText はページのテキストコンテンツを返します。 |
AddText(text: string, style: TextStyle, rect: Rectangle) → error | AddTextは、指定されたスタイルを使用して矩形内にテキストを描画します。 |
ExtractTextWithLayout() → ([]TextLine, error) | ExtractTextWithLayout は、視覚的(上から下へ、左から右へ)の読み順で並べ替えられた構造化テキスト行を返します。 |
SearchText(query: string, opts: ...SearchOptions) → ([]TextMatch, error) | SearchText はページ上のクエリのすべての出現箇所を検索し、視覚的な読み順(上から下へ、左から右へ)で一致箇所を返します。 |
RenderTIFF(w: io.Writer, opts: RenderOptions) → error | RenderTIFF はページをレンダリングし、単一ページの Deflate TIFF として書き出します。 |
AddTOC(entries: []TOCEntry, rect: Rectangle, opts: ...TOCOptions) → (int, error) | AddTOC は提供されたエントリ一覧から目次を生成し、このページ上の rect に描画します。 |
DrawLine(from: Point, style: LineStyle) → error | DrawLine は、指定されたスタイルで、from→to の単一の線分を描画します。 |
DrawRectangle(rect: Rectangle, style: ShapeStyle) → error | DrawRectangle は、軸に平行な矩形を描画および/または塗りつぶします。 |
DrawCircle(center: Point, radius: float64, style: ShapeStyle) → error | DrawCircle は、円を描画および/または塗りつぶします。 |
DrawEllipse(center: Point, rx: float64, style: ShapeStyle) → error | DrawEllipse は、軸に平行な楕円を描画および/または塗りつぶします。 |
DrawPolyline(points: []Point, style: LineStyle) → error | DrawPolyline は開いたポリラインをストロークします(最初と最後の点は接続されていません)。 |
DrawPath(path: *Path, style: ShapeStyle) → error | DrawPath は以前に構築されたパスをストロークおよび/または塗りつぶします。 |
DrawRoundedRectangle(rect: Rectangle, radius: float64, style: ShapeStyle) → error | DrawRoundedRectangle は指定された半径の角丸を持つ軸平行矩形をストロークおよび/または塗りつぶします。 |
DrawPolygon(points: []Point, style: ShapeStyle) → error | DrawPolygon は閉じた多角形をストロークおよび/または塗りつぶします(最後の点は h を介して最初の点に接続されます)。 |