Description

PDFium Component Suite for FireMonkey

Copyright (c) 2014-2022 WINSOFT

Delphi and C++ Builder components for viewing, navigating, text extracting and editing PDF files.

Features

  • uses PDFium open-source PDF rendering engine
  • supports Windows, macOS, Linux, iOS and Android
  • available for Delphi/C++ Builder XE2 - 11.1
  • source code included in registered version
  • royalty free distribution in applications
Version 6.2
added macOS ARM files
added Angle parameter to TFPdf.AddText method
Version 6.1
updated to the latest PDFium revision
added Linux files
Version 6.0
updated to the latest PDFium revision
Version 5.9
added Delphi/C++ Builder 11 files
Version 5.8
updated to the latest PDFium revision
added Buffered parameter to TFPdf.LoadDocument methods
added TPdfSignature record
added TFPdf.Signature property
added TFPdf.SignatureCount property
Version 5.7
updated to the latest PDFium revision
added TPdfFormFieldType enumeration
added TFPdfFormFieldInfo record
added TFPdf.FormFieldAt property
added TFPdf.FormFieldInfo property
added TFPdf.FormFieldInfoAt property
added TFPdf.HasFormFieldAt property
added TFPdf.Thumbnail property
added TFPdfView.FormFieldAt property
added TFPdfView.FormFieldInfo property
added TFPdfView.FormFieldInfoAt property
added TFPdfView.HasFormFieldAt property
added TFPdfView.Thumbnail property
added TFPdfView.AddJpegImage method
added alpha color support to AddPicture methods
removed TFPdf.FormFieldFlags property
removed TFPdfView.FormFieldFlags property
removed iOS files for Delphi XE8
bug fixes and improvements
Version 5.6
updated to the latest PDFium revision
bug fixes and improvements
Version 5.5
added Delphi/C++ Builder 10.4 files
Version 5.4
added fast rendering with unlimited zoom
added TFPdf.RenderTile methods
added TFPdfView.RenderTile methods
added PointsPerInch constant
added PointsToInches function
added PointsToPixels function
added PixelsToInches function
added PixelsToPoints function
removed TFPdfView.Cache property
improved demo examples
Version 5.3
updated to the latest PDFium revision
bug fixes
Version 5.2
updated to the latest PDFium revision
added Android 64-bit files
Version 5.1
updated to the latest PDFium revision
added macOS 64-bit files
added ActionPath item to TLinkAnnotation record
removed macOS 32-bit files
removed iOS Simulator 32-bit files
improved Viewer demo example
Android library isn't included in this version
bug fixes
Version 5.0
updated to the latest PDFium revision
added TFPdfView.LinkAnnotationAtPos method
added seConsecutive to TSearchOption enumeration
improved PDF Viewer demo example
minor bugfixes and improvements
Version 4.9
updated to the latest PDFium revision
added TPdfAnnotationFlag enumeration
added TPdfAnnotationFlags set
added Flags field to TPdfAnnotation record
added HasColor field to TPdfAnnotation record
added HasInteriorColor field to TPdfAnnotation record
added ContentsText field to TPdfAnnotation record
added AuthorText field to TPdfAnnotation record
added XFA support
added PDFium XFA DLL libraries (Windows only)
added TFPdf.XFA property
added Extract Text demo example
changed libapdfium.so Android library to libpdfium.a
bugfixes
Version 4.8
added Delphi/C++ Builder 10.3 files
removed 32-bit iOS files
Android library isn't included in this version
Version 4.7
updated to the latest PDFium revision
added TPdfFormType enumeration
added TFPdf.CharacterOrigin property
added TFPdf.FormType property
added TFPdf.IsTagged property
added TFPdf.ObjectBitmap property
added TFPdf.ObjectTransparent property
added TFPdf.DeleteAnnotation method
added TFPdf.ReloadPage method
added TFPdf.OnFormFieldEnter event
added TFPdf.OnFormFieldExit event
added TFPdfView.Annotation property
added TFPdfView.AnnotationCount property
added TFPdfView.CharacterOrigin property
added TFPdfView.ObjectBitmap property
added TFPdfView.ObjectTransparent property
added TFPdfView.CreateAnnotation method
added TFPdfView.DeleteAnnotation method
added TFPdfView.ReloadPage method
deleted ContentsText from TPdfAnnotation record
deleted AuthorText from TPdfAnnotation record
Android library isn't included in this version
Version 4.6
updated to the latest PDFium revision
changed TFPdf.AddText coordinates Left, Top to X, Y
changed TFPdf.AddPicture coordinates Left, Top to X, Y
changed TFPdfView.AddPicture coordinates Left, Top to X, Y
added TFPdf.AddJpegImage method
added TPdfLineCap enumeration
added TPdfLineJoin enumeration
added TPdfBlendMode enumeration
added LineCap parameter to CreatePath method
added LineJoin parameter to CreatePath method
added BlendMode parameter to CreatePath method
added Color parameter to AddText method
added TFPdfAnnotationSubtype enumeration
added TFPdfAnnotation record
added TFPdf.AnnotationCount property
added TFPdf.Annotation property
added TFPdf.CreateAnnotation method
added TFPdf.HasBookmarkChildren property
added new demo examples
iOS and Android libraries aren't included in this version
Version 4.5
added Delphi/C++ Builder 10.2 files
added TFPdfView.Cache property
copying libc++.dylib is unneeded
improved demo example
Version 4.4
updated to the latest PDFium revision
added TPdfFillType enumeration
added TFPdf.AddPath method
added TFPdf.AddText method
added TFPdf.BezierTo method
added TFPdf.ClosePath method
added TFPdf.CreatePath method
added TFPdf.LineTo method
added TFPdf.MoveTo method
added TFPfView.Color property
Version 4.3
updated to the latest PDFium revision
added iOS64 support
bug fixes
Version 4.2
updated to the latest PDFium revision
corrected MetaText retrieving
added TFPdf.ViewerPreference property
added HasX, X, HasY, Y, HasZoom, Zoom items to TDestination structure
bug fixes
Version 4.1
updated to the latest PDFium revision
added TFPdf.PageLabel property
added TFPdfView.PageLabel property
Version 4.0
updated to the latest PDFium revision
added PDF form fill support
added TPdfFeature enumeration
added TFPdf.FormHandle property
added TFPdf.FormFill property
added TFPdf.RenderPage method to existing Bitmap
added TFPdf.OnUnsupportedFeature event
added TFPdfView.RenderPage method to existing Bitmap
added Windows XP compatibility
added Merge demo example
changed TFPdfView.PageNumber default value to 1
corrected blurred rendering
bug fixes
Version 3.0
updated to the latest PDFium revision
renamed TPoint to TPdfPoint
added TFPdf.LoadDocument(Data: TMemoryStream) method
added TFPdf.ObjectBounds property
added TFPdfView.ObjectBounds property
added DecodeDate function
improved PDFium viewer demo example
Version 2.9
added Delphi/C++ Builder 10.1 files
Version 2.8
updated to the latest PDFium revision
added iOS32 support
renamed TRectangle to TPdfRectangle
renamed TRectangles to TPdfRectangles
Version 2.7
updated to the latest PDFium revision
minor bugfixes
renamed TAction to TPdfAction
renamed TFPdf.Rotation to TFPdf.PageRotation
added TFPdf.AddPicture method
added TFPdf.UpdatePage method
added TFPdf.Bitmap property
added TFPdf.BitmapCount property
added TFPdfView.Active property
added TFPdfView.PageNumber property
added TFPdfView.OnPageChange event
added TFPdfView.Bitmap property
added TFPdfView.BitmapCount property
added TFPdfView.Character property
added TFPdfView.CharacterCount property
added TFPdfView.CharacterRectangle property
added TFPdfView.Charcode property
added TFPdfView.Find property
added TFPdfView.FontSize property
added TFPdfView.Image property
added TFPdfView.ImageCount property
added TFPdfView.LinkAnnotation property
added TFPdfView.LinkAnnotationCount property
added TFPdfView.ObjectCount property
added TFPdfView.ObjectHandle property
added TFPdfView.ObjectType property
added TFPdfView.Page property
added TFPdfView.PageCount property
added TFPdfView.PageHeight property
added TFPdfView.PageRotation property
added TFPdfView.PageWidth property
added TFPdfView.Rectangle property
added TFPdfView.TextPage property
added TFPdfView.Transparent property
added TFPdfView.WebLink property
added TFPdfView.WebLinkCount property
added TFPdfView.AddPicture method
added TFPdfView.FindFirst method
added TFPdfView.FindNext method
added TFPdfView.FindPrevious method
added TFPdfView.RenderPage method
added TFPdfView.Text method
added TFPdfView.TextInRectangle method
added TFPdfView.UpdatePage method
Version 2.6
updated to the latest PDFium revision
added Delphi/C++ Builder 10 files
added TFPdf.WebLinkCount property
added TFPdf.WebLink property
added TFPdf.LinkAnnotationCount property
added TFPdf.LinkAnnotation property
added TFPdf.DestinationCount property
added TFPdf.Destination property
added TFPdf.DestinationByName property
added TFPdf.PrintCopies property
added TFPdf.PrintPaperHandling property
added TFPdfView.WebLinkAtPos method
added Settings dialog to demo example
added web links detection and activation to demo example
added zoom gesture to Android demo example
Version 2.4
updated to the latest PDFium revision
added text selection functionality to demo example
added TFPdf.Rectangle property
added TFPdf.RectangleCount method
added TFPdfView.Canvas property
added TFPdfView.DeviceToPage method
added TFPdfView.PageToDevice method
added TFPdfView.CharacterCount property
added TFPdfView.CharacterIndexAtPos method
added TFPdfView.CharacterRectangle property
added TFPdfView.Rectangle property
added TFPdfView.RectangleCount method
added TFPdfView.PaintSelection method
Version 2.3
updated to the latest PDFium revision
renamed TImage to TPdfImage
added reNoSmoothText to TRenderOption
added reNoSmoothImage to TRenderOption
added reNoSmoothPath to TRenderOption
added TBookmark.Handle item
added TBookmark.Title item
added TFPdf.Bookmarks property
added TFPdf.BookmarkChildren property
improved demo example
Version 2.2
updated to the latest PDFium revision
added Delphi/C++ Builder XE8 files
added TObjectType enumeration
added TImage record
added TFPdf.ObjectHandle property
added TFPdf.ObjectType property
added TFPdf.ImageCount property
added TFPdf.Image property
Version 2.1
updated to the latest PDFium revision
added TPdfVersion enumeration
added saNone to TSaveOption enumeration
added PdfVersion parameter to TFPdf.SaveAs methods
changed type of TFPdf.Version property to TPdfVersion
corrected bug in TFPdf.SaveAs methods
renamed libpdfium.so to libapdfium.so
Version 2.0
updated to the latest PDFium revision
added Android support
Version 1.3
updated to the latest PDFium revision
added macOS support
added Delphi/C++ Builder XE2 files
Version 1.2
updated to the latest PDFium revision
added Delphi/C++ Builder XE7 files
Version 1.1
updated to the latest PDFium revision
minor bugfixes
Version 1.0
first version of components


