PDFium Delphi Component Docs

FPdfProduction ユニット

グラフィックス、ドキュメントコンテンツ、インタラクティブパッケージ、埋め込みメディアのための上限付きプロダクションワークフローです

例外と列挙型

宣言値または目的
EPdfProduction無効なプロダクション入力、安全予算の枯渇、未対応の操作、拒否されたバックエンド出力に対して発生する例外です
TPdfColourSpacepcsDeviceGray, pcsDeviceRGB, pcsDeviceCMYK, pcsICCBased, pcsSeparation, pcsDeviceN, pcsLab
TPdfSvgPathCommandKindspcMoveTo, spcLineTo, spcCubicTo, spcQuadraticTo, spcClosePath
TPdfReplacementModeprmNativeTextObject, prmRedactAndRelayout
TPdfBarcodeKindpbkCode128, pbkQr, pbkDataMatrix, pbkPdf417
TPdfPortfolioFieldTypeppftText, ppftNumber, ppftDate, ppftFileName, ppftDescription, ppftSize, ppftModDate, ppftCreationDate

カラー変換宣言

オプションの LittleCMS プロバイダーはバッファ変換インターフェイスを実装し、FPdfDocumentColour は元の文書オペレーターと画像成分に適用して、完了状況を明示的に報告します

宣言公開フィールドまたはメンバー
pcsLab3 つのネイティブエンディアン 16 ビット成分を持ち、ソースプロファイルバイトを含まない ICC v4 D50 PCS Lab ソースです。L は L*655.35、a / b は (value+128)*257 を使います
TPdfColourBufferSpace: TPdfColourSpace, Components: Integer, BitsPerComponent: Integer, Samples: TBytes, IccProfile: TBytes
TPdfOutputIntentIdentifier: string, RegistryName: string, Info: string, Components: Integer, IccProfile: TBytes
TPdfColourConversionOptionsMaxInputBytes: Integer, MaxOutputBytes: Integer, PreserveOnFailure: Boolean, class function Default: TPdfColourConversionOptions
TPdfColourConversionReportConverted: Boolean, PreservedOriginal: Boolean, InputBytes: Integer, OutputBytes: Integer, ErrorMessage: string

フォントと SVG の宣言

TPdfTrueTypeSubsetBackend は複合クロージャを持つ保持 ID 方式のアウトラインサブセットを提供し、SubsetPdfDocumentFonts が確認済みの埋め込み文書リソースに適用します

宣言公開フィールドまたはメンバー
TPdfGlyphInfoGlyphID: Cardinal, UnicodeValue: Cardinal, Width: Integer
TPdfGlyphInfosTPdfGlyphInfo の動的配列です
TPdfFontSubsetOptionsMaxFontBytes: Integer, MaxGlyphs: Integer, MinimumSavingPercent: Integer, RestrictToContentStreamUsage: Boolean, class function Default: TPdfFontSubsetOptions
TPdfFontSubsetReportApplied: Boolean, PreservedOriginal: Boolean, GlyphCount: Integer, OriginalBytes: Integer, SubsetBytes: Integer, ErrorMessage: string
TPdfSvgPathCommandKind: TPdfSvgPathCommandKind, Values: array[0..5] of Double
TPdfSvgPathCommandsTPdfSvgPathCommand の動的配列です

IPdfFontSubsetClosureBackend でバックエンドを function SubsetWithClosure(const FontProgram: TBytes; const Glyphs: TPdfGlyphInfos; out SubsetProgram: TBytes; out GlyphClosure: TPdfGlyphInfos; out ErrorMessage: string): Boolean で拡張すると、実際のソート済みユニークな依存を返せます

SubsetExistingPdfFont は安定ソートで重複グリフ ID の最初のメタデータを保持し、拡張クロージャの予算と要求グリフのカバレッジを検証して、より小さいプログラムを受け入れる前に実際のクロージャ数を報告します

スタイル付き置換と XFA の宣言

