op.combineDocs

From PDF XChange PDF SDK
Jump to: navigation, search
Line 2: Line 2:
 
{{#customTitle:op.combineDocs}}
 
{{#customTitle:op.combineDocs}}
 
{{#parentPage:PXV:Operations|op.combineDocs|operation}}
 
{{#parentPage:PXV:Operations|op.combineDocs|operation}}
{{ToWrite}}
 
 
{{ToReview}}
 
{{ToReview}}
  
Line 22: Line 21:
 
| <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.
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//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;
 +
 +
Op.Do();
 +
//Getting resulting document
 +
PDFXEdit.IPXC_Document resDoc = (PDFXEdit.IPXC_Document)Op.Params.Root["Output"].v;
 +
//pdfCtl.OpenDocFrom(resDoc);
 +
}
 +
</pre>

Revision as of 07:49, 3 March 2016


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.
Output IUnknown IUnknown-based object containing the IPXC_Document that was merged from the input documents.

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;

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