Installation

1. Start fpdfium.exe
2. TFPdf and TFPdfView components will be added to PDFium palette


Contact and ordering

Trial version is free and fully featured. The only limitation is a dialog box with registering information.

Unlimited version you receive by e-mail after registration and payment. Go to https://www.winsoft.sk for price and registering information.


Disclaimer

DISCLAIMER OF WARRANTY

SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. WINSOFT DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR ANY PURPOSE. WINSOFT ASSUMES NO LIABILITY FOR DAMAGES, DIRECT OR CONSEQUENTIAL, WHICH MAY RESULT FROM THE USE OF SOFTWARE.


TFPdf

Unit

Winsoft.FireMonkey.PDFium

Description

Use TFPdf component to open, navigate, extract text and edit PDF documents.

Example

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

Types

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

type TBookmarks = array of TBookmark;

Bookmark data.

type TDestination = record
Handle: FPDF_DEST;
Name: string;
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: string;
Points: array of TQuadrilateralPoint;
end;

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.

  • pmNone - neither document outline nor thumbnail images visible
  • pmOutline - document outline visible
  • pmThumbs - thumbnail images visible
  • pmFullScreen - full-screen mode, with no menu bar, window controls, or any other window visible
  • pmOptionalContentGroup - optional content group panel visible
  • pmAttachments - attachments panel visible
  • pmUnknown - unknown page mode

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

