Committed by
David PHAM-VAN
fix: wrong format in directPrintPdf
Showing
1 changed file
with
8 additions
and
6 deletions
| @@ -134,13 +134,15 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate | @@ -134,13 +134,15 @@ public class PrintJob: UIPrintPageRenderer, UIPrintInteractionControllerDelegate | ||
| 134 | 134 | ||
| 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 | - | ||
| 138 | - public func printInteractionController(_ printInteractionController: UIPrintInteractionController, cutLengthFor paper: UIPrintPaper) -> CGFloat { | ||
| 139 | - if currentSize == nil{ | ||
| 140 | - return paper.paperSize.height | 137 | + |
| 138 | + public func printInteractionController(_ printController: UIPrintInteractionController, choosePaper paperList: [UIPrintPaper]) -> UIPrintPaper { | ||
| 139 | + if currentSize == nil { | ||
| 140 | + return paperList[0] | ||
| 141 | } | 141 | } |
| 142 | - | ||
| 143 | - return currentSize!.height | 142 | + |
| 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