PDFium Delphi Component Docs

TPdf bileşeni

Birim: PDFium
TPdf
PDF belgelerini açmak, içinde gezinmek, metin ayıklamak ve düzenlemek için TPdf bileşenini kullanın

Framework’ten bağımsız belge çekirdeği

VCL/LCL ya da Graphics bağımlılığı olmayan bir belge API’si için FPdfDocumentCore’u kullanın ya da mevcut bir bileşeni bağımsız, yalnızca RTL tabanlı bir snapshot’a köprülemek için TPdf.CreateCoreSnapshot’ı çağırın

Widget’sız klasik bileşen kişiliği

PDFIUMPAS_CORE_ONLY tanımını yaparak üst düzey belge API’sini VCL/LCL widget çerçevesi olmadan derleyin: TPdfView, TPdfReadingSession ve viewer yardımcıları dışlanır ve widget unit’leri (Forms, Controls, Dialogs, ExtCtrls, Menus, Messages) her iki derleyici kolunda da unit’in uses listesinden düşer; piksel tamponu render API’si için yalnızca Vcl.Graphics ya da LCL Graphics unit’i kalır

Varsayılan kişilik klasik API’yi korur; mevcut projeler değişmeden derlenir. Headless bir tüketici tanımı ekler ve yükleme, metin, düzenleme, kaydetme ve bitmap’e render işlemleri için doğrudan TPdf’i kullanır; CreateCoreSnapshot ayrıca etkin belgeyi bağımsız, sınırlı bir TPdfDocumentCore snapshot’ına aktarır

Headless farklılıkları açıktır: PDFium betikli form zamanlayıcıları kullanılamaz bildirir (pencere mesaj pompası yoktur), JavaScript prompt’ları iletişim kutusu olmadan betikteki varsayılan yanıtı döndürür, alert’ler ham Win32 mesaj kutusunu kullanır ve denetimin görsel özellikleri bulunmaz; etkisiz TPdfView stand-in’i, hiç örnek oluşturulmasa da form doldurma bağlantı kodunun derlenmesini sağlar

Örnek

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

Türler

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;
  Style: TPdfOutlineStyle;
end;

type TBookmarks = array of TBookmark;

Yer imi verileri

 

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;

Adlandırılmış hedef verileri

 

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

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

Hedef görünüm modu ve sıralı native parametreleri

 

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;

Bağlantı ek açıklaması verileri

 

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

type TPdfPermissions = set of TPdfPermission;

Native izin maskesinden çözülen, tiplendirilmiş belge izin bayrakları

 

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

Standart belge Info sözlüğü alanlarının bir anlık görüntüsü

 

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

PDF nesnesinin türünü belirler

 

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

PDF belgesinin açıldığında nasıl görüntüleneceğini belirler

 

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

Bir yer imi öğesiyle ilişkili eylemin türünü belirler

 

type TPdfAnnotation = record
  Subtype: TPdfAnnotationSubtype;
  Flags: TPdfAnnotationFlags;
  HasColor: Boolean;
  Color: TColor;
  ColorAlpha: Byte;
  HasInteriorColor: Boolean;
  InteriorColor: TColor;
  InteriorColorAlpha: Byte;
  HasAttachmentPoints: Boolean;
  AttachmentPoints: TQuadrilateralPoint;
  AttachmentPointSets: TQuadrilateralPoints;
  Rectangle: TPdfRectangle;
  HasContents: Boolean;
  ContentsText: WString;
  HasAuthor: Boolean;
  AuthorText: WString;
  HasName: Boolean;
  Name: WString;
  HasSubject: Boolean;
  Subject: WString;
  HasModificationDate: Boolean;
  ModificationDate: WString;
  HasCreationDate: Boolean;
  CreationDate: WString;
  HasIcon: Boolean;
  Icon: WString;
  HasOpacity: Boolean;
  Opacity: Double;
  HasLineEndpoints: Boolean;
  LineStart: TPdfPoint;
  LineEnd: TPdfPoint;
  HasVertices: Boolean;
  Vertices: array of TPdfPoint;
  HasInkList: Boolean;
  InkList: array of TPdfInkGesture;
  HasBorder: Boolean;
  BorderHorizontalRadius: Single;
  BorderVerticalRadius: Single;
  BorderWidth: Single;
  HasAppearanceNormal: Boolean;
  AppearanceNormal: WString;
  HasAppearanceRollover: Boolean;
  AppearanceRollover: WString;
  HasAppearanceDown: Boolean;
  AppearanceDown: WString;
  HasLinkUri: Boolean;
  LinkUri: WString;
