-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scale resize PDF #60
Comments
The solutions I've found are to:
There may be some normal way but these are the two solutions I found under time constraints. |
I'm doing the following: @IBAction func printBookingsAction(_ sender: Any) {
let dpi = DPIType.dpi_300
let diaryViewController = UIStoryboard(name: "Bookings", bundle: Bundle.main).instantiateViewController(withIdentifier: "DiaryViewController") as! DiaryViewController
diaryViewController.loadViewIfNeeded()
diaryViewController.currentHourSection = nil
let collectionView = diaryViewController.collectionView!
collectionView.removeFromSuperview()
collectionView.size(size: CGSize(width: PDFPageSize.A4.width, height: collectionView.collectionViewLayout.collectionViewContentSize.height))
collectionView.reloadData()
collectionView.layoutIfNeeded()
collectionView.transform = CGAffineTransform(scaleX: dpi.scaleFactor, y: dpi.scaleFactor)
let page = PDFPage.view(collectionView)
do {
let destination = NSHomeDirectory() + "/booking-today.pdf"
try PDFGenerator.generate(page, to: destination, dpi: dpi, password: "")
self.printPDF(filePath: destination)
} catch let e {
print(e)
}
} But this produces a PDF with the output size of: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to resize the PDF but the solution #45 will not scale the PDF for me. Is it possible to resize the Generate PDF ?
The text was updated successfully, but these errors were encountered: