我将 pdfdocument 添加到 PDFView 。但它正在显示边缘,也显示在慢跑中。如何删除此边距。有没有办法将 pdfdocument 设置为左上角。

我将 pdfdocument 添加到 PDFView 。但它正在显示边缘,也显示在慢跑中。如何删除此边距。有没有办法将 pdfdocument 设置为左上角。

我认为这将有助于解决问题。
https://developer.apple.com/documentation/pdfkit/pdfview/2881210-pagebreakmargins
pageBreakMargins只需通过传递一个值来为这个变量设置一个UIEdgeInsets值。
像这样的东西
self.pdfView.pageBreakMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
这是示例代码:
private func openPdf() {
let pdfView = PDFView(frame: CGRect(x: 0, y: 20, width: self.view.frame.width, height: self.view.frame.height))
view.addSubview(pdfView)
guard let path = Bundle.main.url(forResource: "test", withExtension: "pdf") else { return }
if let document = PDFDocument(url: path) {
pdfView.document = document
pdfView.pageShadowsEnabled = false
pdfView.displayMode = .singlePage
pdfView.autoScales = true
pdfView.frame.size.height = pdfView.documentView?.frame.height ?? self.view.frame.height
self.view.layoutIfNeeded()
pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit
}
}