I want to display PDF with horizontal, pages from right to left, page by page continuously, and users pinch one page will make all pages the same scale synchronized.
I wrote the codes as below:
if let pdfDocument = PDFDocument(url: pdfUrl) {
pdfView.document = pdfDocument
pdfView.displayMode = .singlePageContinuous
pdfView.displaysRTL = true
pdfView.autoScales = true
pdfView.autoresizesSubviews = true
pdfView.displayDirection = .horizontal
pdfView.displaysPageBreaks = true
pdfView.pageBreakMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
pdfView.maxScaleFactor = 4.0
pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit
}
But displaysRTL will not work, and default scale will not show whole single page but fit to the PDF page height (page right side will out of screen).
If I add
pdfView.usePageViewController(true)
PDF displayRTL works, and every page will fit screen size by default. BUT this will make PDF not displayed page by page, and zoom in scale will not the same with other pages.
The left page scale is not the same with current zoom in page on the right side. I need them all the same scale if user pinch a page.
Is there any way to fix this problem?
In addition, every page's top-left corner will display an icon, I don't know what is it mean and how to hide it..
from PDFKit - PdfView won't be RTL without usePageViewController()
No comments:
Post a Comment