Determines type of an action associated with a bookmark item.

  • acUnsupported - unsupported action type
  • acGoto - go to a destination within current document
  • acGotoRemote - go to a destination within another document
  • acUri - Universal Resource Identifier, including web pages and other internet based resources
  • acLaunch - launch an application or open a file

type TPdfAnnotation = record
Subtype: TPdfAnnotationSubtype;
Flags: TPdfAnnotationFlags;
HasColor: Boolean;
Color: TAlphaColor;
HasInteriorColor: Boolean;
InteriorColor: TAlphaColor;
HasAttachmentPoints: Boolean;
AttachmentPoints: TQuadrilateralPoint;
Rectangle: TPdfRectangle;
ContentsText: string;
AuthorText: string;
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);

The annotation subtype.

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

Determines how layers are blended into each other.

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

Determines how fill areas are formed when path intersects itself, i.e. no fill, even-odd parity rule or nonzero winding rule.

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

type TPdfFormFieldFlags = set of TPdfFormFieldFlag;

Form field flags.

type TPdfFormFieldInfo = record
Name: string;
FieldType: TPdfFormFieldType;
Flags: TPdfFormFieldFlags;
OptionLabels: array of string;
OptionSelected: array of Boolean;
FontSize: Single;
Checked: Boolean;
ExportValue: string;
GroupCount: Integer;
GroupIndex: Integer;
end;

Form field information.

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

Determines the type of the form field.

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

Determines type of forms in the PDF document.

  • ftUnknown - unknown form types
  • ftNone - no forms in document
  • ftAcroForm - forms are specified using AcroForm specification
  • ftXfaFull - forms are specified using the entire XFA specification
  • ftXfaForeground - forms are specified using the XFAF subset of XFA specification

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

The shape to be used at the ends of open subpaths.

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

The shape to be used at the corners of paths that are stroked.

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

Rectangle area with Left, Top, Right and Bottom coordinates.

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

PDF signature information.

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

The version of PDF file. Possible values are: unknown version, PDF version 1.0, PDF version 1.1, ...

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

The paper handling option to be used when printing.

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

type TRenderOptions = set of TRenderOption;

Page rendering flags.

  • reAnnotations - render annotations
  • reLcd - text rendering optimized for LCD display
  • reNoNativeText - don't use the native text output available on some platforms
  • reGrayscale - grayscale output
  • reDebugInfo - set if you want to get some debug info
  • reNoCatchException - set if you don't want to catch exception
  • reLimitCache - limit image cache size
  • reHalftone - always use halftone for image stretching
  • rePrinting - render for printing
  • reReverseByteOrder - render in a reverse byte order; this flag only enable when render to a bitmap
  • reNoSmoothText - disable anti-aliasing on text
  • reNoSmoothImage - disable anti-aliasing on images
  • reNoSmoothPath - disable anti-aliasing on paths

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

The PDF page rotation. The page rotation is rotated clockwise.

  • ro0 - no page rotation
  • ro90 - page rotation 90 degrees clockwise
  • ro180 - page rotation 180 degrees clockwise
  • ro270 - page rotation 270 degrees clockwise

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

Save options.

  • saNone - no option specified
  • saIncremental - incremental
  • saNoIncremental - no incremental
  • saRemoveSecurity - remove security

type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);

type TSearchOptions = set of TSearchOption;

Search flags.

  • seCaseSensitive - match case
  • seWholeWord - match the whole word
  • seConsecutive - don't skip past the current match to look for the next match

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

URL information and boundaries for the web link.

Constants

const PointsPerInch: Integer = 72;

PDF uses points with density 72 points per inch.

Functions

function DecodeDate(const Value: string; var DateTime: TDateTime; var DateTimeOffset: Integer): Boolean;

Converts PDF date format to DateTime and DateTimeOffset. DateTimeOffset contains date/time offset (in minutes) to Coordinated Universal Time (UTC).