宣言公開フィールドまたはメンバー
TPdfStyledSpanPageIndex: Integer, ObjectIndex: Integer, CharacterStart: Integer, Text: WideString, StyleID: Integer
TPdfStyledSpansTPdfStyledSpan の動的配列です
TPdfRegexMatchStartIndex: Integer, Length: Integer, Replacement: WideString
TPdfRegexMatchesTPdfRegexMatch の動的配列です
TPdfStyledReplacementMode: TPdfReplacementMode, PageIndex: Integer, FirstObjectIndex: Integer, LastObjectIndex: Integer, FirstCharacter: Integer, CharacterCount: Integer, Replacement: WideString, StyleID: Integer, LastPageIndex: Integer
TPdfStyledReplacementsTPdfStyledReplacement の動的配列です
TPdfXfaBindingSomPath: string, Value: string
TPdfXfaBindingsTPdfXfaBinding の動的配列です

バーコードと Portfolio の宣言

FPdfDocumentAssets は、これらのモデルに対する文書レベルの Collection 読み書きと RichMedia 検出を提供します

宣言公開フィールドまたはメンバー
TPdfBarcodeRectLeft: Double, Top: Double, Right: Double, Bottom: Double
TPdfBarcodeRectsTPdfBarcodeRect の動的配列です
TPdfBarcodeResultKind: TPdfBarcodeKind, Text: string, Bounds: TPdfBarcodeRect, Confidence: Double
TPdfBarcodeResultsTPdfBarcodeResult の動的配列です
TPdfPortfolioFieldName: string, DisplayName: string, FieldType: TPdfPortfolioFieldType, Order: Integer, Visible: Boolean, Editable: Boolean
TPdfPortfolioFieldsTPdfPortfolioField の動的配列です
TPdfPortfolioValueFieldName: string, Value: string, Prefix: string
TPdfPortfolioValuesTPdfPortfolioValue の動的配列です
TPdfPortfolioItemKey: string, FileName: string, Description: string, AFRelationship: string, FolderID: Integer, Values: TPdfPortfolioValues, EmbeddedData: TBytes, MimeType: string, CreationDate: string, ModificationDate: string, IsExternal: Boolean
TPdfPortfolioItemsTPdfPortfolioItem の動的配列です
TPdfPortfolioSplitDirection(ppsdNone, ppsdHorizontal, ppsdVertical)
TPdfPortfolioFolderID: Integer, ParentID: Integer, Name: string, Description: string, CreationDate: string, ModificationDate: string, Values: TPdfPortfolioValues
TPdfPortfolioFoldersTPdfPortfolioFolder の動的配列です
TPdfPortfolioSortFieldName: string, Ascending: Boolean
TPdfPortfolioSortFieldsTPdfPortfolioSortField の動的配列です
TPdfPortfolioFields: TPdfPortfolioFields, Items: TPdfPortfolioItems, Folders: TPdfPortfolioFolders, SortField: string, SortAscending: Boolean, SortFields: TPdfPortfolioSortFields, InitialDocument: string, View: TPdfPortfolioView, HasSplit: Boolean, SplitDirection: TPdfPortfolioSplitDirection, SplitPosition: Double, HasColors: Boolean, BackgroundColor: Cardinal, CardBackgroundColor: Cardinal, CardBorderColor: Cardinal, PrimaryTextColor: Cardinal, SecondaryTextColor: Cardinal

TPdfPortfolioView は ppvDetails、ppvTiles、ppvHidden から選びます。Key は FileName とは独立に名前ツリーのエントリを識別し、Prefix は Collection サブ項目の表示接頭辞を保持し、InitialDocument は項目の Key を選びます

RichMedia の宣言

宣言公開フィールド
TPdfRichMediaAssetName: string, MimeType: string, Data: TBytes, IsExternal: Boolean, ActivationCondition: string, DefaultView: string
TPdfRichMediaAssetsTPdfRichMediaAsset の動的配列です
TPdfRichMediaExtractedName: string, MimeType: string, Size: Int64, Sha256: string
TPdfRichMediaExtractedArrayTPdfRichMediaExtracted の動的配列です

