DynaPDF.Parser.FindText
-----------------------

Finds text using the parser.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [14.0](newinversion140.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.Parser.FindText"; PDF; Text; SearchType; ContinueSearch { ; Left; Bottom; Right; Top } ) 

**MBS**( **"DynaPDF.Parser.FindText";** /\* Finds text using the parser. \*/  
**$PDF**; /\* The PDF reference. \*/   
**$Text**; /\* The text to find. \*/   
**$SearchType**; /\* The search type.  
Can be a combination of Default, MatchAlways, SearchAsIs, WholeWord, CaseInSensitive or CaseSensitive.e.g. "CaseInSensitive, WholeWord" \*/   
**$ContinueSearch**; /\* Whether to start fresh (False) or continue search (true).e.g. 0 \*/   
**$Left**; /\* Optional; The left coordinate of the rectangle.e.g. 0 \*/   
**$Bottom**; /\* Optional; The bottom coordinate of the page.e.g. 0 \*/   
**$Right**; /\* Optional; The right coordinate of the page.e.g. 595 \*/   
**$Top**) /\* Optional; The top coordinate of the page.e.g. 842 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference. | $pdf |  |
| 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](DynaPDFGetOrientation.md)). 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](DynaPDFGetBBox.md)). 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](DynaPDFParserCreate.md)"; $pdf ; $OptimizeFlags ) \]   
Set Variable \[ $r ; Value: MBS ( "[DynaPDF.Parser.SetAltFont](DynaPDFParserSetAltFont.md)"; $pdf ; "Helvetica"; 0; 12) \]   
\#   
\# Now parse a page   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.Parser.ParsePage](DynaPDFParserParsePage.md)"; $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](DynaPDFParserReplaceSelText.md)"; $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](DynaPDFParserWriteToPage.md)"; $pdf ; $OptimizeFlags ) \]   
 End If  
End If  
### See also

- [DynaPDF.GetOrientation](DynaPDFGetOrientation.md)
- [DynaPDF.Parser.Create](DynaPDFParserCreate.md)
- [DynaPDF.Parser.DeleteText](DynaPDFParserDeleteText.md)
- [DynaPDF.Parser.Line](DynaPDFParserLine.md)
- [DynaPDF.Parser.ReplaceSelText](DynaPDFParserReplaceSelText.md)
- [DynaPDF.Parser.SelectionBBox](DynaPDFParserSelectionBBox.md)
- [DynaPDF.Parser.SetAltFont](DynaPDFParserSetAltFont.md)
- [DynaPDF.Parser.WriteToPage](DynaPDFParserWriteToPage.md)
- [DynaPDF.ReplacePattern](DynaPDFReplacePattern.md)
- [IsError](IsError.md)

### Release notes

- **Version 14.0**
    - Added DynaPDF parser functions: [DynaPDF.Parser.ChangeAltFont](https://www.mbsplugins.eu/DynaPDFParserChangeAltFont.shtml), [DynaPDF.Parser.Create](https://www.mbsplugins.eu/DynaPDFParserCreate.shtml), [DynaPDF.Parser.DeleteText](https://www.mbsplugins.eu/DynaPDFParserDeleteText.shtml), [DynaPDF.Parser.ExtractText](https://www.mbsplugins.eu/DynaPDFParserExtractText.shtml), [DynaPDF.Parser.FindText](https://www.mbsplugins.eu/DynaPDFParserFindText.shtml), [DynaPDF.Parser.Line](https://www.mbsplugins.eu/DynaPDFParserLine.shtml), [DynaPDF.Parser.ParsePage](https://www.mbsplugins.eu/DynaPDFParserParsePage.shtml), [DynaPDF.Parser.ReplaceSelText](https://www.mbsplugins.eu/DynaPDFParserReplaceSelText.shtml), [DynaPDF.Parser.SetAltFont](https://www.mbsplugins.eu/DynaPDFParserSetAltFont.shtml), [DynaPDF.Parser.TextMatrix](https://www.mbsplugins.eu/DynaPDFParserTextMatrix.shtml), [DynaPDF.Parser.WriteToPage](https://www.mbsplugins.eu/DynaPDFParserWriteToPage.shtml).

### Example Databases

- [DynaPDF/Find and Replace Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Find%20and%20Replace%20Text.shtml#2ScriptAnchor_)

### Blog Entries

- [Understanding PDF Structure and Content Streams](https://www.mbsplugins.de/archive/2026-05-13/Understanding_PDF_Structure_an/monkeybreadsoftware_blog_filemaker)
- [Retract text from a PDF with DynaPDF](https://www.mbsplugins.de/archive/2025-11-01/Retract_text_from_a_PDF_with_D/monkeybreadsoftware_blog_filemaker)
- [Unlocking the Power of PDFs in FileMaker with DynaPDF and the MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2024-09-16/Unlocking_the_Power_of_PDFs_in/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 14.3 für Claris FileMaker](https://www.mbsplugins.de/archive/2024-07-09/Neues_MBS_Plugin_143_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 14.3 for Claris FileMaker](https://www.mbsplugins.de/archive/2024-07-09/MBS_FileMaker_Plugin_143_for_C/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 14.0](https://www.mbsplugins.de/archive/2024-01-23/New_in_MBS_FileMaker_Plugin_14/monkeybreadsoftware_blog_filemaker)
- [DynaPDF Parser for FileMaker](https://www.mbsplugins.de/archive/2024-01-19/DynaPDF_Parser_for_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS @ FMTraining.TV - FileMaker Monkeybread Plug-in Q&amp;A](https://www.mbsplugins.de/archive/2023-12-09/MBS_@_FMTrainingTV_-_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.6pr1](https://www.mbsplugins.de/archive/2023-12-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 23th November 2023 , last changed 26th June 2024

  
[DynaPDF.Parser.ExtractText](DynaPDFParserExtractText.md) - [DynaPDF.Parser.Line](DynaPDFParserLine.md)

[HTML Version](DynaPDFParserFindText.shtml)