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 字典欄位的單一快照
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 讀取第二個 /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;
供結構樹 marked-content 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 使用每英吋 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;
供朗讀工作流程與 TPdfReadingSession 使用的語音區塊與來源對應
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