op.document.replacePages

From PDF XChange PDF SDK
Jump to: navigation, search
(Sample)
 
Line 32: Line 32:
 
{
 
{
 
int nID = Inst.Str2ID("op.document.replacePages", false);
 
int nID = Inst.Str2ID("op.document.replacePages", false);
PDFXEdit.IOperation pOp = Inst.CreateOp(nID);
+
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
+
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 
input.v = Doc;
 
input.v = Doc;
PDFXEdit.ICabNode options = pOp.Params.Root["Options"];
+
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 
options["PagesRange.Type"].v = "Exact";
 
options["PagesRange.Type"].v = "Exact";
 
options["PagesRange.Text"].v = "1-3"; //Selecting 1,2,3 pages from file
 
options["PagesRange.Text"].v = "1-3"; //Selecting 1,2,3 pages from file
Line 45: Line 45:
 
PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("D:\\TestFile.pdf"); //Converting string to name
 
PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("D:\\TestFile.pdf"); //Converting string to name
 
options["Src"].v = destPath; //Source document
 
options["Src"].v = destPath; //Source document
pOp.Do();
+
Op.Do();
 
}
 
}
 
</pre>
 
</pre>

Latest revision as of 07:48, 20 April 2016


Overview

The operation allows you to replace content a part of an active PDF document with a part of already opened PDF document or located in a destination folder file all supported formats.

Parameters

Name Type Description
Input IUnknown IUnknown-based object containing the IPXC_Document that will have it's pages changed.
Output IUnknown IUnknown-based object containing the IPXC_Document that had it's pages changed.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void ReplacePages(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.document.replacePages", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	input.v = Doc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["PagesRange.Type"].v = "Exact";
	options["PagesRange.Text"].v = "1-3"; //Selecting 1,2,3 pages from file
	options["CommentsAction"].v = 0; //Don't copy comments
	options["BookmarksAction"].v = 0; //Don`t copy bookmarks
	options["Position"].v = 1; //Start index of the source pages that will replace the document's pages
	options["PositionStop"].v = 3; //End index of the source pages that will replace the document's pages
	PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
	PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("D:\\TestFile.pdf"); //Converting string to name
	options["Src"].v = destPath; //Source document
	Op.Do();
}