VCL/LCL이나 Graphics 의존성이 없는 문서 API가 필요하면 FPdfDocumentCore를 쓰고, 기존 컴포넌트를 독립적인 RTL 전용 스냅샷으로 연결할 때는 TPdf.CreateCoreSnapshot을 호출하세요
PDFIUMPAS_CORE_ONLY를 정의하면 VCL/LCL 위젯 프레임워크 없이 상위 문서 API를 컴파일합니다. TPdfView, TPdfReadingSession, 뷰어 헬퍼는 제외되고 위젯 유닛(Forms, Controls, Dialogs, ExtCtrls, Menus, Messages)은 두 컴파일러 분기 모두에서 유닛의 uses 목록에서 빠집니다. 픽셀 버퍼 렌더링 API에는 Vcl.Graphics 또는 LCL Graphics 유닛만 남습니다
기본 성격은 클래식 API를 그대로 유지하므로 기존 프로젝트는 수정 없이 컴파일됩니다. 헤드리스 소비자는 define을 추가하고 로드, 텍스트, 편집, 저장, bitmap 렌더링에 TPdf를 직접 씁니다. CreateCoreSnapshot은 활성 문서를 독립적인 TPdfDocumentCore 상한 스냅샷으로 추가로 내보냅니다
헤드리스 차이는 명시적입니다. PDFium 스크립트 폼 타이머는 사용 불가를 보고하고(윈도우 메시지 펌프 없음), JavaScript prompt는 대화상자 없이 스크립트 기본 답을 반환하며, alert은 raw Win32 메시지 상자를 쓰고 컨트롤의 시각 기능은 없습니다. 실제 인스턴스는 만들어지지 않으면서 폼 작성 접착제가 컴파일되도록 무기능 TPdfView 대체물이 남습니다
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;
Style: TPdfOutlineStyle;
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;
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;
주석 데이터
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, fiXfa, fiXfaCheckBox, fiXfaComboBox, fiXfaImageField, fiXfaListBox, fiXfaPushButton, fiXfaSignature, fiXfaTextField);
폼 필드의 유형을 결정합니다
type TPdfFormType = (ftUnknown, ftNone, ftAcroForm, ftXfaFull, ftXfaForeground);
PDF 문서에 있는 폼의 유형을 결정합니다
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 이미지 객체의 픽셀 크기와 데이터
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);
Trailer 파일 식별자 선택자. 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;
ByteRange: TPdfIntegerArray;
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;
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;
Tagged 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, pv20);
PDF 파일의 버전 또는 명시적 SaveAs 대상. 가능한 값은 알 수 없는 버전, PDF 1.0부터 1.7까지의 버전, 그리고 2.0입니다. PDF 1.3부터 PDF 2.0까지의 명시적 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, saSubsetNewFonts);
PDF 문서의 저장 방식을 결정합니다
type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);
type TSearchOptions = set of TSearchOption;
검색 플래그
type TWebLink = record
Url: WString;
Rectangles: TPdfRectangles;
StartCharIndex: Integer;
CharCount: Integer;
end;
type TWebLinks = array of TWebLink;
웹 링크의 URL 정보와 경계
type WString = {$IFDEF FPC} WideString {$ELSE} string {$ENDIF};
와이드 문자열
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;
SourceFragment: TPdfContentFragment;
TableContext: TPdfReaderTableContext;
ListContext: TPdfReaderListContext;
TextStartIndex: Integer;
end;
type TPdfReadingUnits = array of TPdfReadingUnit;
TTS 및 보조 듣기 읽기 워크플로에서 사용되는 문장 단위 읽기 단위
type TPdfWordBox = record
Text: WString;
StartIndex: Integer;
Count: Integer;
Rect: TPdfRectangle;
Page: Integer;
CharacterIndices: TPdfIntegerArray;
end;
type TPdfWordBoxes = array of TPdfWordBox;
동기화된 읽기 강조 표시에 사용되는 단어 수준 텍스트 범위와 페이지 사각형
type TPdfSpokenSpan = record
SpokenStart: Integer;
SpokenCount: Integer;
Page: Integer;
StartIndex: Integer;
Count: Integer;
ContextOnly: Boolean;
end;
type TPdfSpokenSpans = array of TPdfSpokenSpan;
음성 엔진 오프셋을 PDF 페이지 텍스트로 되돌려 매핑하는 구간
type TPdfSpokenText = record
Text: WString;
Spans: TPdfSpokenSpans;
end;
type TPdfSpokenTexts = array of TPdfSpokenText;
read-aloud 워크플로와 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을 선택합니다
바인딩된 TPdf를 파괴하면 남아 있던 뷰를 비활성화하고 그 Pdf 참조를 지웁니다. 이전에 얻은 네이티브 문서·페이지 핸들은 더 이상 쓰면 안 됩니다