PDFium Delphi Component Docs

TPdf コンポーネント

ユニット: PDFium
TPdf
TPdf コンポーネントを使用して、PDF ドキュメントを開き、ナビゲートし、テキストを抽出し、編集します

例

Pdf.FileName := 'document.pdf';
Pdf.Password := 'password';
Pdf.Active := True; // open PDF document
Pdf.PageNumber := 1; // select page
ShowMessage(Pdf.Text); // extract text

型

type TBookmark = record
  Handle: FPDF_BOOKMARK;
  Title: WString;
  PageNumber: Integer;
  Destination: TDestination;
  DescendantCount: Integer;
  IsOpen: Boolean;
  Action: TPdfAction;
  ActionPageNumber: Integer;
  ActionDestination: TDestination;
  ActionPath: WString;
  HasColor: Boolean;
  Color: TColor;
end;

type TBookmarks = array of TBookmark;

ブックマークデータ

 

type TDestination = record
  Handle: FPDF_DEST;
  Name: WString;
  PageNumber: Integer;
  ViewMode: TPdfDestinationViewMode;
  ViewParameterCount: Integer;
  ViewParameters: TPdfDestinationViewParameters;
  HasX: Boolean;
  X: Single;
  HasY: Boolean;
  Y: Single;
  HasZoom: Boolean;
  Zoom: Single;
end;

名前付きデスティネーションデータ

 

type TPdfDestinationViewMode = (dvmUnknown, dvmXYZ, dvmFit, dvmFitHorizontal, dvmFitVertical, dvmFitRectangle, dvmFitBoundingBox, dvmFitBoundingBoxHorizontal, dvmFitBoundingBoxVertical);

type TPdfDestinationViewParameters = array [0..3] of Single;

デスティネーション表示モードとその順序付きネイティブパラメータ

 

type TLinkAnnotation = record
  Handle: FPDF_LINK;
  Rectangle: TPdfRectangle;
  PageNumber: Integer;
  Action: TPdfAction;
  ActionPageNumber: Integer;
  ActionPath: WString;
  Points: array of TQuadrilateralPoint;
end;

type TLinkAnnotations = array of TLinkAnnotation;

type TQuadrilateralPoint = array [1..4] of TPdfPoint;

リンクアノテーションデータ

 

type TPdfPermission = (permPrint, permModify, permCopy, permAnnotate, permFillForms, permAccessibility, permAssemble, permPrintHighQuality);

type TPdfPermissions = set of TPdfPermission;

ネイティブ権限マスクからデコードされた型付きドキュメント権限フラグ

 

type TPdfDocumentMetadata = record
  Title: WString;
  Author: WString;
  Subject: WString;
  Keywords: WString;
  Creator: WString;
  Producer: WString;
  CreationDate: WString;
  ModifiedDate: WString;
end;

標準ドキュメント Info 辞書フィールドの 1 スナップショット

 

type TObjectType = (otUnknown, otText, otPath, otImage, otShading, otForm);

PDF オブジェクトの型を示します

 

type TPageMode = (pmNone, pmOutline, pmThumbs, pmFullScreen, pmOptionalContentGroup, pmAttachments, pmUnknown);

開いたときに PDF ドキュメントをどのように表示するかを示します

 

type TPdfAction = (acUnsupported, acGoto, acGotoRemote, acUri, acLaunch);

ブックマーク項目に関連付けられたアクションの型を示します

 

type TPdfAnnotation = record
  Subtype: TPdfAnnotationSubtype;
  Flags: TPdfAnnotationFlags;
  HasColor: Boolean;
  Color: TColor;
  ColorAlpha: Byte;
  HasInteriorColor: Boolean;
  InteriorColor: TColor;
  InteriorColorAlpha: Byte;
  HasAttachmentPoints: Boolean;
  AttachmentPoints: TQuadrilateralPoint;
  Rectangle: TPdfRectangle;
  ContentsText: WString;
  AuthorText: WString;
end;

アノテーションデータ

 