function PixelsToInches(Pixels, PixelsPerInch: Double): Double;

Converts pixels to inches.

function PixelsToPoints(Pixels, PixelsPerInch: Double): Double;

Converts pixels to PDF points.

function PointsToInches(Points: Double): Double;

Converts PDF points to inches.

function PointsToPixels(Points: Double; PixelsPerInch: Double): Double;

Converts PDF points to pixels.

Properties

property About: string; // read only

Version, copyright and contact information.

property Active: Boolean;

Opens or closes the selected PDF document.

property Annotation[Index: Integer]: TPdfAnnotation;

Retrieves or sets the specified annotation in the current PDF page. Index value has to be 0 to AnnotationCount - 1.

property AnnotationCount: Integer; // read only

The number of annotations in the current PDF page.

property Author: string; // read only

Author retrieved from PDF document metadata.

property Bitmap[Index: Integer]: TBitmap; // read only

Bitmap data of the specified PDF image object. Index value has to be 0 to BitmapCount - 1. Returned bitmap has to be manually released.

property BitmapCount: Integer; // read only

Number of PDF image objects inside the PDF page.

property Bookmark[const Title: string]: TBookmark; // read only

Returns a bookmark in the document, using the bookmark title.

property BookmarkChildren[const Bookmark: TBookmark]: TBookmarks; // read only

Returns child bookmarks for the specified bookmark in the document.

property Bookmarks: TBookmarks; // read only

Returns top level bookmarks in the document.

property Character[Index: Integer]: WideChar; // read only

Returns the specified character in a page. Index value has to be 0 to CharacterCount - 1.

property CharacterCount: Integer; // read only

Number of characters in a page.

property CharacterOrigin[Index: Integer]: TPdfPoint; // read only

Origin of a particular character in a page. Index value has to be 0 to CharacterCount - 1.

property CharacterRectangle[Index: Integer]: TPdfRectangle; // read only

Bounding box of a particular character in a page. Index value has to be 0 to CharacterCount - 1.

property Charcode[Index: Integer]: WideChar; // read only

Returns the specified character code in a page. Index value has to be 0 to CharacterCount - 1.

property CreationDate: string; // read only

Creation date retrieved from PDF document metadata.

property Creator: string; // read only

Creator retrieved from PDF document metadata.

property Destination[Index: Integer]: TDestination; // read only

Data for the selected named destination. Index value has to be 0 to DestinationCount - 1.

property DestinationByName[const Name: string]: TDestination; // read only

Data for the selected named destination.

property DestinationCount: Integer; // read only

Number of named destinations in the PDF document.

property Document: FPDF_DOCUMENT; // read only

PDF document handle.

property Find: FPDF_SCHHANDLE; // read only

PDF document search handle.

property FileName: string;

Name of the PDF file.

property FontSize[Index: Integer]: Double; // read only

Font size of a particular character in a page. Index value has to be 0 to CharacterCount - 1.

property FormField[Index: Integer]: string;

Content of the specified PDF form field. Index value has to be 0 to FormFieldCount - 1.

property FormFieldCount: Integer; // read only

Number of form fields inside the PDF page.

property FormFieldAt[X, Y: Single]: string;

Content of the specified PDF form field. X and Y are PDF coordinates.

property FormFieldInfo[Index: Integer]: TPdfFormFieldInfo; // read only

Features of the specified PDF form field. Index value has to be 0 to FormFieldCount - 1.

property FormFieldInfoAt[X, Y: Single]: TPdfFormFieldInfo; // read only

Features of the specified PDF form field. X and Y are PDF coordinates.

property FormFill: Boolean;

Enables PDF form fill functionality.

property FormHandle: FPDF_FORMHANDLE; // read only

PDF from handle.

property FormType: TPdfFormType; // read only

Type of forms contained in the PDF document.

property HasBookmarkChildren[const Bookmark: TBookmark]: Boolean; // read only

Returns true if the specified bookmark has child bookmarks.

property HasFormFieldAt[X, Y: Single]: Boolean; // read only

Determines whether a form field is located at given location. X and Y are PDF coordinates.

property Image[Index: Integer]: TPdfImage; // read only

Size in pixels and data of the specified PDF image object. Index value has to be 0 to ImageCount - 1.

property ImageCount: Integer; // read only

Number of PDF image objects inside the PDF page.

property IsTagged: Boolean; // read only

Determines if the PDF document is a tagged PDF document.

property Keywords: string; // read only

Keywords retrieved from PDF document metadata.

property LinkAnnotation[Index: Integer]: TLinkAnnotation; // read only

Annotation data for the selected link annotation. Index value has to be 0 to LinkAnnotationCount - 1.

property LinkAnnotationCount: Integer; // read only

Number of link annotations in the current PDF page.

property MetaText[const Tag: string]: string; // read only

Text from metadata of the PDF document.

property ModifiedDate: string; // read only

Modified date retrieved from PDF document metadata.

property ObjectBitmap[Index: Integer]: TBitmap; // read only

Bitmap rasterisation of the specified PDF object or nil if the specific PDF object isn't an image object. Index value has to be 0 to ObjectCount - 1. Returned bitmap has to be manually released.

property ObjectBounds[Index: Integer]: TPdfRectangle; // read only

Boundaries of the specified PDF object. Index value has to be 0 to ObjectCount - 1.

property ObjectCount: Integer; // read only

Number of PDF objects inside the PDF page.

property ObjectHandle[Index: Integer]: Pointer; // read only

