op.document.addImage
From PDF XChange PDF SDK
(Created page with "Category:Editor {{#customTitle:op.document.addImage}} {{#parentPage:PXV:Operations|op.document.addImage|operation}} {{ToWrite}} {{ToReview}} == Overview == The operation...") |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
{{#customTitle:op.document.addImage}} | {{#customTitle:op.document.addImage}} | ||
{{#parentPage:PXV:Operations|op.document.addImage|operation}} | {{#parentPage:PXV:Operations|op.document.addImage|operation}} | ||
− | {{ | + | {{SinceVersion|1.3.0.0}} |
{{ToReview}} | {{ToReview}} | ||
== Overview == | == Overview == | ||
− | The operation | + | The operation allows to place an image onto document's page as a part of the page's content or as stamp. |
== Parameters == | == Parameters == | ||
Line 16: | Line 16: | ||
| class="op_param_name" | Input | | class="op_param_name" | Input | ||
| style="text-align:center" | Array | | style="text-align:center" | Array | ||
− | | | + | | <code>IUnknown</code>-based object containing the [[PXV:IPXC_Document|IPXC_Document]] where the image would be placed at. |
|- | |- | ||
| class="op_param_name" | Output | | class="op_param_name" | Output | ||
| style="text-align:center;" | Array | | style="text-align:center;" | Array | ||
− | | | + | | <code>IUnknown</code>-based object containing the [[PXV:IPXC_Annotation|IPXC_Annotation]] when adding image as stamp or the [[PXV:INumArray|INumArray]] when adding image as content. |
|- | |- | ||
| class="op_param_name" | [[PXV:op_document_addImage_Options|Options]] | | class="op_param_name" | [[PXV:op_document_addImage_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 AddImageToFirstPage(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst) | ||
+ | { | ||
+ | if (Doc == null) | ||
+ | return; | ||
+ | int nID = Inst.Str2ID("op.document.addImage", 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["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; | ||
+ | Op.Do(); | ||
+ | } | ||
+ | </pre> |
Latest revision as of 23:46, 18 April 2016
Available since API version
1.3.0.0
Overview
The operation allows to place an image onto document's page as a part of the page's content or as stamp.
Parameters
Name | Type | Description |
---|---|---|
Input | Array | IUnknown -based object containing the IPXC_Document where the image would be placed at.
|
Output | Array | IUnknown -based object containing the IPXC_Annotation when adding image as stamp or the INumArray when adding image as content.
|
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 Op = Inst.CreateOp(nID); PDFXEdit.ICabNode input = Op.Params.Root["Input"]; input.v = Doc; PDFXEdit.ICabNode options = Op.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; Op.Do(); }