简体   繁体   English

将标注类型注释添加到iOS PDFTron库

[英]Adding Callout type annotation to iOS PDFTron library

I am facing an issue wherein the PDFNET framework for iOS is successfully rendering callout type annotation made from other platform. 我面临一个问题,其中iOS的PDFNET框架成功呈现了从其他平台制作的标注类型注释。 But I am unable to allow users of iOS app to make the same annotation from start. 但是我无法允许iOS应用程序的用户从一开始就进行相同的注释。

This is a programmatic example of how to create a callout annotation using PDFNet: 这是一个如何使用PDFNet创建标注注释的程序化示例:

    let txtannot: PTFreeText = PTFreeText.create(doc.getSDFDoc(), pos: PTPDFRect(x1: 100, y1: 100, x2: 350, y2: 500))
        txtannot.setContentRect(PTPDFRect(x1: 200, y1: 200, x2: 350, y2: 500))
        txtannot.setContents("\n\nSome swift brown fox snatched a gray hare out of the air by freezing it with an angry glare." +
            "\n\nAha!\n\nAnd there was much rejoicing!")
        txtannot.setCalloutLinePoints(withKneePoint: PTPDFPoint(px: 200, py: 300), p2: PTPDFPoint(px: 150, py: 290), p3: PTPDFPoint(px: 110, py: 110))
        txtannot.setBorderStyle(PTBorderStyle(s: e_ptsolid, b_width: 1, b_hr: 10, b_vr: 20), oldStyleOnly: true)
        txtannot.setEndingStyle(e_ptClosedArrow)
        txtannot.setColor(PTColorPt(x: 0, y: 1, z: 0, w: 0), numcomp: 3)
        txtannot.setQuaddingFormat(1)
        first_page.annotPushBack(txtannot)
        txtannot.refreshAppearance()

(An Obj-C version can be found in the miscellaneous sample project, or on PDFTron's website .) (可以在其他示例项目或PDFTron网站上找到Obj-C版本。)

If you wish to create a callout annotation interactively, you will need to create a new "tool" to do so. 如果您希望以交互方式创建标注注释,则需要创建一个新的“工具”。 All of PDFNet for iOS's UI widgets and annotation creation/editing methods are part of the open source framework Tools.framework, found in /Lib/Tools . 用于iOS的UINet小部件的所有PDFNet和注释创建/编辑方法都是/Lib/Tools开源框架Tools.framework的一部分。 By using existing tools as sa guide (which create free text annotations, text markup annotations, fill forms, sign documents, etc.), you can create a new tool for creating callout annotations interactively. 通过使用现有工具作为指南(可创建免费的文本注释,文本标记注释,填写表格,签名文档等),您可以创建一个新工具来交互式创建标注注释。

SO discolsure: I work for PDFTron. 所以公开:我为PDFTron工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM