Post not yet marked as solved
Post marked as unsolved with 1 replies, 1,117 views
So I have this pdfView and I wanna make it so its first display is a zoom of 100% of the page, but the problem is that what I have now is zooming in to much and the UI is not pretty to be like that. It just like zooms to much and I want it to be perfectly zoomed to fit the screen size.
I have tried and can't find a solution.
My code is this:
		pdfView.translatesAutoresizingMaskIntoConstraints = false
		pdfView.autoScales = true
		pdfView.maxScaleFactor = 4.0
		pdfView.minScaleFactor = pdfView.scaleFactorForSizeToFit
		view.addSubview(pdfView)
		pdfView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true
		pdfView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true
		pdfView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
		pdfView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
		
		
		guard let path = Bundle.main.url(forResource: materia , withExtension: "pdf") else { return }
		if let document = PDFDocument(url: path) {
				pdfView.document = document
		}