Handle of the specified PDF object. Index value has to be 0 to ObjectCount - 1.

property ObjectTransparent[Index: Integer]: Boolean; // read only

Determines whether the specified PDF object contains transparency. Index value has to be 0 to ObjectCount - 1.

property ObjectType[Index: Integer]: TObjectType; // read only

Type of the specified PDF object. Index value has to be 0 to ObjectCount - 1.

property Page: FPDF_PAGE; // read only

PDF document page handle.

property PageBounds: TPdfRectangle; // read only

The bounding box of the page. This is the intersection between its media box and crop box.

property PageCount: Integer; // read only

Total number of pages in a document.

property PageHeight: Double; // read only

Page height (excluding non-displayable area) measured in points. One point is 1/72 inch.

property PageLabel[PageNumber: Integer]: string; // read only

Page label for the specified page. PageNumber value has to be 1 to PageCount.

property PageMode: TPageMode; // read only

How the document should be displayed when opened.

property PageNumber: Integer;

Currently selected page. PageNumber value has to be 1 to PageCount.

property PageRotation: TRotation;

The initial PDF page rotation. The PDF page rotation is rotated clockwise.

property PageWidth: Double; // read only

Page width (excluding non-displayable area) measured in points. One point is 1/72 inch.

property Password: string;

Password for PDF file.

property PdfVersion: TPdfVersion; // read only

PDF version of the PDF document.

property Permissions: LongWord; // read only

Permission flags of the PDF document. If the document is not protected, $ffffffff will be returned.

property PrintCopies: Integer; // read only

Number of copies to be printed.

property PrintPaperHandling: TPrintPaperHandling; // read only

The paper handling option to be used when printing.

property PrintScaling: Boolean; // read only

Whether the PDF document prefers to be scaled or not.

property Producer: string; // read only

Producer retrieved from PDF document metadata.

property Rectangle[Index: Integer]: TPdfRectangle; // read only

Get a rectangular area of the selected rectangle from the result generated by the RectangleCount function. Index value has to be 0 to RectangleCount - 1.

property Signature[Index: Integer]: TPdfSignature; // read only

Get the specified signature. Index value has to be 0 to SignatureCount - 1.

property SignatureCount: Integer; // read only

Total number of signatures in the PDF document.

property Subject: string; // read only

Subject retrieved from PDF document metadata.

property TextPage: FPDF_TEXTPAGE; // read only

PDF document page text handle.

property Thumbnail: TBitmap; // read only

Page thumbnail or nil if thumbnail isn't available. Returned bitmap has to be manually released.

property Title: string; // read only

Title retrieved from PDF document metadata.

property Transparent: Boolean; // read only

Check whether the content of specified PDF page contains transparency.

property ViewerPreference[const Key: string]: string; // read only

Content of viewer preference with a given key.

property WebLink[Index: Integer]: TWebLink; // read only

URL information and boundaries for the selected web link. Index value has to be 0 to WebLinkCount - 1.

property WebLinkCount: Integer; // read only

Number of detected web links.

property XFA: Boolean; // read only

Determines whether pdfium.dll supports XFA.

Methods

function AddJpegImage(JpegImage: TStream; X, Y, Width, Height: Double): Boolean;

Add JPEG image to the current PDF page using the specified coordinates.

procedure AddPage(PageNumber: Integer; Width, Height: Double);

Construct an empty page.

procedure AddPath;

Add created path to the current PDF page.

procedure AddPicture(Bitmap: TBitmap; X, Y: Double);

Add picture to the current PDF page using the specified coordinates.

procedure AddPicture(Bitmap: TBitmap; X, Y, Width, Height: Double);

Add picture to the current PDF page using the specified coordinates.

procedure AddText(const Text, Font: string; FontSize: Single; Left, Top: Double);

Add text to the current PDF page at the specified position.

procedure BezierTo(X1, Y1, X2, Y2, X3, Y3: Single);

Add a cubic Bezier curve to the given path, starting at the current point, using specified control points.

function CharacterIndexAtPos(X, Y, ToleranceX, ToleranceY: Double): Integer;

Get the index of a character at or nearby a certain position on the page. If there is no character at or nearby the point, return value will be -1. If an error occurs, -3 will be returned.

procedure ClosePath;

Add a line between the current point and the initial point of the subpath, thus terminating the current subpath.

procedure CreateAnnotation(const Annotation: TPdfAnnotation);

Create a new annotation.

procedure CreateDocument;

Create a new PDF document.

procedure CreatePath(X, Y: Single; FillMode: TPdfFillMode = fmAlternate; FillColor: TAlphaColor = TAlphaColorRec.Black; Stroke: Boolean = True; StrokeColor: TAlphaColor = TAlphaColorRec.Black; StrokeWidth: Single = 1.0; LineCap: TPdfLineCap = lcDefault; LineJoin: TPdfLineJoin = ljDefault; BlendMode: TPdfBlendMode = bmDefault);

Create a new path object at an initial position.

procedure CreatePath(X, Y, Width, Height: Single; FillMode: TPdfFillMode = fmAlternate; FillColor: TAlphaColor = TAlphaColorRec.Black; Stroke: Boolean = True; StrokeColor: TAlphaColor = TAlphaColorRec.Black; StrokeWidth: Single = 1.0; LineCap: TPdfLineCap = lcDefault; LineJoin: TPdfLineJoin = ljDefault; BlendMode: TPdfBlendMode = bmDefault);

Create a new closed path consisting of a specified rectangle.

procedure DeleteAnnotation(Index: Integer);

