IPXV_Inst::CreateOp Method

From PDF XChange PDF SDK
Jump to: navigation, search
m (Automatic page editing by robot)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 
[[Category:Editor]]
 
[[Category:Editor]]
 
{{#customTitle:IPXV_Inst::CreateOp Method}}
 
{{#customTitle:IPXV_Inst::CreateOp Method}}
{{#parentPage:PXV:IPXV_Inst|method}}
+
{{#parentPage:PXV:IPXV_Inst#Methods|CreateOp|method}}
{{ToWrite}}
+
 
{{ToReview}}
 
{{ToReview}}
  
The method of interface of PDF-XChange Editor SDK.
+
Creates new operation object by specified unique identifier.
  
 
== Syntax ==
 
== Syntax ==
<pre class="brush:cpp;gutter:false">HRESULT CreateOp([in] LONG nOpID, [out, retval] IOperation** ppNewOp);</pre>
+
<pre class="brush:cpp;gutter:false">HRESULT CreateOp([in]           LONG         nOpID,
 +
                [out, retval] IOperation** pNewOp);</pre>
  
 
== Parameters ==
 
== Parameters ==
;''nOpID''
+
;nOpID
:[in]  Value of LONG.
+
:[in]  The unique identifier of registered operation. For example, you may obtain it by:
;''ppNewOp''
+
::<code>int nOpID = pdfInst.Str2ID("op.document.printPages");</code>
:[out, retval]  Pointer to [[PXV:IOperation|IOperation]].
+
;pNewOp
 +
:[out, retval]  Returns pointer to a new [[PXV:IOperation|IOperation]] object.
  
 
== 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 InsertEmptyPages(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
 +
{
 +
int nID = Inst.Str2ID("op.document.insertEmptyPages", false);
 +
PDFXEdit.IOperation pOp = Inst.CreateOp(nID);
 +
PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
 +
input.v = Doc;
 +
PDFXEdit.ICabNode options = pOp.Params.Root["Options"];
 +
options["PaperType"].v = 2; //Apply custom paper type
 +
options["Count"].v = 4; //Create 4 new pages
 +
options["Width"].v = 800; //Width of new pages
 +
options["Height"].v = 1200; //Height of new pages
 +
options["Location"].v = 1; //New pages will be inserted after first page
 +
options["Position"].v = 0; //Page number
 +
pOp.Do();
 +
}
 +
</pre>
  
 
== See Also ==
 
== See Also ==
See also [[PXV:IPXV_Inst|IPXV_Inst]].
+
[[PXV:IPXV_Inst|IPXV_Inst]], [[PXV:IPXV_Inst_Str2ID|IPXV_Inst::Str2ID]], [[PXV:IPXV_Inst_RegisterOpCreator|IPXV_Inst::RegisterOpCreator]]

Latest revision as of 00:49, 22 April 2016


Creates new operation object by specified unique identifier.

Syntax

HRESULT CreateOp([in]           LONG          nOpID,
                 [out, retval]  IOperation**  pNewOp);

Parameters

nOpID
[in] The unique identifier of registered operation. For example, you may obtain it by:
int nOpID = pdfInst.Str2ID("op.document.printPages");
pNewOp
[out, retval] Returns pointer to a new IOperation object.

Return Value

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

Sample

//C#
private void InsertEmptyPages(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.document.insertEmptyPages", false);
	PDFXEdit.IOperation pOp = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
	input.v = Doc;
	PDFXEdit.ICabNode options = pOp.Params.Root["Options"];
	options["PaperType"].v = 2; //Apply custom paper type 
	options["Count"].v = 4; //Create 4 new pages
	options["Width"].v = 800; //Width of new pages
	options["Height"].v = 1200; //Height of new pages
	options["Location"].v = 1; //New pages will be inserted after first page
	options["Position"].v = 0; //Page number
	pOp.Do();
}

See Also

IPXV_Inst, IPXV_Inst::Str2ID, IPXV_Inst::RegisterOpCreator