Sub GetInkDouble3() Dim HogeIF As ClassLibrary1_ink_CL.IHogehoge3 Set HogeIF = New ClassLibrary1_ink_CL.Hogehoge3 Dim d(5) As Double d(0) = 10.5 d(1) = 300.5 d(2) = 50.78 d(3) = 60.66 d(4) = 160.66 d(5) = 260.66 Dim src As String Dim dest As String Dim p As Long src = "C:/ほげほげ/読み込む.PDF" dest = "C:/ほげほげ/書き出す.PDF" p = 1 Call HogeIF.HogeMethod3(d, src, dest, p) End Sub
using System; using System.Runtime.InteropServices; using iText.Kernel.Colors; using iText.Kernel.Pdf; using iText.Kernel.Pdf.Annot; using Rectangle = iText.Kernel.Geom.Rectangle; namespace ClassLibrary1_ink_CL { [Guid("EF2CEEAD-04CB-4A86-896C-C8878A16A711")] public interface IHogehoge3 { void HogeMethod3(ref Double[] array, String SRC, String DEST, int p); } [Guid("D3868E78-0ABA-4BB5-B22E-4DF4BFDD3F7B")] [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] [ProgId("ClassLibrary1_ink_CL.Hogehoge.1")] public class Hogehoge3 :IHogehoge3 { public void HogeMethod3(ref Double[] array,String SRC,String DEST, int p) { //Initialize PDF document PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(DEST)); //Creating a PdfPage PdfPage page = pdfDoc.GetPage(p); //creating PdfLineAnnotation object Rectangle rect = new Rectangle(0, 0, 0, 0); PdfArray outer = new PdfArray(); PdfArray inner = new PdfArray(); for (int k = 0; k < array.Length; ++k) { inner.Add(new PdfNumber(array[k])); } outer.Add(inner); //dummy outer.Add(inner); PdfInkAnnotation inkAnnotation = new PdfInkAnnotation(rect, outer); // Set arrow's border style PdfDictionary borderStyle = new PdfDictionary(); borderStyle.Put(PdfName.S, PdfName.S); borderStyle.Put(PdfName.W, new PdfNumber(3)); inkAnnotation.SetBorderStyle(borderStyle); //Setting color of the PdfLineAnnotation inkAnnotation.SetColor(ColorConstants.RED); //Setting title to the PdfLineAnnotation inkAnnotation.SetTitle(new PdfString("iText")); //Setting contents of the PdfLineAnnotation inkAnnotation.SetContents("Hi welcome to finddevguides"); //Adding annotation to the page page.AddAnnotation(inkAnnotation); //Closing the document pdfDoc.Close(); } } }