type TPdfAnnotationFlag = (afInvisible, afHidden, afPrint, afNoZoom, afNoRotate, afNoView, afReadOnly, afLocked, afToggleNoView);

type TPdfAnnotationFlags = set of TPdfAnnotationFlag;

アノテーションフラグ

 

type TPdfAnnotationSubtype = (anUnknown, anText, anLink, anFreeText, anLine, anSquare, anCircle, anPolygon, anPolyLine, anHighlight, anUnderline, anSquiggly, anStrikeout, anStamp, anCaret, anInk, anPopup, anFileAttachment, anSound, anMovie, anWidget, anScreen, anPrinterMark, anTrapNet, anWaterMark, anThreed, anRichMedia, anXfaWidget, anRedact);

アノテーションのサブタイプ

 

type TPdfBlendMode = (bmDefault, bmColor, bmColorBurn, bmColorDodge, bmDarken, bmDifference, bmExclusion, bmHardLight, bmHue, bmLighten, bmLuminosity, bmMultiply, bmNormal, bmOverlay, bmSaturation, bmScreen, bmSoftLight);

レイヤー同士のブレンド方法を示します

 

type TPdfDisplayMode = (dmSingleContinuous, dmTwoPageContinuous, dmTwoPageContinuousWithCover);

PDF ドキュメントのページの表示方法を示します

 

type TPdfFeature = (feUnknown, feXfaForm, fePortableCollection, feAttachment, feSecurity, feSharedReview, feSharedFormAcrobat, feSharedFormFilesystem, feSharedFormEmail, fe3dAnnotation, feMovieAnnotation, feSoundAnnotation, feScreenMediaAnnotation, feScreenRichMediaAnnotation, feAttachmentAnnotation, feSignatureAnnotation);

OnUnsupportedFeature イベントで報告される PDF ドキュメントの機能

 

type TPdfFillMode = (fmNone, fmAlternate, fmWinding);

パスが自己交差するときの塗りつぶし領域の形成方法を示します

 

type TPdfFormFieldFlag = (ffReadOnly, ffRequired, ffNoExport, ffMultiline, ffChoiceCombo, ffChoiceEdit, ffPassword, ffChoiceMultiSelect);

type TPdfFormFieldFlags = set of TPdfFormFieldFlag;

フォームフィールドフラグ

 

type TPdfFormFieldInfo = record
  Name: WString;
  AlternateName: WString;
  FieldType: TPdfFormFieldType;
  Flags: TPdfFormFieldFlags;
  OptionLabels: array of WString;
  OptionSelected: array of Boolean;
  FontSize: Single;
  Checked: Boolean;
  ExportValue: WString;
  GroupCount: Integer;
  GroupIndex: Integer;
end;

フォームフィールド情報

 

type TPdfFormFieldType = (fiUnknown, fiPushButton, fiCheckBox, fiRadioButton, fiComboBox, fiListBox, fiTextField, fiSignature);

フォームフィールドの型を示します

 

type TPdfFormType = (ftUnknown, ftNone, ftAcroForm, ftXfaFull, ftXfaForeground);

PDF ドキュメント内のフォームの型を示します

 

type TPdfImage = record
  Width: Integer;
  Height: Integer;
  Data: TBytes;
end;

PDF 画像オブジェクトのピクセル単位のサイズとデータ

 

type TPdfLineCap = (lcDefault, lcButt, lcRound, lcProjectingSquare);

開いたサブパスの端点に使用する形状

 

type TPdfLineJoin = (ljDefault, ljMiter, ljRound, ljBevel);

ストロークされるパスの角に使用する形状

 

type TPdfPoint = record
  X, Y: Double;
end;

X 座標と Y 座標を持つ点

 

type TPdfRectangle = record
  Left, Top, Right, Bottom: Double;
end;
type TPdfRectangles = array of TPdfRectangle;

Left、Top、Right、Bottom 座標を持つ矩形領域

 

type TPdfFileIdentifierType = (fidPermanent, fidChanging);

トレーラファイル識別子セレクタ。fidPermanent は最初の /ID エントリを読み取り、fidChanging は 2 番目の /ID エントリを読み取ります

 

