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;
Action: TPdfAction;
ActionPageNumber: Integer;
end;
type TBookmarks = array of TBookmark;
Datos de marcadores
type TDestination = record
Handle: FPDF_DEST;
Name: WString;
PageNumber: Integer;
HasX: Boolean;
X: Single;
HasY: Boolean;
Y: Single;
HasZoom: Boolean;
Zoom: Single;
end;
Datos de destinos con nombre
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;
Datos de anotaciones de vínculo
type TObjectType = (otUnknown, otText, otPath, otImage, otShading, otForm);
Determina el tipo del objeto PDF
type TPageMode = (pmNone, pmOutline, pmThumbs, pmFullScreen, pmOptionalContentGroup, pmAttachments, pmUnknown);
Determina cómo debe mostrarse el documento PDF al abrirse
type TPdfAction = (acUnsupported, acGoto, acGotoRemote, acUri, acLaunch);
Determina el tipo de una acción asociada con un elemento de marcador
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;
Datos de anotaciones
type TPdfAnnotationFlag = (afInvisible, afHidden, afPrint, afNoZoom, afNoRotate, afNoView, afReadOnly, afLocked, afToggleNoView);
type TPdfAnnotationFlags = set of TPdfAnnotationFlag;
Banderas de anotación
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);
El subtipo de anotación
type TPdfBlendMode = (bmDefault, bmColor, bmColorBurn, bmColorDodge, bmDarken, bmDifference, bmExclusion, bmHardLight, bmHue, bmLighten, bmLuminosity, bmMultiply, bmNormal, bmOverlay, bmSaturation, bmScreen, bmSoftLight);
Determina cómo se mezclan las capas entre sí
type TPdfDisplayMode = (dmSingleContinuous, dmTwoPageContinuous, dmTwoPageContinuousWithCover);
Determina cómo se muestran las páginas del documento PDF
type TPdfFeature = (feUnknown, feXfaForm, fePortableCollection, feAttachment, feSecurity, feSharedReview, feSharedFormAcrobat, feSharedFormFilesystem, feSharedFormEmail, fe3dAnnotation, feMovieAnnotation, feSoundAnnotation, feScreenMediaAnnotation, feScreenRichMediaAnnotation, feAttachmentAnnotation, feSignatureAnnotation);
Función del documento PDF informada por el evento OnUnsupportedFeature
type TPdfFillMode = (fmNone, fmAlternate, fmWinding);
Determina cómo se forman las áreas de relleno cuando un trazado se cruza a sí mismo
type TPdfFormFieldFlag = (ffReadOnly, ffRequired, ffNoExport, ffMultiline, ffChoiceCombo, ffChoiceEdit, ffPassword, ffChoiceMultiSelect);
type TPdfFormFieldFlags = set of TPdfFormFieldFlag;
Banderas de campos de formulario
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;
Información del campo de formulario
type TPdfFormFieldType = (fiUnknown, fiPushButton, fiCheckBox, fiRadioButton, fiComboBox, fiListBox, fiTextField, fiSignature);
Determina el tipo del campo de formulario
type TPdfFormType = (ftUnknown, ftNone, ftAcroForm, ftXfaFull, ftXfaForeground);
Determina el tipo de formularios en el documento PDF
type TPdfImage = record
Width: Integer;
Height: Integer;
Data: TBytes;
end;
Tamaño en píxeles y datos del objeto de imagen PDF
type TPdfLineCap = (lcDefault, lcButt, lcRound, lcProjectingSquare);
La forma que se usa en los extremos de subtrazados abiertos
type TPdfLineJoin = (ljDefault, ljMiter, ljRound, ljBevel);
La forma que se usa en las esquinas de los trazados delineados
type TPdfPoint = record
X, Y: Double;
end;
Punto con coordenadas X e Y
type TPdfRectangle = record
Left, Top, Right, Bottom: Double;
end;
type TPdfRectangles = array of TPdfRectangle;
Área de rectángulo con coordenadas Left, Top, Right y Bottom
type TPdfFileIdentifierType = (fidPermanent, fidChanging);
Selector del identificador de archivo del tráiler. fidPermanent lee la primera entrada /ID y fidChanging lee la segunda entrada /ID
type TPdfPageBox = (pbMedia, pbCrop, pbBleed, pbTrim, pbArt);
Selector de cuadro del diccionario de página usado por PageBox, GetPageBox y SetPageBox
type TPdfJavaScriptAction = record
Name: WString;
Script: WString;
end;
type TPdfJavaScriptActions = array of TPdfJavaScriptAction;
Datos de acciones de árbol de nombres de JavaScript a nivel de documento
type TPdfSignature = record
Content: TBytes;
Encoding: WString;
Reason: WString;
Time: WString;
Permission: Integer;
end;
Digital signature information.
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 text object character position setters.
type TPdfPrintPageRange = record
StartPage: Integer;
EndPage: Integer;
end;
type TPdfPrintPageRanges = array of TPdfPrintPageRange;
Rangos de páginas de impresión basados en 1 de las preferencias del visor de documentos
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);
La versión de un archivo PDF o un destino explícito de SaveAs. Los valores posibles son: versión desconocida, PDF versión 1.0 a 1.7. Los destinos explícitos de SaveAs desde PDF 1.3 hasta PDF 1.7 se normalizan y validan contra la versión PDF seleccionada
type TPrintPaperHandling = (phUndefined, phSimplex, phDuplexFlipShortEdge, phDuplexFlipLongEdge);
Print paper handling options.
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;
Banderas de renderizado de página
TPdfView.NightDuotoneInk y TPdfView.NightDuotonePaper
type TRotation = (ro0, ro90, ro180, ro270);
La rotación de la página PDF. La rotación de la página se aplica en sentido horario
type TSaveOption = (saNone, saIncremental, saNoIncremental, saRemoveSecurity);
Determina cómo se guardará el documento PDF
type TSearchOption = (seCaseSensitive, seWholeWord, seConsecutive);
type TSearchOptions = set of TSearchOption;
Banderas de búsqueda
type TWebLink = record
Url: WString;
Rectangles: TPdfRectangles;
end;
type TWebLinks = array of TWebLink;
Información de URL y límites del vínculo web
type WString = {$ifdef D2009PLUS} string {$else} WideString {$endif D2009PLUS};
Cadena ancha
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 text-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 text ranges and page 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;
Mapea un tramo del texto hablado de vuelta a un rango de caracteres de la página de origen
type TPdfSpokenText = record
Text: WString;
Spans: TPdfSpokenSpans;
end
type TPdfSpokenTexts = array of TPdfSpokenText;
Fragmentos hablados y mapas de origen usados por flujos de trabajo de lectura en voz alta y TPdfReadingSession
type TPdfReadingSessionState = (pssIdle, pssSpeaking, pssPaused);
Estado de reproducción reportado por TPdfReadingSession
TPdfReadingSession es una máquina de estados de lectura en voz alta neutral respecto al motor TTS que coordina fragmentos TPdfSpokenText, devoluciones de llamada del motor de voz del host y el resaltado del cursor de palabras en TPdfView
| Método | Descripción |
|---|---|
Create(AOwner: TComponent) | Inicializa una sesión inactiva con el ritmo de voz estimado predeterminado |
LoadSpoken(const Chunks: TPdfSpokenTexts) | Detiene la reproducción actual y copia los fragmentos que se hablarán en orden |
Play | Inicia la reproducción desde el primer fragmento cargado |
PlayFrom(ChunkIndex: Integer) | Inicia la reproducción desde un índice base cero de fragmento |
Pause | Pasa de pssSpeaking a pssPaused y dispara OnPauseRequest |
Resume | Reanuda la reproducción pausada o vuelve a hablar el fragmento actual cuando ResumeRestartsChunk está habilitado |
Stop | Cancela la reproducción, restablece los cursores de fragmento y palabra, y limpia el resaltado de palabras de TPdfView asociado |
FeedSpokenPosition(SpokenOffset: Integer) | Mapea un desplazamiento del motor de voz de vuelta a un carácter de página PDF y mueve el cursor de palabras de TPdfView |
Tick(SpeechStillBusy: Boolean; ElapsedMs: Cardinal = 0) | Avanza al siguiente fragmento, finaliza la reproducción o estima la palabra actual mientras la voz sigue ocupada |
| Propiedad | Tipo | Descripción |
|---|---|---|
State | TPdfReadingSessionState | Estado actual: pssIdle, pssSpeaking o pssPaused |
ChunkCount | Integer | Cantidad de fragmentos hablados cargados |
CurrentChunk | Integer | Índice base cero del fragmento activo, o -1 cuando no hay ninguno activo |
CurrentWord | Integer | Índice base cero de la palabra activa dentro del fragmento actual, o -1 cuando no se conoce |
View | TPdfView | Visor que recibe actualizaciones del cursor de palabras |
EstimatePacing | Boolean | Usa el tiempo transcurrido para estimar la posición de palabra en motores de voz sin señal de posición de palabra |
EstimatedWordsPerMinute | Integer | Velocidad de voz usada por el ritmo estimado, predeterminada en 175 |
ResumeRestartsChunk | Boolean | Hace que Resume vuelva a hablar el fragmento actual para motores donde la pausa cancela el habla en cola |
| Evento | Tipo | Descripción |
|---|---|---|
OnSpeak | TPdfReadingSpeakEvent | Se dispara cuando el host debe hablar un fragmento |
OnCancelRequest | TNotifyEvent | Se dispara cuando el host debe cancelar el habla |
OnPauseRequest | TNotifyEvent | Se dispara cuando el host debe pausar el habla |
OnResumeRequest | TNotifyEvent | Se dispara cuando el host debe reanudar el habla sin reiniciar el fragmento |
OnChunkChange | TPdfReadingChunkEvent | Se dispara cuando cambia el fragmento activo |
OnWordChange | TPdfReadingWordEvent | Se dispara cuando cambia la palabra activa |
OnFinished | TNotifyEvent | Se dispara después de que termina el último fragmento |
var LibraryName: string = 'pdfium.dll';
Nombre de la biblioteca PDFium estándar usada cuando EnableV8Engine es False. Se puede cambiar antes de llamar a LoadLibrary
var EnableV8Engine: Boolean = False;
Establézcalo en True antes de cargar para seleccionar pdfium.v8.dll desde la carpeta DLLs correspondiente de Win32 o Win64