アプリ開発初心者です。オリジナルの印刷アプリを作っています。最後に印刷すると解像度が元画像より粗くなり、もともと作っていたpng画像と違い、印刷後の画像がくっきりせず質が落ちるのですがどうしたらいいですか?
import UIKit class DesignPrintViewController: UIViewController,UIPrintInteractionControllerDelegate { var opePrint :Int=0 var saveData:UserDefaults = UserDefaults.standard @IBOutlet var imageView:UIImageView! @IBOutlet weak var UIView: UIView! var pageSize = CGSize(width: 210 / 25.4 * 500, height: 297 / 25.4 * 500) let imageSample = UIImageView()
@IBAction func printContent(_ sender: UIButton) { let rect = UIView.bounds print("通過・rect -> (rect)") UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0) let CGContextRef : CGContext = UIGraphicsGetCurrentContext()! UIView.layer.render(in: CGContextRef) let backgroundImage : UIImage = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext() let shareText = "Apple - Apple iPhone X" let shareWebsite = NSURL(string: "https://www.apple.com/jp/iphone-x/")! let shareImage = backgroundImage var activityItems = [] as [Any] activityItems = [shareText, shareWebsite] as [Any] activityItems.append(shareImage) let activityController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil) if UIDevice.current.userInterfaceIdiom == .pad { activityController.popoverPresentationController?.sourceView = self.view present(activityController, animated: true, completion: nil) print("iPadです・印刷物はフチなしで印刷されます") } else { present(activityController, animated: true, completion: nil) print("iPhoneです・印刷物はフチなしで印刷されます") } let pic = UIPrintInteractionController.shared pic.delegate = self } func printInteractionController ( _ printInteractionController: UIPrintInteractionController, choosePaper paperList: [UIPrintPaper]) -> UIPrintPaper { for i in 0..<paperList.count { let paper: UIPrintPaper = paperList[i] print("paperListのピクセル is ((paper.paperSize.width, paper.paperSize.height))") } print("\npageSizeピクセル -> (pageSize)") let bestPaper = UIPrintPaper.bestPaper(forPageSize: pageSize, withPapersFrom: paperList) print("paperSizeミリ -> ((bestPaper.paperSize.width / 72.0 * 25.4, bestPaper.paperSize.height / 72.0 * 25.4))") print("bestPaper -> ((bestPaper.printableRect.origin.x / 72.0 * 25.4, bestPaper.printableRect.origin.y / 72.0 * 25.4, bestPaper.printableRect.size.width / 72.0 * 25.4, bestPaper.printableRect.size.height / 72.0 * 25.4))\n") return bestPaper }