Browse Source

【打印】打印界面 默认自适应

lizhe 1 year ago
parent
commit
8d79f38e1f

+ 5 - 1
PDF Office/PDF Master/Class/PDFTools/Print/Controller/KMPrintAccessoryController_OC.m

@@ -31,9 +31,12 @@
 
 - (void)setup {
     self.autoRotate = false;
-    self.printScalingMode = kPDFPrintPageScaleNone;
+    self.printScalingMode = kPDFPrintPageScaleToFit;
     [self reloadData];
     [self updateLanguage];
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self reloadData];
+    });
 }
 
 - (void)reloadData {
@@ -93,6 +96,7 @@
 }
 
 - (PDFPrintScalingMode)printScalingMode {
+    NSLog(@"%ld",(long)[[self valueForKeyPath:PRINTSCALINGMODE_KEYPATH] integerValue]);
     return [[self valueForKeyPath:PRINTSCALINGMODE_KEYPATH] integerValue];
 }
 

+ 2 - 3
PDF Office/PDF Master/Class/PDFTools/Print/Controller/KMPrintAccessoryController_OC.xib

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift

@@ -213,7 +213,7 @@ class KMPrintWindowController: NSWindowController, NetServiceBrowserDelegate {
             document!.allowsPrinting == true) {
             let printInfo = NSPrintInfo.shared
             var printOperation: NSPrintOperation = NSPrintOperation()
-            let scalingMode: PDFPrintScalingMode = .pageScaleNone
+            let scalingMode: PDFPrintScalingMode = .pageScaleToFit
             if document!.responds(to: NSSelectorFromString("printOperationForPrintInfo:scalingMode:autoRotate:")) {
                 printOperation = document!.printOperation(for: printInfo, scalingMode: scalingMode, autoRotate: false)!
             }