N2PDFSearchAndReplace

Start page  Previous page  Next page

 

N2PDFSearchAndReplace (<JobID>, <OperationMode>, <SearchFor>, <ReplaceWith>, <OptionValue>) -> <ErrorCode>

 

Description

By using the function N2PDFSearchAndReplace you can execute "search & replace" operations on the content of the current PDF file. There are three different types, which are controlled by the "OperationMode" parameter:

 

"Searching & replacing" the defined variables

"Searching & replacing" the defined variables and resetting the variable content

free "search & replace" within the content

 

Declaration for LotusScript

Declare Function N2PDFSearchAndReplace Lib LibName_

( ByVal JobID As Long, ByVal OperationMode As Long,_

ByVal  SearchFor As Unicode String, ByVal ReplaceWith As Unicode String,_

ByVal OptionValue As Long ) As Long

 

Parameters

<JobID> (LONG)

The number that is returned when N2PDFInit is invoked and which references the PDF file in the memory. You use this ID to control which PDF you want to access with the function.

 

<OperationMode> (LONG)

This parameter defines which "search & replace" mode is to be used. There are three available options:

 

N2PDFOPTION_REPLACE_VARIABLES

Launches a "search & replace" with the current values of the defined variables. The variables content is not reset.

N2PDFOPTION_REPLACE_VARIABLES_CLEAR

Launches a "search & replace" with the current values of the defined variables. The variables content is reset, meaning all variables are deleted.

N2PDFOPTION_REPLACE_CONTENT

Executes "search & replace". The values are sent using the parameters <SearchFor> and <ReplaceWith>.

 

<SearchFor> (UNICODE STRING)

This parameter is used only, when the <OperationMode> is set to N2PDFOPTION_REPLACE_CONTENT. In this case, <SearchFor> defines the value that is to be looked for in the content and <ReplaceWith> the content it is to be replaced with. A search term may contain "*" as a wildcard, this may however not be the first character in the search term.

 

<ReplaceWith> (UNICODE STRING)

This parameter is used only, when the <OperationMode> is set to N2PDFOPTION_REPLACE_CONTENT. In this case <ReplaceWith> defines the value that is to replace the <SearchFor> in every instance.

 

<OptionValue > (LONG)

Not used at present, always pass 0.

 

Return

<ErrorCode> (LONG)

The code number of the error that has occurred when performing the function (see "Error Codes ").

Example: All variables are replaced

Call N2PDFSearchAndReplace ( JobID,_

N2PDFOPTION_REPLACE_VARIABLES, "", "", 0 )

 

Example: All variables are replaced and their content is reset

Call N2PDFSearchAndReplace ( JobID,_

N2PDFOPTION_REPLACE_VARIABLES_CLEAR, "", "", 0 )

 

Example: Search for texts and replace these

Call N2PDFSearchAndReplace ( JobID,_

N2PDFOPTION_REPLACE_CONTENT, "SoftVision", "n2pdf", 0 )

 

Call N2PDFSearchAndReplace ( JobID,_

N2PDFOPTION_REPLACE_CONTENT, "Soft*", "n2pdf", 0 )

 

Call N2PDFSearchAndReplace ( JobID,_

N2PDFOPTION_REPLACE_CONTENT, "[*]", "ABC", 0  )