op.combineDocs

From PDF XChange PDF SDK
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
| class="op_param_name" | Input
 
| class="op_param_name" | Input
 
| style="text-align:center" | Array
 
| style="text-align:center" | Array
| Array of <code>IUnknown</code>-based objects containing the [[PXV:IOpInputItem|IOpInputItem]] elements that have [[PXV:IAFS_Name|IAFS_Name]], [[PXV:IAFS_File|IAFS_File]] or [[PXV:IPXC_Document|IPXC_Document]] specified along with the correspondent pages range that will be used when merging.
+
| Array of <code>IUnknown</code>-based objects containing the [[PXV:IOpInputItem|IOpInputItem]] elements that have [[PXV:IAFS_Name|IAFS_Name]], [[PXV:IAFS_File|IAFS_File]] or [[PXV:IPXC_Document|IPXC_Document]] specified along with the correspondent pages range that will be used when merging. Or it can contain the [[PXV:IAFS_Name|IAFS_Name]], [[PXV:IAFS_File|IAFS_File]] or [[PXV:IPXC_Document|IPXC_Document]] elements passed directly - then all of the pages from the source files will be used.
 
|-
 
|-
 
| class="op_param_name" | Output
 
| class="op_param_name" | Output
 
| style="text-align:center;" | IUnknown
 
| style="text-align:center;" | IUnknown
 
| <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] that was merged from the input documents.
 
| <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] that was merged from the input documents.
 +
|-
 +
| class="op_param_name" | [[PXV:op_combineDocs_Options|Options]]
 +
| style="text-align:center;" | Dictionary
 +
| Dictionary with options of the operation.
 
|}
 
|}
  
Line 46: Line 50:
 
//Adding first item to the input array
 
//Adding first item to the input array
 
input.Add().v = inpItem2;
 
input.Add().v = inpItem2;
 +
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
options["AddRootBookmarks"].v = true;
  
 
Op.Do();
 
Op.Do();

Latest revision as of 01:16, 1 June 2017


Overview

The operation allows to merge several documents into one.

Parameters

Name Type Description
Input Array Array of IUnknown-based objects containing the IOpInputItem elements that have IAFS_Name, IAFS_File or IPXC_Document specified along with the correspondent pages range that will be used when merging. Or it can contain the IAFS_Name, IAFS_File or IPXC_Document elements passed directly - then all of the pages from the source files will be used.
Output IUnknown IUnknown-based object containing the IPXC_Document that was merged from the input documents.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void CombineDocuments(PDFXEdit.IPXC_Document Doc1, PDFXEdit.IPXC_Document Doc2, PDFXEdit.PXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.combineDocs", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	//This operation has quite a unique input that uses IOpInputItem
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];

	//Filling first input document params
	PDFXEdit.IOpInputItem inpItem1 = Op.CreateInputItem(Doc1);
	//Taking first 3 pages from first document
	inpItem1.Params.Root["PagesRange.Type"].v = "Exact";
	inpItem1.Params.Root["PagesRange.Text"].v = "1-3";
	//Adding first item to the input array
	input.Add().v = inpItem1;

	//Filling second input document params
	PDFXEdit.IOpInputItem inpItem2 = Op.CreateInputItem(Doc2);
	//Taking second page from the second document
	inpItem2.Params.Root["PagesRange.Type"].v = "Exact";
	inpItem2.Params.Root["PagesRange.Text"].v = "2";
	//Adding first item to the input array
	input.Add().v = inpItem2;

	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["AddRootBookmarks"].v = true;

	Op.Do();
	//Getting resulting document
	PDFXEdit.IPXC_Document resDoc = (PDFXEdit.IPXC_Document)Op.Params.Root["Output"].v;
	//pdfCtl.OpenDocFrom(resDoc);
}