バックエンドインターフェイス

インターフェイスメソッド目的
IPdfColourTransformfunction Transform(const Source: TPdfColourBuffer; TargetSpace: TPdfColourSpace; const TargetProfile: TBytes; out Target: TPdfColourBuffer): Boolean検証済みのソースバッファを要求されたカラースペースとプロファイルへ変換します
IPdfColourFloatTransformfunction TransformFloat(const Source: TPdfColourBuffer; TargetSpace: TPdfColourSpace; const TargetProfile: TBytes; TargetBitsPerComponent: Integer; out Target: TPdfColourBuffer): Booleanv3.312.0 からのオプション インターフェースです。物理 Lab 単位のピクセルごと 3 つのネイティブエンディアン IEEE 754 Single PCS Lab 値を受け付け、ソース プロファイルなしで明示的な 8/16 ビット出力精度を選びます。基底インターフェースと ConvertPdfColourBuffer は整数入力を維持します
IPdfFontSubsetBackendfunction Subset(const FontProgram: TBytes; const Glyphs: TPdfGlyphInfos; out SubsetProgram: TBytes): Boolean要求されたグリフ閉包を含むフォントプログラムを構築します
IPdfRegexEnginefunction FindMatches(const Text, Pattern, Replacement: WideString; MaxMatches: Integer): TPdfRegexMatches上限付きの正規表現マッチと置換テキストを返します
IPdfBarcodeProviderfunction Generate(Kind: TPdfBarcodeKind; const Text: string; ModuleSize: Double; out Rects: TPdfBarcodeRects): Booleanサポートされているシンボルのバーコードモジュール矩形を生成します
function Recognise(const Pixels: TBytes; Width, Height, Stride: Integer; MaxResults: Integer): TPdfBarcodeResults呼び出し側が所有するピクセルバッファから上限付きのバーコード結果を認識します

デフォルトオプションファクトリ

メンバー目的
class function TPdfColourConversionOptions.Default: TPdfColourConversionOptionsソース保持を有効にした、上限付きカラー変換のデフォルトを返します
class function TPdfFontSubsetOptions.Default: TPdfFontSubsetOptions最小削減しきい値付きの、上限付きフォントとグリフの制限を返します。v3.207.0 以降、実際の削減率は比較の前に切り下げられるため、空でないサブセットが 100% のしきい値を満たすことはありません

トップレベルルーチン

