Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.Parser.FindText
Finds text using the parser.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 14.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference. | |||
Text | The text to find. | ||
SearchType | The search type. Can be a combination of Default, MatchAlways, SearchAsIs, WholeWord, CaseInSensitive or CaseSensitive. |
"CaseInSensitive, WholeWord" | |
ContinueSearch | Whether to start fresh (False) or continue search (true). | 0 | |
Left | The left coordinate of the rectangle. | 0 | Optional |
Bottom | The bottom coordinate of the page. | 0 | Optional |
Right | The right coordinate of the page. | 595 | Optional |
Top | The top coordinate of the page. | 842 | Optional |
Result
Returns OK or error.
Description
Finds text using the parser.Searches for text and stores the result so that further editing actions can be applied.
Area must be defined as if the page would be viewed in a PDF viewer. That means in bottom up coordinates and the orientation must be considered (see DynaPDF.GetOrientation). The width and height of a page must be calculated from the crop box if set, or from the media box otherwise (see DynaPDF.GetBBox). Note also that the width and height must be exchanged if the orientation is 90, -90, 270, or -270 degrees.
The page coordinate system is de-rotated since this produces better results and it is much easier to find the location of text in rotated pages.
DynaPDF.Parser.FindText is usually called inside a loop until no more occurrences of the search string can be found. In the first call, continueSearch must be false. That means start at the beginning. The continue searches with continueSearch = true.
Available search types:
Text | Number | Description |
Default | 0 | Case sensitive search |
WholeWord | 1 | Only whole words |
CaseInSensitive | 2 | Case insensitive search |
MatchAlways | 4 | Return on every single character. Text is ignored when this flag is set. |
Examples
Perform find and replace:
# initialize parser
Set Variable [ $OptimizeFlags ; Value: 0 ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Parser.Create"; $pdf; $OptimizeFlags ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Parser.SetAltFont"; $pdf; "Helvetica"; 0; 12) ]
#
# Now parse a page
Set Variable [ $r ; Value: MBS("DynaPDF.Parser.ParsePage"; $pdf; 1; "EnableTextSelection") ]
If [ MBS("IsError") ]
Show Custom Dialog [ "Failed to parse page" ; $r ]
Else
# Run a find
Set Variable [ $continueFind ; Value: 0 ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
If [ $r = 1 ]
Loop [ Flush: Always ]
# Do the replace
Set Variable [ $r ; Value: MBS( "DynaPDF.Parser.ReplaceSelText"; $pdf; DynaPDF Replace Text::ReplaceText) ]
#
# Continue search
Set Variable [ $continueFind ; Value: 1 ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Parser.FindText"; $pdf; DynaPDF Replace Text::SearchText; "CaseInsensitive"; $continueFind) ]
Exit Loop If [ $r ≠ 1 ]
End Loop
#
# Save changes back
Set Variable [ $r ; Value: MBS( "DynaPDF.Parser.WriteToPage"; $pdf; $OptimizeFlags) ]
End If
End If
See also
- DynaPDF.GetBBox
- DynaPDF.GetOrientation
- DynaPDF.Parser.Create
- DynaPDF.Parser.DeleteText
- DynaPDF.Parser.Line
- DynaPDF.Parser.ParsePage
- DynaPDF.Parser.ReplaceSelText
- DynaPDF.Parser.SelectionBBox
- DynaPDF.Parser.WriteToPage
- IsError
Release notes
- Version 14.0
- Added DynaPDF parser functions: DynaPDF.Parser.ChangeAltFont, DynaPDF.Parser.Create, DynaPDF.Parser.DeleteText, DynaPDF.Parser.ExtractText, DynaPDF.Parser.FindText, DynaPDF.Parser.Line, DynaPDF.Parser.ParsePage, DynaPDF.Parser.ReplaceSelText, DynaPDF.Parser.SetAltFont, DynaPDF.Parser.TextMatrix, DynaPDF.Parser.WriteToPage.
Example Databases
Blog Entries
- Unlocking the Power of PDFs in FileMaker with DynaPDF and the MBS FileMaker Plugin
- Neues MBS Plugin 14.3 für Claris FileMaker
- MBS FileMaker Plugin 14.3 for Claris FileMaker
- New in MBS FileMaker Plugin 14.0
- DynaPDF Parser for FileMaker
- MBS @ FMTraining.TV - FileMaker Monkeybread Plug-in Q&A
- MBS FileMaker Plugin, version 13.6pr1
This function checks for a license.
Created 23th November 2023, last changed 26th June 2024