Delete the specified annotation in the current PDF page. Index value has to be 0 to AnnotationCount - 1.

procedure DeletePage(PageNumber: Integer);

Delete the specified PDF page.

function DeviceToPage(X, Y, Left, Top, Width, Height: Integer; Rotation: TRotation; out PageX, PageY: Double): Boolean;

Convert the screen coordinate of a point to page coordinate.

function FindFirst(const Text: string; Options: TSearchOptions = []; StartIndex: Integer = 0; DirectionUp: Boolean = True): Integer;

Start a search of the specified text. StartIndex is 0-based, -1 is for end of the page. DirectionUp parameter determines direction of this search operation.

function FindNext: Integer;

Search in the direction from page start to end. Return text position, or -1 if text was not found. Search must be initiated with FindFirst function.

function FindPrevious: Integer;

Search in the direction from page end to start. Return text position, or -1 if text was not found. Search must be initiated with FindFirst function.

function ImportPages(Pdf: TFPdf; const Range: string; PageNumber: Integer = 1): Boolean;

Import pages from the specified PDF document. Range parameter determines the pages to be imported, such as '1,3,5-7'. PageNumber parameter is the page number to insert from.

function ImportPreferences(Pdf: TFPdf): Boolean;

Copy the viewer preferences from the specified PDF document.

procedure LineTo(X, Y: Single);

Add a line between the current point and a new point in the path.

procedure LoadDocument(Data: Pointer; Size: Integer; Buffered: Boolean = True);

Open and load a PDF document from memory. If Buffered parameter is False then memory data must remain valid until the document is closed.

procedure LoadDocument(const Data: TBytes; Buffered: Boolean = True);

Open and load a PDF document from memory. If Buffered parameter is False then memory data must remain valid until the document is closed.

procedure LoadDocument(Data: TMemoryStream; Buffered: Boolean = True);

Open and load a PDF document from memory. If Buffered parameter is False then memory data must remain valid until the document is closed.

procedure MoveTo(X, Y: Single);

Move a path's current point to the specific position.

function PageToDevice(PageX, PageY: Double; Left, Top, Width, Height: Integer; Rotation: TRotation; out X, Y: Integer): Boolean;

Convert the page coordinate of a point to screen coordinate.

function RectangleCount(StartIndex: Integer = 0; Count: Integer = MaxInt): Integer;

Count number of rectangular areas occupied by a segment of texts. Function automatically merge small character boxes into bigger one if those characters are on the same line and use same font settings.

procedure ReloadPage;

Reloads contents of a page.

procedure RenderPage(DeviceContext: HDC; Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []);

Render contents of a page to a device (screen, bitmap, or printer).

function RenderPage(Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TAlphaColor = TAlphaColorRec.White): TBitmap;

Render contents of a page to a new bitmap. Returned bitmap has to be manually released.

procedure RenderPage(Bitmap: TBitmap; Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TAlphaColor = TAlphaColorRec.White);

Render contents of a page to an existing bitmap.

function RenderTile(Left, Top, Width, Height, PageWidth, PageHeight: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TAlphaColor = TAlphaColorRec.White): TBitmap;

Render rectangular area of a page to a new bitmap. Returned bitmap has to be manually released.

procedure RenderTile(Bitmap: TBitmap; Left, Top, Width, Height, PageWidth, PageHeight: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TAlphaColor = TAlphaColorRec.White);

Render rectangular area of a page to an existing bitmap.

function SaveAs(Stream: TStream; Option: TSaveOption = saNone; PdfVersion: TPdfVersion = pvUnknown): Boolean;

Saves the copy of PDF document to the specified stream.

function SaveAs(const FileName: string; Option: TSaveOption = saNone; PdfVersion: TPdfVersion = pvUnknown): Boolean;

Saves the copy of PDF document to the specified file.

function Text(StartIndex: Integer = 0; Count: Integer = MaxInt): string;

Extract text string from the page. StartIndex and Count parameters determine characters to be extracted. StartIndex parameter is 0-based.

function TextInRectangle(Left, Top, Right, Bottom: Double): string;

Extract text within a rectangular boundary on the page.

function TextInRectangle(Rectangle: TPdfRectangle): string;

Extract text within a rectangular boundary on the page.

procedure UpdatePage;

Generate PDF page content of modified PDF page. Without calling this method, the changed PDF information will be lost.

Events

property OnFormFieldEnter: TPdfFormFieldEnterEvent;

type TPdfFormFieldEnterEvent = procedure(Sender: TObject; const Text: string) of object;

Write OnFormFieldEnter event handler to take specific actions when the form field is getting a focus.

property OnFormFieldExit: TNotifyEvent;

Write OnFormFieldExit event handler to take specific actions when the form field is losing a focus.

property OnPageChange: TNotifyEvent;

Write OnPageChange event handler to take specific actions when the current PDF page was changed.

property OnUnsupportedFeature: TPdfUnsupportedFeatureEvent;

type TPdfUnsupportedFeatureEvent = procedure(Sender: TObject; Feature: TPdfFeature) of object;

Occurs on unsupported PDF feature.


TFPdfView

TPdfView

Unit

Winsoft.FireMonkey.PDFium

Description

Use TFPdfView component to view PDF pages.

Types

type TLinkAnnotation = record
Handle: FPDF_LINK;
Rectangle: TPdfRectangle;
PageNumber: Integer;
Action: TPdfAction;
ActionPageNumber: Integer;
ActionPath: string;
Points: array of TQuadrilateralPoint;
end;

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 TPdfImage = record
Width: Integer;
Height: Integer;
Data: TBytes;
end;