シグネチャ説明
function ConvertPdfColourBuffer(const Source: TPdfColourBuffer; TargetSpace: TPdfColourSpace; const TargetProfile: TBytes; Transform: IPdfColourTransform; const Options: TPdfColourConversionOptions; out Target: TPdfColourBuffer; out OutputIntent: TPdfOutputIntent; out Report: TPdfColourConversionReport): Booleanカラーバッファを呼び出し側の変換処理へ通し、失敗時はソースを保持しながら対応する OutputIntent データを構築します
function SubsetExistingPdfFont(const FontProgram: TBytes; const UsedGlyphs: TPdfGlyphInfos; Backend: IPdfFontSubsetBackend; const Options: TPdfFontSubsetOptions; out ResultProgram: TBytes; out GlyphClosure: TPdfGlyphInfos; out Report: TPdfFontSubsetReport): Boolean要求グリフを正規化し、オプションの IPdfFontSubsetClosureBackend から依存を取得して、宣言された予算内のより小さいプログラムだけを受け入れます
function ParsePdfSvgPath(const Data: string; MaxCommands: Integer = 100000): TPdfSvgPathCommands相対座標に対応した move、line、cubic、quadratic、close コマンドを上限付きで解析します
function ExportPdfSvgPath(const Commands: TPdfSvgPathCommands): stringパスコマンドを絶対 SVG パス構文へシリアライズします
procedure TransformPdfSvgPath(var Commands: TPdfSvgPathCommands; A, B, C, D, E, F: Double)解析済み SVG パスのすべての座標にアフィン行列を適用します
function BuildStyledRegexReplacementPlan(const Spans: TPdfStyledSpans; const Pattern, Replacement: WideString; Engine: IPdfRegexEngine; MaxCharacters: Integer = 16 * 1024 * 1024; MaxMatches: Integer = 100000): TPdfStyledReplacements正規表現マッチをスタイル付きページオブジェクトスパンへ対応付け直し、ネイティブまたは墨消しベースの置換を選択します
function MergePdfXfaDatasets(const Packets: TXfaPacketList; const Bindings: TPdfXfaBindings; MaxPacketBytes: Integer = 32 * 1024 * 1024): TXfaPacketListエスケープされた SOM リーフバインディングを UTF-8 データセットへマージし、SOM パス内の Unicode XML 要素名に対応し、手つかずの XFA パケットをすべて保持します
function RewritePdfXfaPacketStreams(Source, Destination: TStream; const Packets: TXfaPacketList; MaxTotalPacketBytes: Int64 = 256 * 1024 * 1024): Booleanトランザクション的に置換された XFA パケットストリームを、暗号化されていない PDF へ追記します
function GeneratePdfBarcode(Kind: TPdfBarcodeKind; const Text: string; ModuleSize: Double; Provider: IPdfBarcodeProvider = nil): TPdfBarcodeRects内蔵の Code 128-B ベクトルを生成し、2 次元シンボルをプロバイダーへ委譲します
function RecognisePdfBarcodes(const Pixels: TBytes; Width, Height, Stride: Integer; Provider: IPdfBarcodeProvider; MaxResults: Integer = 256): TPdfBarcodeResults画像ジオメトリと結果上限を強制しながら、バーコード認識を委譲します
procedure ValidatePdfPortfolio(const Portfolio: TPdfPortfolio; MaxItems: Integer = 100000; MaxEmbeddedBytes: Int64 = 1024 * 1024 * 1024)フィールド定義、値、項目数、埋め込みペイロード予算を検証します
procedure SortPdfPortfolio(var Portfolio: TPdfPortfolio)設定されたソートキーを順に適用し、同順を安定に扱って、決定論的な Collection ビューを作成します。SortFields があればそれを使い、なければ従来の単一フィールドの組を使います
function ExtractPdfRichMediaAssets(const Assets: TPdfRichMediaAssets; const OutputDirectory: string; MaxAssetBytes: Int64 = 256 * 1024 * 1024; MaxTotalBytes: Int64 = 1024 * 1024 * 1024): TPdfRichMediaExtractedArrayコンテンツを実行せず、外部参照を解決せず、ディレクトリ脱出を許可せずに、埋め込みアセットを書き出します

FPdfBarcodeZXing は任意のバーコード生成/認識プロバイダーを提供します

安全モデル

色とフォントの入力予算は、保存用コピーを割り当てる前に検査されます。ソースの ICC プロファイルも、カラー入力バイト上限の対象です

SVG パースは相対座標演算の後に非有限座標を拒否し、TransformPdfSvgPath は呼び出し側の配列を差し替える前に非公開の候補を検証します。失敗しても入力とそのエイリアスはどちらも保持されます

RichMedia 抽出は、パス区切り文字、制御文字、Windows の予約デバイス名、末尾のピリオドや空白を拒否し、出力ファイルを排他モードで作成するため、検証と作成の間に既存ファイルが切り詰められることはありません

抽出に失敗した場合、クリーンアップには書き込み中のファイルと、その呼び出しでそれ以前に作成されたファイルが含まれます。抽出の間ずっと、呼び出し側が出力ディレクトリを管理下に置いておく必要があります

プラットフォームコーデック、カラーエンジン、フォントサブセッター、正規表現エンジン、マトリクスバーコードライブラリ、認識エンジンは明示的なインターフェイスであり、ホストは監査済みのバックエンドを選択できます

FPdfStyledEdit は検証済みソース snapshot に対して計画を実行し、preview、フォント再利用または明示的 fallback、上限付き fitting、トランザクションの保存/再読み込み検証を行います