- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正处于最终确定 PDFTron 的阶段,并且正在尝试一些重要的功能。有必要在 PDF 上显示图像并对用户交互使用react。通过给定的示例,我发现我必须使用 PTFileAttachment
,如下所示:
let file_attach = PTFileAttachment.createFileAttch(withPath: doc.getSDFDoc(), pos: PTPDFRect(x1: 80, y1: 280, x2: 200, y2: 320), path: Bundle.main.path(forResource: "peppers", ofType: "jpg"), icon_name: e_ptPushPin)
first_page.annotPushBack(file_attach)
似乎即使在给定的示例中它也不起作用。 PTFileAttachment
显示的是图钉而不是图像。因此我的问题是:
谢谢!
问你瑞安的问题
假设有一个平面图(pdf),我必须用精确的图片(特定窗口的图形表示)来定位和显示那里的所有 window 。换句话说,只是简单地将图像定位在 pdf 上。 PDF 的尺寸可以是 600 单位 x 600 单位,图像在 x: 200 和 y:300 位置处可以是 40 单位 x 40 单位。可以有很多窗口。
根据 PDFTron 的文档 PTFileAttachment
是满足要求的正确工具,但如何使用是问题。从您自己的示例中,有一个示例知道Annotations
的Miscellaneous Swift Samples
,但它似乎也不起作用。我尝试了您提供的代码作为答案并进行了许多更正,但它仍然显示图钉
而不是显示图像。
复制步骤
peppers.jpg
peppers.jpg
最佳答案
听起来您想更改文件附件注释的外观:
func createImageAppearance(doc: PTPDFDoc, img: PTImage) -> PTObj {
let builder: PTElementBuilder = PTElementBuilder()
let writer: PTElementWriter = PTElementWriter()
writer.writerBegin(with: doc.getSDFDoc(), compress: true)
let w: Int32 = img.getWidth()
let h: Int32 = img.getHeight()
let element = builder.createImage(withCornerAndScale: img, x: 0, y: 0, hscale: Double(w), vscale: Double(h))
writer.writePlacedElement(element)
let appearance_stream: PTObj = writer.end()
appearance_stream.putRect("BBox", x1: 0, y1: 0, x2: Double(w), y2: Double(h))
return appearance_stream
}
let image: PTImage = PTImage.create(doc.getSDFDoc(), filename: Bundle.main.path(forResource: "peppers", ofType: "jpg"))
let file_attach: PTFileAttachment = PTFileAttachment.createFileAttch(withPath: doc.getSDFDoc(), pos: PTPDFRect(x1: 80, y1: 280, x2: 200, y2: 320), path: Bundle.main.path(forResource: "peppers", ofType: "jpg"), icon_name: e_ptPushPin)
first_page.annotPushBack(file_attach)
let app_stm: PTObj = createImageAppearance(doc: doc, img: image)
file_attach.setAppearance(app_stm, annot_state: e_ptnormal, app_state: "")
关于ios - PDFTron:带有自定义图像的 PTFileAttachment 未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51626526/
PDFTron 可以选择提供自定义 Javascript 文件来修改查看器,但我不确定该文件中应该包含什么,而且我在网上找不到任何示例。 该网站有如下描述: Viewer Options - By d
我正在使用 PdfTron SDK 并且我正在尝试在用户放大后绘制注释,注释需要在书的侧面(第三张图片)但是当我们放大时它正在绘制书的中心(图 1 和 2)。 缩放示例(错误状态): 没有缩放的例子(
我正在使用 pdftron 库来渲染和编辑 pdf。我有一个场景,我必须获取注释的坐标并将其保存到数据库,如果形状被删除,则从数据库中删除这些坐标。我设法记录了绘制坐标和删除坐标,但绘制坐标和删除坐标
我正在尝试使用 PdfTron 创建 PDF 编辑原型(prototype)软件。 我已成功创建界面,用户可以在该界面中单击从 PDF 创建的图像,选择区域,然后将显示一个文本输入框,然后他/她可以在
在 PDFTron WebViewer 中,当单击标题中的注释工具,然后单击正在查看的 PDF 时,左侧面板中会弹出回复框: 如果单击时间戳旁边的 3 个点,然后单击“编辑”: 您将看到评论框: 有没
在 PDFTron Viewer 2.2.2 中,我们添加了拖放缩略图以移动页面。 但在 3.0.1 和 3.1.0 中,这是不可能的。您是否阻止了拖放事件? (所有浏览器都受影响) 这里是我们 co
我将 PDFTron 用于内部网站。当我单击 PDFTron 中的自由文本工具时,它工作正常。我需要的是在文本工具的 focusout() 上我需要选择平移工具。 有人可以指导我如何去做吗? 最佳答案
将批量 html 文件转换为 pdf 时,出现转换失败错误。对于同一个 html 文件,有时它可以工作。主要是每当有更多文件时,一两个就会失败。 PdfTron 版本:2016 年 9 月,环境:Li
我有一个 pdf tron sdk 集成的问题,我单独尝试过但没有用,所以我尝试运行他们的示例之一,但我总是有 5 个未能解决文件错误。他们的文档不容易阅读而且我没有理解如何通过 gradle 或手动
我正在尝试绘制注释,在 80% 的情况下,注释可以正确绘制,但有时注释会在中间被切断,在我放大和缩小后,注释会完全绘制。 这是我绘制注释的代码: public void createNoteIconO
我正处于最终确定 PDFTron 的阶段,并且正在尝试一些重要的功能。有必要在 PDF 上显示图像并对用户交互使用react。通过给定的示例,我发现我必须使用 PTFileAttachment,如下所
我有一个 PDFTron webviewer,我用它来呈现 pdf 表单。当用户单击外部保存按钮时,我需要从 webviewer 中提取表单 xml。 我试过了 var am = readerCont
有没有办法抑制页面出现时覆盖在页面上然后在淡入淡出动画中消失的页码(例如“1/253”)?它是 PTPDFViewCtrl View 中的一个 UILabel,但我在文档中找不到任何指示如何配置它以防
我尝试使用 PDFTron 添加输入字段,但 PDF 中没有显示任何内容, 我关注了这个文档: https://www.pdftron.com/documentation/samples/js/Int
我在尝试与 PDFTron 集成时遇到一个奇怪的错误,即 PDFNet Android SDK: UnsatisfiedLinkError: Couldn't load PDFNetC: findLi
我试图获取一个 blob 作为 URL,但我在这一行收到错误: xhr.send() 错误消息是 angular.js:13920 Error: Failed to execute 'send on
我正在尝试获取所有注释,例如:INK 并从 Android 保存到数据库。 我查看了 PDFTron 示例,尤其是 ElementReaderAdvTest。我可以跟踪它处理 Element.e_pa
我有 PDFTron 的演示项目,在我本地的相同项目位置也有 Booking.pdf。 我编写了以下代码将 PDF 加载到 PDFTron 中 #viewer
我们正在使用 PdfTron 将 PDF 转换为 XOD,以便可以在 XPS 查看器中查看。 PDFTron 部署在 PCF 上并作为服务使用。 遇到这样的情况:一个简单的扫描 pdf 文件(5mb)
我想在我的应用程序上使用 PDFTron webviewer。我该怎么做? “注意:我安装了@pdftron 节点模块” 最佳答案 绝对可以在 Electron 应用程序中使用 WebViewer。我
我是一名优秀的程序员,十分优秀!