op.annots.addNew
From PDF XChange PDF SDK
(→Sample) |
|||
Line 2: | Line 2: | ||
{{#customTitle:op.annots.addNew}} | {{#customTitle:op.annots.addNew}} | ||
{{#parentPage:PXV:Operations|op.annots.addNew|operation}} | {{#parentPage:PXV:Operations|op.annots.addNew|operation}} | ||
− | |||
{{ToReview}} | {{ToReview}} | ||
== Overview == | == Overview == | ||
− | The operation | + | The operation forms undo/redo data, sends correspondent events and modifies the document when the annotations were added on the Core level. |
== Parameters == | == Parameters == | ||
Line 16: | Line 15: | ||
| class="op_param_name" | Input | | class="op_param_name" | Input | ||
| style="text-align:center" | Array | | style="text-align:center" | Array | ||
− | | Array of <code>IUnknown</code>-based objects. | + | | Array of <code>IUnknown</code>-based objects containing the [[PXV:IPXC_Annotation|IPXC_Annotation]] objects that were inserted to the document on the Core level. Note that all of the annotations must belong to one document. |
|- | |- | ||
| class="op_param_name" | Output | | class="op_param_name" | Output | ||
| style="text-align:center;" | Array | | style="text-align:center;" | Array | ||
− | | Array of <code>IUnknown</code>-based objects. | + | | Array of <code>IUnknown</code>-based objects containing the [[PXV:IPXC_Document|IPXC_Document]] to which the annotations were added. |
|} | |} | ||
Latest revision as of 02:59, 2 March 2016
Overview
The operation forms undo/redo data, sends correspondent events and modifies the document when the annotations were added on the Core level.
Parameters
Name | Type | Description |
---|---|---|
Input | Array | Array of IUnknown -based objects containing the IPXC_Annotation objects that were inserted to the document on the Core level. Note that all of the annotations must belong to one document.
|
Output | Array | Array of IUnknown -based objects containing the IPXC_Document to which the annotations were added.
|
Sample
//C# private void AddSquareAnnotation(PDFXEdit.IPXV_Document pDoc, PDFXEdit.PXV_Inst pInst) { if (pDoc == null) return; PDFXEdit.IPXC_Page pPage = pDoc.CoreDoc.Pages[0]; PDFXEdit.PXC_Rect rc; rc.left = 50; rc.right = 100; rc.top = 50; rc.bottom = 100; PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)pInst.GetExtension("PXS"); //Inserting square annotation as example uint nSquare = pSInt.StrToAtom("Square"); PDFXEdit.IPXC_Annotation pAnnot = pPage.InsertNewAnnot(nSquare, ref rc, 0); if (pAnnot == null) return; //Modifying annotation data so that we will have dashed lines of chosen color with given opacity PDFXEdit.IPXC_AnnotData_SquareCircle SQData = (PDFXEdit.IPXC_AnnotData_SquareCircle)pAnnot.Data; SQData.Opacity = 0.7; var color = auxInst.CreateColor(PDFXEdit.ColorType.ColorType_RGB); color.SetRGB(0.0f, 1.0f, 1.0f); SQData.Color = color; var border = new PDFXEdit.PXC_AnnotBorder(); border.nStyle = PDFXEdit.PXC_AnnotBorderStyle.ABS_Dashed; border.nWidth = 4.0f; border.DashArray = new float[10]; border.DashArray[0] = border.DashArray[1] = 16.0f; //Width of dashes border.nDashCount = 2; //Number of dashes SQData.set_Border(border); pAnnot.Data = SQData; //Creating the operation that will send the event that the annotation was added to all of the listeners int nID = pInst.Str2ID("op.annots.addNew", false); PDFXEdit.IOperation pOp = pInst.CreateOp(nID); PDFXEdit.ICabNode input = pOp.Params.Root["Input"]; input.Add().v = pAnnot; pOp.Do(); }