type TPdfPageBox = (pbMedia, pbCrop, pbBleed, pbTrim, pbArt);

PageBox、GetPageBox、SetPageBox が使用するページ辞書ボックスセレクタ

 

type TPdfJavaScriptAction = record
  Name: WString;
  Script: WString;
end;
type TPdfJavaScriptActions = array of TPdfJavaScriptAction;

ドキュメントレベルの JavaScript ネームツリーアクションデータ

 

type TPdfSignature = record
  Content: TBytes;
  Encoding: WString;
  Reason: WString;
  Time: WString;
  Permission: Integer;
end;

電子署名情報

 

type TPdfIntegerArray = array of Integer;

構造ツリーのマークコンテンツ ID リストで使われる整数配列

 

type TPdfSingleArray = array of Single;

テキストオブジェクトの文字位置設定で使われる単精度浮動小数点数配列

 

type TPdfPrintPageRange = record
  StartPage: Integer;
  EndPage: Integer;
end;
type TPdfPrintPageRanges = array of TPdfPrintPageRange;

ドキュメントのビューア設定からの 1 始まり印刷ページ範囲

 

type TPdfStructureElement = record
  Level: Integer;
  ParentIndex: Integer;
  TypeName: WString;
  ObjectType: WString;
  Title: WString;
  AlternateText: WString;
  ActualText: WString;
  Expansion: WString;
  ID: WString;
  Language: WString;
  MarkedContentID: Integer;
  MarkedContentIDs: TPdfIntegerArray;
  ChildCount: Integer;
  ChildMarkedContentIDs: TPdfIntegerArray;
  AttributeCount: Integer;
  ListNumbering: WString;
  Scope: WString;
  HasHeaders: Boolean;
  HeadersIds: array of WString;
  ColSpan: Integer;
  RowSpan: Integer;
  HasPrintField: Boolean;
  NamespaceUri: WString;
  RoleMappedNamespaceUri: WString;
  RoleMappedTypeName: WString;
  HasReference: Boolean;
  HasAssociatedFile: Boolean;
  AssociatedFileRelationship: WString;
  AssociatedFileDescription: WString;
  AnnotationSubtype: WString;
  AnnotationContents: WString;
  AnnotationAlternateText: WString;
  IsArtifact: Boolean;
  WidgetCount: Integer;
  HasAppearance: Boolean;
  LabelText: WString;
  FieldAlternateName: WString;
end;

type TPdfStructureElements = array of TPdfStructureElement;

タグ付き PDF ページのフラット化された論理構造要素データ

 

type TPdfFormSelectionRect = record
  PageNumber: Integer;
  Bounds: TPdfRectangle;
end;

ネイティブなフォームテキスト選択が報告する、呼び出し元所有のページ空間矩形

 

type TPdfStructureReadOptions = record
  MaxDepth: Integer;
  MaxElements: Integer;
  MaxAttributeValues: Integer;
  DeadlineMilliseconds: Cardinal;
  IncludeAttributes: Boolean;
  class function Default: TPdfStructureReadOptions; static;
end;

反復的なネイティブ構造ツリー走査のためのリソース予算

type TPdfStructureReadStatus = record
  Completed: Boolean;
  ElementsVisited: Integer;
  AttributeValuesVisited: Integer;
  DepthLimitReached: Boolean;
  ElementLimitReached: Boolean;
  AttributeLimitReached: Boolean;
  DeadlineReached: Boolean;
  VisitorStopped: Boolean;
end;

構造走査メソッドが返す完了と切り詰めの詳細

 

type TPdfVersion = (pvUnknown, pv10, pv11, pv12, pv13, pv14, pv15, pv16, pv17);

PDF ファイルまたは明示的な SaveAs ターゲットのバージョン。取り得る値は、不明なバージョン、PDF バージョン 1.0 から 1.7 です。PDF 1.3 から PDF 1.7 の明示的な SaveAs ターゲットは正規化され、選択された PDF バージョンに対して検証されます

 