Size in pixels and data of the PDF image object.

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

type TRenderOptions = set of TRenderOption;

Page rendering flags.

  • reAnnotations - render annotations
  • reLcd - text rendering optimized for LCD display
  • reNoNativeText - don't use the native text output available on some platforms
  • reGrayscale - grayscale output
  • reDebugInfo - set if you want to get some debug info
  • reNoCatchException - set if you don't want to catch exception
  • reLimitCache - limit image cache size
  • reHalftone - always use halftone for image stretching
  • rePrinting - render for printing
  • reReverseByteOrder - render in a reverse Byte order; this flag only enable when render to a bitmap
  • reNoSmoothText - disable anti-aliasing on text
  • reNoSmoothImage - disable anti-aliasing on images
  • reNoSmoothPath - disable anti-aliasing on paths

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

The PDF page rotation. The page rotation is rotated clockwise.

  • ro0 - no page rotation
  • ro90 - page rotation 90 degrees clockwise
  • ro180 - page rotation 180 degrees clockwise
  • ro270 - page rotation 270 degrees clockwise

type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);

type TSearchOptions = set of TSearchOption;

Search flags.

  • seCaseSensitive - match case
  • seWholeWord - match the whole word
  • seConsecutive - don't skip past the current match to look for the next match

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

URL information and boundaries for the web link.

Properties

property About: string; // read only

Version, copyright and contact information.

property Active: Boolean;

Opens or closes the selected PDF page.

property Annotation[Index: Integer]: TPdfAnnotation;

Retrieves or sets the specified annotation in the PDF page. Index value has to be 0 to AnnotationCount - 1.

property AnnotationCount: Integer; // read only

The number of annotations in the PDF page.

property Bitmap[Index: Integer]: TBitmap; // read only

Bitmap data of the specified PDF image object. Index value has to be 0 to BitmapCount - 1.

property BitmapCount: Integer; // read only

Number of PDF image objects inside the PDF page.

property Character[Index: Integer]: WideChar; // read only

Returns the specified character in a page. Index value has to be 0 to CharacterCount - 1.

property CharacterCount: Integer; // read only

Number of characters in a page.

property CharacterOrigin[Index: Integer]: TPoint; // read only

Origin of a particular character in a page. Index value has to be 0 to CharacterCount - 1.

property CharacterRectangle[Index: Integer]: TRect; // read only

Bounding box of a particular character in a page. Index value has to be 0 to CharacterCount - 1.

property Charcode[Index: Integer]: WideChar; // read only

Returns the specified character code in a page. Index value has to be 0 to CharacterCount - 1.

property Color: TAlphaColor;

Background color.

property Find: FPDF_SCHHANDLE; // read only

PDF document search handle.

property FontSize[Index: Integer]: Double; // read only

Font size of a particular character in a page. Index value has to be 0 to CharacterCount - 1.

property FormField[Index: Integer]: string;

Content of the specified PDF form field. Index value has to be 0 to FormFieldCount - 1.

property FormFieldCount: Integer; // read only

Number of form fields inside the PDF page.

property FormFieldAt[X, Y: Integer]: string;

Content of the specified PDF form field. X and Y are screen coordinates.

property FormFieldInfo[Index: Integer]: TPdfFormFieldInfo; // read only

Features of the specified PDF form field. Index value has to be 0 to FormFieldCount - 1.

property FormFieldInfoAt[X, Y: Integer]: TPdfFormFieldInfo; // read only

Features of the specified PDF form field. X and Y are screen coordinates.

property HasFormFieldAt[X, Y: Integer]: Boolean; // read only

Determines whether a form field is located at given location. X and Y are screen coordinates.

property Image[Index: Integer]: TPdfImage; // read only

Size in pixels and data of the specified PDF image object. Index value has to be 0 to ImageCount - 1.

property ImageCount: Integer; // read only

Number of PDF image objects inside the PDF page.

property LinkAnnotation[Index: Integer]: TLinkAnnotation; // read only

Annotation data for the selected link annotation. Index value has to be 0 to LinkAnnotationCount - 1.

property LinkAnnotationCount: Integer; // read only

Number of link annotations in the current PDF page.

property ObjectBitmap[Index: Integer]: TBitmap; // read only

Bitmap rasterisation of the specified PDF object or nil if the specific PDF object isn't an image object. Index value has to be 0 to ObjectCount - 1.

property ObjectBounds[Index: Integer]: TPdfRectangle; // read only

Boundaries of the specified PDF object. Index value has to be 0 to ObjectCount - 1.

property ObjectCount: Integer; // read only

Number of PDF objects inside the PDF page.

property ObjectHandle[Index: Integer]: Pointer; // read only

Handle of the specified PDF object. Index value has to be 0 to ObjectCount - 1.

property ObjectTransparent[Index: Integer]: Boolean; // read only

Determines whether the specified PDF object contains transparency. Index value has to be 0 to ObjectCount - 1.

property ObjectType[Index: Integer]: TObjectType; // read only

Type of the specified PDF object. Index value has to be 0 to ObjectCount - 1.

property Options: TRenderOptions;

Rendering options. See TRenderOptions type for further details.

property Page: FPDF_PAGE; // read only

PDF document page handle.

property PageBounds: TPdfRectangle; // read only

The bounding box of the page. This is the intersection between its media box and crop box.

property PageCount: Integer; // read only

Total number of pages in a document.

property PageHeight: Double; // read only

