PDFium Delphi Component Docs

FPdfProduction 單元

圖形、文件內容、互動套件與內嵌媒體的有界正式環境工作流程

例外與列舉

宣告值或用途
EPdfProduction正式環境輸入無效、安全額度耗盡、不支援的操作與後端輸出被拒時引發的例外
TPdfColourSpacepcsDeviceGray, pcsDeviceRGB, pcsDeviceCMYK, pcsICCBased, pcsSeparation, pcsDeviceN
TPdfSvgPathCommandKindspcMoveTo, spcLineTo, spcCubicTo, spcQuadraticTo, spcClosePath
TPdfReplacementModeprmNativeTextObject, prmRedactAndRelayout
TPdfBarcodeKindpbkCode128, pbkQr, pbkDataMatrix, pbkPdf417
TPdfPortfolioFieldTypeppftText, ppftNumber, ppftDate, ppftFileName, ppftDescription, ppftSize, ppftModDate, ppftCreationDate

色彩轉換宣告

可選用的 LittleCMS 提供者實作緩衝區轉換介面,FPdfDocumentColour 則將其套用於原始文件運算子與影像分量,並明確回報是否完整

宣告公開欄位或成員
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 宣告

宣告公開欄位或成員
TPdfGlyphInfoGlyphID: Cardinal, UnicodeValue: Cardinal, Width: Integer
TPdfGlyphInfosTPdfGlyphInfo 的動態陣列
TPdfFontSubsetOptionsMaxFontBytes: Integer, MaxGlyphs: Integer, MinimumSavingPercent: Integer, 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 的動態陣列

樣式化取代與 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 宣告

宣告公開欄位或成員
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
TPdfPortfolioValuesTPdfPortfolioValue 的動態陣列
TPdfPortfolioItemFileName: string, Description: string, Values: TPdfPortfolioValues, EmbeddedData: TBytes
TPdfPortfolioItemsTPdfPortfolioItem 的動態陣列
TPdfPortfolioFields: TPdfPortfolioFields, Items: TPdfPortfolioItems, SortField: string, SortAscending: Boolean

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將已驗證的來源緩衝區轉換為要求的色彩空間與描述檔
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傳回有界的字型與字形限制,並含最小節省門檻

頂層常式

宣告說明
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建置排序過的唯一字形閉包,且只有在子集有效並更小時才接受
function ParsePdfSvgPath(const Data: string; MaxCommands: Integer = 100000): TPdfSvgPathCommands剖析有界的移動、直線、三次、二次與關閉命令,並支援相對座標
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 葉繫結,同時保留每個未更動的 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 向量,並將二維條碼制委派給提供者
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 檢視
function ExtractPdfRichMediaAssets(const Assets: TPdfRichMediaAssets; const OutputDirectory: string; MaxAssetBytes: Int64 = 256 * 1024 * 1024; MaxTotalBytes: Int64 = 1024 * 1024 * 1024): TPdfRichMediaExtractedArray寫入內嵌資產,而不執行內容、解析外部參考或允許目錄逃逸

FPdfBarcodeZXing 提供可選用的條碼產生與辨識提供者

安全模型

所有高流量 API 都會在配置或寫入輸出之前,強制執行呼叫端可見的限制

平台編解碼器、色彩引擎、字型子集器、規則運算式引擎、矩陣條碼程式庫與辨識器都是以明確介面呈現,讓主應用程式能選擇自己經過稽核的後端

FPdfStyledEdit 針對經驗證的來源快照執行這些計畫,支援預覽、字型重用或明確備援、有上限的尺寸調整,以及交易式儲存/重新開啟驗證