op.document.addImage

From PDF XChange PDF SDK
Jump to: navigation, search
(Created page with "Category:Editor {{#customTitle:op.document.addImage}} {{#parentPage:PXV:Operations|op.document.addImage|operation}} {{ToWrite}} {{ToReview}} == Overview == The operation...")
 
Line 26: Line 26:
 
| Dictionary with options of the operation.
 
| Dictionary with options of the operation.
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
private void AddImageToFirstPage(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
 +
{
 +
if (Doc == null)
 +
return;
 +
int nID = Inst.Str2ID("op.document.addImage", false);
 +
PDFXEdit.IOperation pOp = Inst.CreateOp(nID);
 +
PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
 +
input.v = Doc;
 +
PDFXEdit.ICabNode options = pOp.Params.Root["Options"];
 +
options["Page"].v = 0; //First page
 +
options["Pos.top"].v = 400;
 +
options["Pos.left"].v = 50;
 +
options["Pos.right"].v = 400;
 +
options["Pos.bottom"].v = 50;
 +
options["AlignMode"].v = 1 | 4; //Horizontal and vertical center
 +
options["AsStamp"].v = false; //Inserting as a part of the content
 +
PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
 +
PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("D:\\TestImage.png"); //Converting string to name
 +
options["Src"].v = destPath;
 +
pOp.Do();
 +
}
 +
</pre>

Revision as of 03:57, 5 January 2016


Overview

The operation overview...

Parameters

Name Type Description
Input Array Array of IUnknown-based objects.
Output Array Array of IUnknown-based objects.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void AddImageToFirstPage(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
{
	if (Doc == null)
		return;
	int nID = Inst.Str2ID("op.document.addImage", false);
	PDFXEdit.IOperation pOp = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
	input.v = Doc;
	PDFXEdit.ICabNode options = pOp.Params.Root["Options"];
	options["Page"].v = 0;	//First page
	options["Pos.top"].v = 400;
	options["Pos.left"].v = 50;
	options["Pos.right"].v = 400;
	options["Pos.bottom"].v = 50;
	options["AlignMode"].v = 1 | 4; //Horizontal and vertical center
	options["AsStamp"].v = false; //Inserting as a part of the content
	PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Inst.GetExtension("AFS");
	PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("D:\\TestImage.png"); //Converting string to name
	options["Src"].v = destPath;
	pOp.Do();
}