【问题标题】:Why pdf annotation Y position starts from the bottom of the page in ios, pdfkit, swift为什么pdf注解Y位置在ios、pdfkit、swift中从页面底部开始
【发布时间】:2019-04-09 06:09:26
【问题描述】:

我尝试在 pdf 中为页面添加注释。有用。但不在所需的位置。这是我添加注释的方式。

let annotaionpos = CGRect(origin: points, size: CGSize(width: 80, height: 30))
let annotation = PDFAnnotation(bounds: annotaionpos, forType: .text, withProperties: nil)
annotation.backgroundColor = .purple
pdfView.currentPage?.addAnnotation(annotation)

在上面的代码中,x position 是正确的,y position 似乎是相反的值。 ex: if x = 100 and y = 10 然后它从页面底部添加到正确的x 位置y 位置星。为什么是这样。希望您对此有所帮助。

【问题讨论】:

  • 你好马龙,你能分享一下预期结果的截图吗?
  • 因为 PDF 坐标是这样定义的。 “原点或 0,0 点位于页面的左下角。水平或 X 坐标向右增加,垂直或 Y 坐标向顶部增加”pdfscripting.com/public/PDF-Page-Coordinates.cfm

标签: ios swift pdfkit pdf-annotations


【解决方案1】:

【讨论】:

  • 虽然提供文档链接是一种很好的做法,但您至少可以尝试提取其中您认为有助于解决原始问题的部分内容。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多