PDFium Component Docs

TPdf component

Enhed: PDFium
TPdf
Use TPdf component to open, navigate, extract text, and edit PDF documents

Eksempel

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

Typer

type TBookmark = record
  Handle: FPDF_BOOKMARK;
  Title: WString;
  PageNumber: Integer;
  Action: TPdfAction;
  ActionPageNumber: Integer;
end;

type TBookmarks = array of TBookmark;

Bookmark data

 

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

Named destination data

 

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;

Link annotation data

 

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

Determines type of the PDF object

 

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

Determines how the PDF document should be displayed when opened

 

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

Bestemmer type of an action associated with a bookmark item

 

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;

Annotation data

 

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

type TPdfAnnotationFlags = set of TPdfAnnotationFlag;

Annotation flags

 

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);

Annotationens undertype

 

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

Bestemmer how layers are blended into each other

 

type TPdfDisplayMode = (dmSingleContinuous, dmTwoPageContinuous, dmTwoPageContinuousWithCover);

Determines how the PDF document pages are displayed

 

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

Feature of PDF document reported by OnUnsupportedFeature event

 

type TPdfFillMode = (fmNone, fmAlternate, fmWinding);

Bestemmer how fill areas are formed when path intersects itself

 

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

type TPdfFormFieldFlags = set of TPdfFormFieldFlag;

Form field flags

 

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;

Form field information

 

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

Bestemmer the type of the form field

 

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

Determines type of forms in the PDF document

 

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

Size in pixels and data of the PDF image object

 

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

Formen, der bruges ved enderne af åbne understier

 

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

Formen, der bruges ved hjørnerne af stier, der streges

 

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

Punkt med X- og Y-koordinater

 

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

Rektangelområde med Left-, Top-, Right- og Bottom-koordinater

 

type TPdfFileIdentifierType = (fidPermanent, fidChanging);

Trailer file identifier selector fidPermanent reads the first /ID entry and fidChanging reads the second /ID entry

 

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

Page dictionary box selector used by PageBox, GetPageBox, and SetPageBox

 

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

Data for dokumentniveauets JavaScript-navnetræ-handlinger

 

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

Information om digital signatur

 

type TPdfIntegerArray = array of Integer;

Integer array used by structure-tree marked-content ID lists

 

type TPdfSingleArray = array of Single;

Single-precision floating-point array used by tekst object character position setters

 

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

One-based print side ranges from the dokument viewer preferences

 

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;
end;

type TPdfStructureElements = array of TPdfStructureElement;

Flattened logical structure element data for tagged PDF pages

 

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

The version of a PDF file or an explicit SaveAs target. Possible values are: unknown version, PDF version 1.0 to 1.7. Explicit SaveAs targets from PDF 1.3 through PDF 1.7 are normalized and validated against the selected PDF version

 

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

Indstillinger for papirhåndtering ved udskrivning

 

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

Windows PDFium print output mode selected by SetPdfPrintMode

 

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

type TRenderOptions = set of TRenderOption;

Page rendering flags

 

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

The PDF page rotation. The page rotation is rotated clockwise

 

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

Determines how the PDF document will be saved

 

type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);

type TSearchOptions = set of TSearchOption;

Search flags

 

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

type TWebLinks = array of TWebLink;

URL information and boundaries for the web link

 

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

Wide string

 

Constants

const PointsPerInch: Integer = 72;

PDF uses points with a density of 72 points per inch

 

const FLAT_NORMALDISPLAY = 0;
const FLAT_PRINT = 1;

Flattening profiles passed to FlattenPage / FlattenAllPages FLAT_NORMALDISPLAY targets screen display; FLAT_PRINT targets printed output

 

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

Result codes returned by 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;

Sentence-level reading units used by tekst-to-speech and assistive listen-reading workflows

 

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

type TPdfWordBoxes = array of TPdfWordBox;

Word-level tekst ranges and side rectangles used by synchronized reading highlights

 

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

type TPdfSpokenSpans = array of TPdfSpokenSpan;

Mapped runs that translate speech-engine offsets back to PDF page text

 

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

type TPdfSpokenTexts = array of TPdfSpokenText;

Speech chunks and source mappings used by read-aloud workflows and TPdfReadingSession

 

type TPdfReadingSessionState = (pssIdle, pssSpeaking, pssPaused);

Playback state reported by TPdfReadingSession

 

Globale variabler

var LibraryName: string = 'pdfium.dll';

Name of the standard PDFium library used when EnableV8Engine is False. Can be changed before calling LoadLibrary

 

var EnableV8Engine: Boolean = False;

Angiver to True before loading to select pdfium.v8.dll from the matching Win32 or Win64 DLLs folder

 

Globale funktioner

Egenskaber

Metoder

Hændelser