1

I'm using PDFKit to display pdf using pdfview to user and it works perfectly. here is my implementation of pdfview. and here are the properties of pdfview.

if let pdfdoc = PDFDocument(url: docurl) {
    print("working")
    pdfdocument = pdfdoc
    pdfview.document = pdfdocument
    pdfview.autoScales = false
    pdfview.delegate = self
    pdfview.displayMode = .singlePageContinuous
}

now what I want is to get exact origin of the current page. but it gives always (0,1) for each and every page. this is how I tried.

let currentpage = pdfview.currentPage
print(currentpage?.bounds(for: .mediaBox).origin.x)

the X value is always 0.

I have attached a screenshot which I want to get the x and y value of the page.

enter image description here

How can I get this x and y value of the pdf page. hope your help with this.

Marlon Brando aka Ben
  • 767
  • 1
  • 12
  • 25

1 Answers1

0

I'm using the following:

const pdfDoc = new PDFDocument({
  size: [
    pageParameters.width,
    pageParameters.height
  ],
  margins: {
    printing: 'highResolution',
    top: 0,
    bottom: 0,
    left: 0,
    right: 0
  }
})
Wayne Smallman
  • 1,444
  • 8
  • 32
  • 48