Is there a way to achieve the following using UIKit's PDFView class?

Viewed 31

I'm trying to display a PDF in the PDFView with the following features:

  1. Display 2 pages side-by-side while the iPhone in the portrait mode
  2. Fit the width to snap to the vertical edges of the screen
  3. Support RTL direction. (swipe from left to right to display next couple of pages it's an Arabic PDF)
  4. The page on the right is the first page and the left one is the second (again, Arabic PDF)

That's the code I tried and didn't achieve anything

struct PDFViewRep: UIViewRepresentable {
    func makeUIView(context: Context) -> UIView {
        let pdfView = PDFView()
        pdfView.document = Bundle.main.url(forResource: "file", withExtension: "pdf")!
        pdfView.displayMode = .twoUpContinuous
        pdfView.displayDirection = .horizontal
        pdfView.displayRTL = true
        return pdfView
    }

    func updateUIView(_ uiView: UIView, context: Context) {}
} 


struct MainView: View {
    var body: some View {
        PDFViewRep()
    }
}

Can anyone help?

0 Answers
Related