op.annots.addNew
From PDF XChange PDF SDK
(→Sample) |
(→Sample) |
||
Line 41: | Line 41: | ||
if (pAnnot == null) | if (pAnnot == null) | ||
return; | 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); | int nID = pInst.Str2ID("op.annots.addNew", false); | ||
PDFXEdit.IOperation pOp = pInst.CreateOp(nID); | PDFXEdit.IOperation pOp = pInst.CreateOp(nID); |
Revision as of 06:45, 19 February 2016
Overview
The operation overview...
Parameters
Name | Type | Description |
---|---|---|
Input | Array | Array of IUnknown -based objects.
|
Output | Array | Array of IUnknown -based objects.
|
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(); }