TrFile_GetAsPlainText (function reference)

By May 26, 2021May 27th, 2021Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_GetAsPlainText
Troi File Plug-in for FileMaker Pro

TrFile_GetAsPlainText

Returns the text contents of a PDF file converted to plain text

SyntaxFunction badge

TrFile_GetAsPlainText( switches ; filePath ) 

Parameters

switches not used, reserved for future use. Leave blank or put "-Unused"
filePath the path to the file

Returned Result

Data type returned

Text

Result

The characters of the file specified.

If unsuccessful this function returns an error code starting with $$ and the error code. Returned error codes can be:

$$-50 paramErr parameter error
$$-41 memFulErr not enough memory

Other errors may be returned.

Originated in

Troi File Plug-in 13.0

Compatibility

FileMaker Pro 16 to 19

Considerations

The function currently only converts PDF files to text.
Note that the returned results might be slightly different on macOS compared to Windows: long lines might be wrapped differently.
Each page is separated by: “<———->”
Also note this is implemented for 64-bit FileMaker Pro only.

Example

Set Field [ MyTextField ; TrFile_GetAsPlainText ( "-Unused" ; "HD Mac:Letter123.pdf" ) ]

returns the contents of the PDF file as plain text.

Example 2

Set Variable[$ContainerWithPDF; ContainerField ]
Set Variable[$PlainText; TrFile_GetAsPlainText($ContainerWithPDF) ]

If ContainerField contains a PDF with 2 pages, for example with the text “ABC” on the first page and “1234” on the second the result will be:

ABC
<———->
1234

Used in example file

DataIn.fmp12

Related functionsFunction badge

TrFile_GetContents
TrFile_SelectFileDialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 16 to 19 –> TrFile_GetAsPlainText (filep4223) 2021-0527 11:11:09