Page height (excluding non-displayable area) measured in points. One point is 1/72 inch.

property PageLabel: string; // read only

Page label.

property PageNumber: Integer;

Currently selected page. PageNumber value has to be 1 to PageCount.

property PageRotation: TRotation;

The initial PDF page rotation. The PDF page rotation is rotated clockwise.

property PageWidth: Double; // read only

Page width (excluding non-displayable area) measured in points. One point is 1/72 inch.

property Pdf: TFPdf;

Specifies the PDF document to be displayed.

property Rectangle[Index: Integer]: TRect; // read only

Get a rectangular area of the selected rectangle from the result generated by the RectangleCount function. Index value has to be 0 to RectangleCount - 1.

property Rotation: TRotation;

The rotation of PDF page. See TRotation type for further details.

property TextPage: FPDF_TEXTPAGE; // read only

PDF document page text handle.

property Thumbnail: TBitmap; // read only

Page thumbnail or nil if thumbnail isn't available. Returned bitmap has to be manually released.

property Transparent: Boolean; // read only

Check whether the content of specified PDF page contains transparency.

property WebLink[Index: Integer]: TWebLink; // read only

URL information and boundaries for the selected web link. Index value has to be 0 to WebLinkCount - 1.

property WebLinkCount: Integer; // read only

Number of detected web links.

Methods

function AddJpegImage(JpegImage: TStream; X, Y, Width, Height: Integer): Boolean;

Add JPEG image to the current PDF page using the specified coordinates.

procedure AddPicture(Bitmap: TBitmap; X, Y, Width, Height: Integer);

Add picture to the current PDF page using the specified coordinates.

function CharacterIndexAtPos(X, Y: Integer; ToleranceX, ToleranceY: Double): Integer;

Get the index of a character at or nearby a certain position on the page. If there is no character at or nearby the point, return value will be -1. If an error occurs, -3 will be returned.

procedure CreateAnnotation(const Annotation: TPdfAnnotation);

Create a new annotation.

procedure DeleteAnnotation(Index: Integer);

Delete the specified annotation. Index value has to be 0 to AnnotationCount - 1.

function DeviceToPage(Rectangle: TRect): TPdfRectangle;

Convert the screen coordinate of a rectangle to page coordinate.

function DeviceToPage(X, Y; out PageX, PageY: Double): Boolean;

Convert the screen coordinate of a point to page coordinate.

function FindFirst(const Text: string; Options: TSearchOptions = []; StartIndex: Integer = 0; DirectionUp: Boolean = True): Integer;

Start a search of the specified text. StartIndex is 0-based, -1 is for end of the page. DirectionUp parameter determines direction of this search operation.

function FindNext: Integer;

Search in the direction from page start to end. Return text position, or -1 if text was not found. Search must be initiated with FindFirst function.

function FindPrevious: Integer;

Search in the direction from page end to start. Return text position, or -1 if text was not found. Search must be initiated with FindFirst function.

function LinkAnnotationAtPos(X, Y: Integer): Integer;

Get the index of an link annotation at a certain position on the page. If there is no annotation link at the point, return value will be -1.

function PageToDevice(Rectangle: TPdfRectangle): TRect;

Convert the page coordinate of a rectangle to screen coordinate.

function PageToDevice(PageX, PageY: Double; out X, Y: Integer): Boolean;

Convert the page coordinate of a point to screen coordinate.

procedure PaintSelection(SelectionStart, SelectionEnd: Integer; Color: TAlphaColor);

Paint the selected text area using the specified color.

function RectangleCount(StartIndex: Integer = 0; Count: Integer = MaxInt): Integer;

Count number of rectangular areas occupied by a segment of texts. Function automatically merge small character boxes into bigger one if those characters are on the same line and use same font settings.

procedure ReloadPage;

Reload contents of a page.

procedure RenderPage(DeviceContext: HDC; Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []);

Render contents of a page to a device (screen, bitmap, or printer).

function RenderPage(Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []): TBitmap;

Render contents of a page to a new bitmap. Returned bitmap has to be manually released.

program RenderPage(Bitmap: TBitmap; Left, Top, Width, Height: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []);

Render contents of a page to an existing bitmap.

function RenderTile(Left, Top, Width, Height, PageWidth, PageHeight: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []): TBitmap;

Render rectangular area of a page to a new bitmap. Returned bitmap has to be manually released.

program RendeTile(Bitmap: TBitmap; Left, Top, Width, Height, PageWidth, PageHeight: Integer; Rotation: TRotation = ro0; Options: TRenderOptions = []);

Render rectangular area of a page to an existing bitmap.

function Text(StartIndex: Integer = 0; Count: Integer = MaxInt): string;

Extract text string from the page. StartIndex and Count parameters determine characters to be extracted. StartIndex parameter is 0-based.

function TextInRectangle(Left, Top, Right, Bottom: Integer): string;

Extract text within a rectangular boundary on the page.

function TextInRectangle(Rectangle: TRect): string;

Extract text within a rectangular boundary on the page.

procedure UpdatePage;

Generate PDF page content of modified PDF page. Without calling this method, the changed PDF information will be lost.

function WebLinkAtPos(X, Y: Integer): Integer;

Get the index of a web link at a certain position on the page. If there is no web link at the point, return value will be -1.

Events

property OnPageChange: TNotifyEvent;

Write OnPageChange event handler to take specific actions when the current PDF page was changed.

property OnPaint: TPaintEvent;

Occurs when the control is redrawn. Write an event handler for OnPaint to change the way the control renders itself.