The ReachText function reaches a text object having a specified text and font attributes. It searches the document for the first object containing the specified text and makes that object visible.
Function ReachText([Option] As ACPDFCREACTIVEX.ReachTextOptionConstants, Text As String, FontName As String, FontSize As Integer, Bold As Integer, Italic As Integer) As Integer
int ReachText(ACPDFCREACTIVEX.ReachTextOptionConstants Option, string Text, string FontName, short FontSize, int Bold, int Italic)
HRESULT ReachText ReachText(enum ReachTextOptionConstants Option, BSTR Text, BSTR FontName, short FontSize, long Bold, long Italic)
Option
Option |
Value |
Description |
---|---|---|
acReachTextOpenStart |
-1 |
Case sensitive search from the beginning of the document. |
acReachTextOptionCurrent |
0 |
Case sensitive search from current position. |
acReachTextOptionStartNoCase |
1 |
Search from the beginning of the document, is not case-sensitive. |
acReachTextOptionCurrentNoCase |
2 |
Search from the current position, is not case-sensitive. |
Text
Text to search for
FontName
If provided (not empty), the text has to be in the specified font.
FontSize
If provided (not 0), the text has to be in the specified font size.
Bold
If provided (not 0), the text has to be in the specified font style.
Italic
If provided (not 0), the text has to be in the specified font style.
This function returns True or 1 if the text is found, False or 0 otherwise.
The EditBackColor2 Document attribute sets the background color of the search results. Default value 0 (Black).
See also ReachTextEx Method.
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"
Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()
' Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode)
' Open an existent PDF file
Dim fileName As String = "c:\temp\PDFdocument.pdf"
Dim password As String = ""
pdf.Open(fileName, password)
' Find the word "methods" not bold, not italic
Dim text As String = "methods"
Dim fontName As String = "" ' None
Dim fontSize As Short = 0 ' None
Dim italic As Integer = 0
Dim bold As Integer = 0
Dim found As Integer = pdf.ReachText(ACPDFCREACTIVEX.ReachTextOptionConstants.acReachTextOptionStartNoCase, text, fontName, fontSize, italic, bold)
If found = 0 Then
Console.WriteLine("The word ' methods' is not found in the document")
Else
Console.WriteLine("the word ' methods' is found")
End If
' Save PDF
pdf.Save("c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)
' destroy objects
pdf = Nothing
End Sub
static void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator Evaluation";
const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initializing PDFCreativeX Object
ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();
// Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode);
// Open an existent PDF file
string fileName = @"c:\temp\PDFdocument.pdf";
string password = "";
pdf.Open(fileName, password);
// Find the word "methods" not bold, not italic
string text = "methods";
string fontName = ""; // None
short fontSize = 0; // None
int italic = 0;
int bold = 0;
int found = pdf.ReachText(ACPDFCREACTIVEX.ReachTextOptionConstants.acReachTextOptionStartNoCase, text, fontName, fontSize, italic, bold);
if (found == 0)
Console.WriteLine("The word ' methods' is not found in the document");
else
Console.WriteLine("the word ' methods' is found");
// Save PDF
pdf.Save(@"c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);
// destroy objects
pdf = null;
}
#include <iostream>
#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace
using namespace std;
int main()
{
// Constants for Activation codes
bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";
bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initialize the COM subsystem
CoInitialize(0);
// IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,
// the type library header file generated by the #import instruction above
IPDFCreactiveXPtr pdf;
// Create the PDFCreactiveX instance
pdf.CreateInstance(__uuidof(PDFCreactiveX));
// set license key
pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));
// Open an existent PDF file
bstr_t fileName = "c:\\temp\\PDFdocument.pdf";
bstr_t password = "";
pdf->Open(fileName, password);
// Find the word "methods" not bold, not italic
bstr_t text = "methods";
bstr_t fontName = ""; // None
short fontSize = 0; // None
int italic = 0;
int bold = 0;
int found = pdf->ReachText(acReachTextOptionStartNoCase, text, fontName, fontSize, italic, bold);
if (found == 0)
cout << "The word ' methods' is not found in the document" << endl;
else
cout << "the word ' methods' is found" << endl;
// Save PDF
pdf->Save("c:\\temp\\CreatePDFDocument_resulting.pdf", acFileSaveView);
// destroy objects
pdf = NULL;
return 0;
}
' ReachTextOptionConstants
Const acReachTextOptionCurrent = 0
Const acReachTextOptionCurrentNoCase = 2
Const acReachTextOptionStart = -1
Const acReachTextOptionStartNoCase = 1
' FileSaveOptionConstants
Const acFileSaveAll = 0
Const acFileSaveDefault = -1
Const acFileSaveView = 1
Const acFileSaveDesign = 2
Const acFileSavePDFA_7 = 3
Const acFileSavePDFA = 4
Const acFileSavePDF14 = 5
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Creator Evaluation"
Const strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf
Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX.6.5")
' Set license key
pdf.SetLicenseKey strLicenseTo, strActivationCode
' Open an existent PDF file
Dim fileName
fileName = "c:\temp\PDFdocument.pdf"
Dim password
password = ""
pdf.Open fileName, password
' Rasterize Pages
Dim text
text = "methods"
Dim fontName
fontName = ""
Dim fontSize
fontSize = 0
Dim italic
italic = 0
Dim bold
bold = 120
Dim found
found = pdf.ReachText(acReachTextOptionStartNoCase, text, fontName, fontSize, italic, bold)
If found = 0 Then
WScript.Echo("The word ' methods' is not found in the document")
Else
WScript.Echo("the word ' methods' is found")
End If
' Save PDF
pdf.Save "c:\temp\CreatePDFDocument_resulting.pdf", acFileSaveView
' destroy objects
Set pdf = Nothing