Committed by
David PHAM-VAN
fix: wrong format in directPrintPdf
Showing
1 changed file
with
6 additions
and
4 deletions
@@ -135,12 +135,14 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate | @@ -135,12 +135,14 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate | ||
135 | printing.onCompleted(printJob: self, completed: completed, error: error?.localizedDescription as NSString?) | 135 | printing.onCompleted(printJob: self, completed: completed, error: error?.localizedDescription as NSString?) |
136 | } | 136 | } |
137 | 137 | ||
138 | - public func printInteractionController(_ printInteractionController: UIPrintInteractionController, cutLengthFor paper: UIPrintPaper) -> CGFloat { | ||
139 | - if currentSize == nil{ | ||
140 | - return paper.paperSize.height | 138 | + public func printInteractionController(_ printController: UIPrintInteractionController, choosePaper paperList: [UIPrintPaper]) -> UIPrintPaper { |
139 | + if currentSize == nil { | ||
140 | + return paperList[0] | ||
141 | } | 141 | } |
142 | 142 | ||
143 | - return currentSize!.height | 143 | + let bestPaper = UIPrintPaper.bestPaper(forPageSize: currentSize!, withPapersFrom: paperList) |
144 | + | ||
145 | + return bestPaper | ||
144 | } | 146 | } |
145 | 147 | ||
146 | func printPdf(name: String, withPageSize size: CGSize, andMargin margin: CGRect, withPrinter printerID: String?, dynamically dyn: Bool) { | 148 | func printPdf(name: String, withPageSize size: CGSize, andMargin margin: CGRect, withPrinter printerID: String?, dynamically dyn: Bool) { |
-
Please register or login to post a comment