op.replaceContent

From Tracker Software PDF SDK
Jump to: navigation, search
(Automatic page editing by robot)
 
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{#customTitle:op.replaceContent}}
 
{{#customTitle:op.replaceContent}}
 
{{#parentPage:PXV:Operations|op.replaceContent|operation}}
 
{{#parentPage:PXV:Operations|op.replaceContent|operation}}
{{ToWrite}}
+
 
 
{{ToReview}}
 
{{ToReview}}
  
 
== Overview ==
 
== Overview ==
The operation overview...
+
The operation allows you to replace a part of an active PDF document with a part of already opened [[PXV:IPXC_Content|IPXC_Content]].
  
 
== Parameters ==
 
== Parameters ==
Line 15: Line 15:
 
|-
 
|-
 
| class="op_param_name" | Input
 
| class="op_param_name" | Input
| style="text-align:center" | Array
+
| style="text-align:center" | IUnknown
| Array of <code>IUnknown</code>-based objects.
+
| <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] that will have it's pages changed.
 
|-
 
|-
 
| class="op_param_name" | Output
 
| class="op_param_name" | Output
| style="text-align:center;" | Array
+
| style="text-align:center;" | IUnknown
| Array of <code>IUnknown</code>-based objects.
+
| <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] that had it's pages changed.
 
|-
 
|-
 
| class="op_param_name" | [[PXV:op_replaceContent_Options|Options]]
 
| class="op_param_name" | [[PXV:op_replaceContent_Options|Options]]
Line 26: Line 26:
 
| Dictionary with options of the operation.
 
| Dictionary with options of the operation.
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
private void pDFToGrayscaleToolStripMenuItem_Click(object sender, EventArgs e)
 +
{
 +
PDFXEdit.IPXC_Page page = pdfCtl.Doc.CoreDoc.Pages[0];
 +
//Getting full clone of the content so we can modify it fully
 +
PDFXEdit.IPXC_Content content = page.GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_FullClone);
 +
//Getting image or inline image types of the content items
 +
for (uint i = 0; i < content.Items.Count; i++)
 +
{
 +
PDFXEdit.IPXC_ContentItem ci = content.Items[i];
 +
if ((ci.Type == PDFXEdit.PXC_CIType.CIT_Image) || (ci.Type == PDFXEdit.PXC_CIType.CIT_InlineImage))
 +
{
 +
PDFXEdit.IIXC_Page ip = ci.Image_CreateIXCPage(true);
 +
PDFXEdit.IPXC_Image im = pdfCtl.Doc.CoreDoc.AddImageFromIXCPage(ip);
 +
ci.Image_Object = im;
 +
}
 +
}
 +
//...
 +
//Your changes to content
 +
//...
 +
//Now launching the replace content operation
 +
int nID = pdfCtl.Inst.Str2ID("op.replaceContent", false);
 +
PDFXEdit.IOperation Op = pdfCtl.Inst.CreateOp(nID);
 +
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 +
input.Add().v = pdfCtl.Doc.CoreDoc;
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
options["NewContent"].v = content;
 +
options["TargetPage"].v = 0;
 +
Op.Do();
 +
}
 +
</pre>

Latest revision as of 06:28, 21 April 2016


Overview

The operation allows you to replace a part of an active PDF document with a part of already opened IPXC_Content.

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 pDFToGrayscaleToolStripMenuItem_Click(object sender, EventArgs e)
{
	PDFXEdit.IPXC_Page page = pdfCtl.Doc.CoreDoc.Pages[0];
	//Getting full clone of the content so we can modify it fully
	PDFXEdit.IPXC_Content content = page.GetContent(PDFXEdit.PXC_ContentAccessMode.CAccessMode_FullClone);
	//Getting image or inline image types of the content items
	for (uint i = 0; i < content.Items.Count; i++)
	{
		PDFXEdit.IPXC_ContentItem ci = content.Items[i];
		if ((ci.Type == PDFXEdit.PXC_CIType.CIT_Image) || (ci.Type == PDFXEdit.PXC_CIType.CIT_InlineImage))
		{
			PDFXEdit.IIXC_Page ip = ci.Image_CreateIXCPage(true);
			PDFXEdit.IPXC_Image im = pdfCtl.Doc.CoreDoc.AddImageFromIXCPage(ip);
			ci.Image_Object = im;
		}
	}
	//...
	//Your changes to content
	//...
	//Now launching the replace content operation
	int nID = pdfCtl.Inst.Str2ID("op.replaceContent", false);
	PDFXEdit.IOperation Op = pdfCtl.Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	input.Add().v = pdfCtl.Doc.CoreDoc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["NewContent"].v = content;
	options["TargetPage"].v = 0;
	Op.Do();
}