IPXV_Inst::Str2ID Method

From PDF XChange PDF SDK
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 
[[Category:Editor]]
 
[[Category:Editor]]
 
{{#customTitle:IPXV_Inst::Str2ID Method}}
 
{{#customTitle:IPXV_Inst::Str2ID Method}}
 +
{{#parentPage:PXV:IPXV_Inst#Methods|Str2ID|method}}
 +
{{ToReview}}
  
 
Converts string identifier to numerical identifier.
 
Converts string identifier to numerical identifier.
  
 
== Syntax ==
 
== Syntax ==
<pre class="brush:cpp;gutter:false">HRESULT Str2ID([in] BSTR pStr, [in, optional] VARIANT_BOOL bAddIfNotExists, [out, retval] LONG* pID);</pre>
+
<pre class="brush:cpp;gutter:false">HRESULT Str2ID([in]                   BSTR         sStr,
 +
              [in, defaultvalue(-1)] VARIANT_BOOL bAddIfNotExists,
 +
              [out, retval]           LONG*         nID);</pre>
  
 
== Parameters ==
 
== Parameters ==
;''pStr''
+
;sStr
:[in]  Value of BSTR containing string identifier.
+
:[in]  The string identifier to be converted to number.
;''bAddIfNotExists''
+
;bAddIfNotExists
:[in, optional]  Indicates whether to add ''pStr'' to the table of strings. Default value is '''TRUE'''.
+
:[in, defaultvalue(-1)]  Indicates whether to add input string to the global table of string-identifiers. Default value is <tt>true</tt>.
;''pID''
+
;nID
:[out, retval]  Pointer to LONG value to receive the numeric ID.
+
:[out, retval]  Returns the numeric ID.
  
 
== Return Value ==
 
== Return Value ==
 
Returns S_OK if operation was successful or error code in other cases.
 
Returns S_OK if operation was successful or error code in other cases.
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
private void AddContent(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst, PDFXEdit.IPXC_Content Content)
 +
{
 +
int nID = Inst.Str2ID("op.addContent", false);
 +
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
 +
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 +
input.Add().v = Doc.CoreDoc;
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
options["Content"].v = Content;
 +
options["TargetPage"].v = 0;
 +
options["InsertClone"].v = true;
 +
Op.Do();
 +
}
 +
</pre>
  
 
== See Also ==
 
== See Also ==
See also [[PXV:IPXV_Inst|IPXV_Inst]].
+
[[PXV:IPXV_Inst|IPXV_Inst]]

Latest revision as of 23:54, 21 April 2016


Converts string identifier to numerical identifier.

Syntax

HRESULT Str2ID([in]                    BSTR          sStr,
               [in, defaultvalue(-1)]  VARIANT_BOOL  bAddIfNotExists,
               [out, retval]           LONG*         nID);

Parameters

sStr
[in] The string identifier to be converted to number.
bAddIfNotExists
[in, defaultvalue(-1)] Indicates whether to add input string to the global table of string-identifiers. Default value is true.
nID
[out, retval] Returns the numeric ID.

Return Value

Returns S_OK if operation was successful or error code in other cases.

Sample

//C#
private void AddContent(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst, PDFXEdit.IPXC_Content Content)
{
	int nID = Inst.Str2ID("op.addContent", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	input.Add().v = Doc.CoreDoc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["Content"].v = Content;
	options["TargetPage"].v = 0;
	options["InsertClone"].v = true;
	Op.Do();
}

See Also

IPXV_Inst