end;

Ek açıklama verileri

 

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

type TPdfAnnotationFlags = set of TPdfAnnotationFlag;

Ek açıklama bayrakları

 

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

Ek açıklama alt türü

 

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

Katmanların birbiriyle nasıl harmanlanacağını belirler

 

type TPdfDisplayMode = (dmSingleContinuous, dmTwoPageContinuous, dmTwoPageContinuousWithCover);

PDF belge sayfalarının nasıl görüntüleneceğini belirler

 

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

OnUnsupportedFeature olayı tarafından bildirilen PDF belgesi özelliği

 

type TPdfFillMode = (fmNone, fmAlternate, fmWinding);

Yol kendisiyle kesiştiğinde dolgu alanlarının nasıl oluşacağını belirler

 

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

type TPdfFormFieldFlags = set of TPdfFormFieldFlag;

Form alanı bayrakları

 

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 alanı bilgisi

 

type TPdfFormFieldType = (fiUnknown, fiPushButton, fiCheckBox, fiRadioButton, fiComboBox, fiListBox, fiTextField, fiSignature, fiXfa, fiXfaCheckBox, fiXfaComboBox, fiXfaImageField, fiXfaListBox, fiXfaPushButton, fiXfaSignature, fiXfaTextField);

Form alanının türünü belirler

 

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

PDF belgesindeki formların türünü belirler

 

type TPdfImage = record
  Width: Integer;
  Height: Integer;
  Data: TBytes;
  RawData: TBytes;
  Filters: TPdfStringArray;
  HorizontalDpi: Single;
  VerticalDpi: Single;
  BitsPerPixel: LongWord;
  ColorSpace: Integer;
  MarkedContentId: Integer;
  IccProfile: TBytes;
end;

PDF görüntü nesnesinin piksel cinsinden boyutu ve verisi

 

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

Açık alt yolların uçlarında kullanılacak şekil

 

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

Konturu çizilen yolların köşelerinde kullanılacak şekil

 

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

X ve Y koordinatlı nokta

 

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

Left, Top, Right ve Bottom koordinatlı dikdörtgen alan

 

type TPdfFileIdentifierType = (fidPermanent, fidChanging);

Trailer dosya tanımlayıcı seçici. fidPermanent ilk /ID girişini, fidChanging ikinci /ID girişini okur

 

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

PageBox, GetPageBox ve SetPageBox tarafından kullanılan sayfa sözlüğü kutu seçici

 

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

Belge düzeyi JavaScript ad ağacı eylem verisi

 

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

Dijital imza bilgisi

 

type TPdfIntegerArray = array of Integer;

Yapı ağacı işaretli içerik ID listeleri tarafından kullanılan tamsayı dizisi

 

type TPdfSingleArray = array of Single;

Metin nesnesi karakter konum ayarlayıcıları tarafından kullanılan tek duyarlıklı kayan nokta dizisi

 

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

Belge görüntüleyici tercihlerinden alınan bir tabanlı yazdırma sayfa aralıkları

 

type TPdfStructureElement = record
  Level: Integer;
  ParentIndex: Integer;
  TypeName: WString;
  RawTypeName: 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;
  Attributes: TPdfStructureAttributeValues;
  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;
  AssociatedFileDeclaredInCatalog: Boolean;
  AssociatedFileDeclaredInStructure: Boolean;
  AssociatedFileInEmbeddedFilesNameTree: Boolean;
  AssociatedFileHasReadingOrder: Boolean;
  AssociatedFileReadingOrderIndex: Integer;
  AnnotationSubtype: WString;
  AnnotationContents: WString;
  AnnotationAlternateText: WString;
  IsArtifact: Boolean;
  WidgetCount: Integer;
  HasAppearance: Boolean;
  LabelText: WString;
  FieldAlternateName: WString;
end;

type TPdfStructureElements = array of TPdfStructureElement;

Etiketli PDF sayfaları için düzleştirilmiş mantıksal yapı öğesi verisi

 

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

