op.document.replacePages

From PDF XChange PDF SDK
Jump to: navigation, search


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();
}