type TPrintPaperHandling = (phUndefined, phSimplex, phDuplexFlipShortEdge, phDuplexFlipLongEdge);

印刷用紙処理オプション

 

type TPdfPrintMode = (prEmf, prTextOnly, prPostScript2, prPostScript3, prPostScript2PassThrough, prPostScript3PassThrough, prEmfImageMasks, prPostScript3Type42, prPostScript3Type42PassThrough);

SetPdfPrintMode で選択される Windows 向け PDFium 印刷出力モード

 

type TRenderOption = (reAnnotations, reLcd, reNoNativeText, reGrayscale, reDebugInfo, reNoCatchException, reLimitCache, reHalftone, rePrinting, reReverseByteOrder, reNoSmoothText, reNoSmoothImage, reNoSmoothPath, reInvert, reNightDuotone);

type TRenderOptions = set of TRenderOption;

ページレンダリングフラグ

 

type TRotation = (ro0, ro90, ro180, ro270);

PDF ページの回転。回転は時計回りです

 

type TSaveOption = (saNone, saIncremental, saNoIncremental, saRemoveSecurity);

PDF ドキュメントの保存方法を示します

 

type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);

type TSearchOptions = set of TSearchOption;

検索フラグ

 

type TWebLink = record
  Url: WString;
  Rectangles: TPdfRectangles;
end;

type TWebLinks = array of TWebLink;

ウェブリンクの URL 情報と境界

 

type WString = {$ifdef D2009PLUS} string {$else} WideString {$endif D2009PLUS};

ワイド文字列

 

定数

const PointsPerInch: Integer = 72;

PDF は 1 インチ 72 ポイントの密度でポイントを使用します

 

const FLAT_NORMALDISPLAY = 0;
const FLAT_PRINT = 1;

FlattenPage / FlattenAllPages に渡すフラット化プロファイル。FLAT_NORMALDISPLAY は画面表示、FLAT_PRINT は印刷出力を対象とします

 

const FLATTEN_FAIL = 0;
const FLATTEN_SUCCESS = 1;
const FLATTEN_NOTHINGTODO = 2;

FlattenPage が返す結果コード

 

type TPdfReadingUnit = record
  Text: WString;
  Kind: TPdfContentFragmentKind;
  HeadingLevel: Integer;
  Page: Integer;
  Rects: TPdfRectangles;
  FragmentIndex: Integer;
  SentenceIndex: Integer;
  IsAlternateText: Boolean;
  Language: WString;
end

type TPdfReadingUnits = array of TPdfReadingUnit;

音声合成と支援リスニング読み上げで使う文単位の読み上げ単位です

 

type TPdfWordBox = record
  Text: WString;
  StartIndex: Integer;
  Count: Integer;
  Rect: TPdfRectangle;
  Page: Integer;
end

type TPdfWordBoxes = array of TPdfWordBox;

同期読み上げの強調表示で使う単語単位のテキスト範囲とページ矩形です

 

type TPdfSpokenSpan = record
  SpokenStart: Integer;
  SpokenCount: Integer;
  Page: Integer;
  StartIndex: Integer;
  Count: Integer;
end

type TPdfSpokenSpans = array of TPdfSpokenSpan;

読み上げオフセットを PDF ページ文字へ対応付ける範囲です

 

type TPdfSpokenText = record
  Text: WString;
  Spans: TPdfSpokenSpans;
end

type TPdfSpokenTexts = array of TPdfSpokenText;

読み上げチャンクと元テキストの対応を保持します

 

type TPdfReadingSessionState = (pssIdle, pssSpeaking, pssPaused);

TPdfReadingSession の再生状態です

 

グローバル変数

var LibraryName: string = 'pdfium.dll';

EnableV8Engine が False のときに使う標準 PDFium ライブラリ名です。LoadLibrary を呼ぶ前なら変更できます

 

var EnableV8Engine: Boolean = False;

読み込み前に True にすると、対応する Win32 または Win64 の DLLs フォルダから pdfium.v8.dll を選択します

 

グローバル関数

プロパティ

メソッド

イベント