Native form metni seçimi tarafından bildirilen, çağrıcıya ait tek sayfa-uzayı dikdörtgeni

 

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

Yinelemeli native yapı ağacı gezinmesi için kaynak bütçeleri

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

Yapı gezinme yöntemleri tarafından döndürülen tamamlama ve kırpma ayrıntıları

 

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

Bir PDF dosyasının veya açık bir SaveAs hedefinin sürümü. Olası değerler: bilinmeyen sürüm, PDF 1.0 ile 1.7 arası sürümler ve 2.0. PDF 1.3'ten PDF 2.0'a kadar olan açık SaveAs hedefleri normalize edilir ve seçilen PDF sürümüne göre doğrulanır

 

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

Yazdırma kâğıt işleme seçenekleri

 

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

SetPdfPrintMode tarafından seçilen Windows PDFium yazdırma çıktı modu

 

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

type TRenderOptions = set of TRenderOption;

Sayfa render bayrakları

 

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

PDF sayfa döndürmesi. Sayfa döndürmesi saat yönündedir

 

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

PDF belgesinin nasıl kaydedileceğini belirler

 

type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);

type TSearchOptions = set of TSearchOption;

Arama bayrakları

 

type TWebLink = record
  Url: WString;
  Rectangles: TPdfRectangles;
  StartCharIndex: Integer;
  CharCount: Integer;
end;

type TWebLinks = array of TWebLink;

Web bağlantısı için URL bilgisi ve sınırları

 

type WString = {$IFDEF FPC} WideString {$ELSE} string {$ENDIF};

Wide string

 

Sabitler

const PointsPerInch: Integer = 72;

PDF, inç başına 72 point yoğunlukla point birimini kullanır

 

const FLAT_NORMALDISPLAY = 0;
const FLAT_PRINT = 1;

FlattenPage / FlattenAllPages yöntemlerine geçilen düzleştirme profilleri. FLAT_NORMALDISPLAY ekran görüntülemesini, FLAT_PRINT yazdırılan çıktıyı hedefler

 

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

FlattenPage tarafından döndürülen sonuç kodları

 

type TPdfReadingUnit = record
  Text: WString;
  Kind: TPdfContentFragmentKind;
  HeadingLevel: Integer;
  Page: Integer;
  Rects: TPdfRectangles;
  FragmentIndex: Integer;
  SentenceIndex: Integer;
  IsAlternateText: Boolean;
  Language: WString;
  SourceFragment: TPdfContentFragment;
  TableContext: TPdfReaderTableContext;
  ListContext: TPdfReaderListContext;
  TextStartIndex: Integer;
end;

type TPdfReadingUnits = array of TPdfReadingUnit;

Metinden konuşmaya ve destekli dinleyerek okuma iş akışları tarafından kullanılan cümle düzeyi okuma birimleri

 

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

type TPdfWordBoxes = array of TPdfWordBox;

Eşzamanlı okuma vurguları tarafından kullanılan sözcük düzeyi metin aralıkları ve sayfa dikdörtgenleri

 

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

type TPdfSpokenSpans = array of TPdfSpokenSpan;

Konuşma motoru ofsetlerini PDF sayfa metnine geri çeviren eşlenmiş aralıklar

 

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

type TPdfSpokenTexts = array of TPdfSpokenText;

Sesli okuma iş akışları ve TPdfReadingSession tarafından kullanılan konuşma parçaları ve kaynak eşlemeleri

 

type TPdfReadingSessionState = (pssIdle, pssSpeaking, pssPaused);

TPdfReadingSession tarafından bildirilen oynatma durumu

 

Genel değişkenler

var LibraryName: string = 'pdfium.dll';

EnableV8Engine False olduğunda kullanılan standart PDFium kitaplığının adı. LoadLibrary çağrısından önce değiştirilebilir

 

var EnableV8Engine: Boolean = False;

Yüklemeden önce True yapılırsa eşleşen Win32 veya Win64 DLLs klasöründen pdfium.v8.dll seçilir

 

Genel işlevler

Özellikler

Yöntemler

Olaylar

Bağlı bir TPdf yok edildiğinde hayatta kalan view'ları devre dışı bırakır ve Pdf referanslarını temizler; daha önce edinilmiş native document ve page handle'ları artık kullanılmamalıdır