![]() |
TrFile_GetAsPlainText |
Returns the text contents of a PDF file converted to plain text
Syntax
TrFile_GetAsPlainText( switches ; filePath )
Parameters
switches | not used, reserved for future use. Leave blank or put "-Unused" |
filePath | the path to the file, or container data |
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.
Starting with v13.1 you now get the plain text from a PDF in a container field (or a variable with container data of a PDF).
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("-Unused" ; $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 functions
TrFile_GetContents |
TrFile_SelectFileDialog |
Related topics
Troi File Plug-in online help (overview)