public void PDFiumBridge_FPDFAnnotGetLine_SimpleCall_NoException() { var start = new FS_POINTF(); var end = new FS_POINTF(); _bridge.FPDFAnnot_GetLine(FPDF_ANNOTATION.InvalidHandle, ref start, ref end); }
public void PDFiumBridge_FPDFAnnotGetFormFieldAtPoint_SimpleCall_NoException() { var point = new FS_POINTF(); _bridge.FPDFAnnot_GetFormFieldAtPoint(FPDF_FORMHANDLE.InvalidHandle, FPDF_PAGE.InvalidHandle, ref point); }
public void PDFiumBridge_FPDFAnnotAddInkStroke_SimpleCall_NoException() { var points = new FS_POINTF[2]; _bridge.FPDFAnnot_AddInkStroke(FPDF_ANNOTATION.InvalidHandle, ref points, 0); }
public void PDFiumBridge_FPDFPageGetAnnot_TestForExistence_Success() { var pdfFile = Path.Combine(_pdfFilesFolder, "Annotations.pdf"); var bridge = new PDFiumBridge(); var document = bridge.FPDF_LoadDocument(pdfFile, null); Assert.IsTrue(document.IsValid); var page = bridge.FPDF_LoadPage(document, 0); Assert.IsTrue(page.IsValid); var count = bridge.FPDFPage_GetAnnotCount(page); for (var index = 0; index < count; index++) { var annot = bridge.FPDFPage_GetAnnot(page, index); Assert.IsTrue(annot.IsValid); var realIndex = bridge.FPDFPage_GetAnnotIndex(page, annot); Assert.AreEqual(index, realIndex); var subtype = bridge.FPDFAnnot_GetSubtype(annot); Assert.IsTrue(subtype != FPDF_ANNOTATION_SUBTYPE.FPDF_ANNOT_UNKNOWN); var objectCount = bridge.FPDFAnnot_GetObjectCount(annot); for (var objectIndex = 0; objectIndex < objectCount; objectIndex++) { var obj = bridge.FPDFAnnot_GetObject(annot, objectIndex); Assert.IsTrue(obj.IsValid); } var pointsCount = bridge.FPDFAnnot_CountAttachmentPoints(annot); for (var pointsIndex = 0; pointsIndex < pointsCount; pointsIndex++) { var points = new FS_QUADPOINTSF(); Assert.IsTrue(bridge.FPDFAnnot_GetAttachmentPoints(annot, pointsIndex, ref points)); } var rect = new FS_RECTF(); Assert.IsTrue(bridge.FPDFAnnot_GetRect(annot, ref rect)); var verticesCount = bridge.FPDFAnnot_GetVertices(annot, IntPtr.Zero, 0); if (verticesCount != 0) { var points = new FS_POINTF[verticesCount]; var pointsIntPtr = NativeMethods.StructureArrayToIntPtr(points); Assert.AreEqual(verticesCount, bridge.FPDFAnnot_GetVertices(annot, pointsIntPtr, verticesCount)); Marshal.FreeHGlobal(pointsIntPtr); } float horizontal_radius, vertical_radius, border_width; horizontal_radius = vertical_radius = border_width = -1f; if (bridge.FPDFAnnot_GetBorder(annot, ref horizontal_radius, ref vertical_radius, ref border_width)) { Assert.IsTrue(horizontal_radius != -1f); Assert.IsTrue(vertical_radius != -1f); Assert.IsTrue(border_width != -1f); } bridge.FPDFPage_CloseAnnot(annot); } bridge.FPDF_ClosePage(page); bridge.FPDF_CloseDocument(document); bridge.Dispose(); }