op.openDoc

From PDF XChange PDF SDK
Jump to: navigation, search
Line 25: Line 25:
 
| Dictionary with options of the operation.
 
| Dictionary with options of the operation.
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
private void OpenDocument(PDFXEdit.IPXV_MainFrame mainFrm, PDFXEdit.IPXV_Inst Inst)
 +
{
 +
int nID = Inst.Str2ID("op.openDoc", false);
 +
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
 +
PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
 +
PDFXEdit.IAFS_Name name = fsInst.DefaultFileSys.StringToName(@"D:\TestFile.pdf");
 +
var input = Op.Params.Root["Input"];
 +
input.v = name;
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
options["NativeOnly"].v = true;
 +
Op.Do();
 +
PDFXEdit.IPXC_Document doc = (PDFXEdit.IPXC_Document)Op.Params.Root["Output"].v;
 +
//Opening document in the given main Form
 +
mainFrm.OpenDocFrom(doc);
 +
}
 +
</pre>

Revision as of 23:56, 20 April 2016


Overview

The operation allows to open documents in the Editor Control from the given files.

Parameters

Name Type Description
Input IUnknown IUnknown-based object containing the (IAFS_Name, IAFS_File) that will have it's open document.
Output IUnknown IUnknown-based object containing the (IAFS_Name, IAFS_File) that had it's open document.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void OpenDocument(PDFXEdit.IPXV_MainFrame mainFrm, PDFXEdit.IPXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.openDoc", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
	PDFXEdit.IAFS_Name name = fsInst.DefaultFileSys.StringToName(@"D:\TestFile.pdf");
	var input = Op.Params.Root["Input"];
	input.v = name;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["NativeOnly"].v = true;
	Op.Do();
	PDFXEdit.IPXC_Document doc = (PDFXEdit.IPXC_Document)Op.Params.Root["Output"].v;
	//Opening document in the given main Form
	mainFrm.OpenDocFrom(doc);
}