gpt4 book ai didi

swift - 打印网页第一面 View 不同

转载 作者:行者123 更新时间:2023-11-30 12:08:24 24 4
gpt4 key购买 nike

我正在使用适用于 macOS 的 Swift 4,我可以将 HTML 字符串加载到我的 Web View 中并使用我的代码打印它:

let printInfo = NSPrintInfo.shared
printInfo.isHorizontallyCentered = true
printInfo.isVerticallyCentered = true
printInfo.orientation = .portrait
printInfo.topMargin = 0
printInfo.rightMargin = 0
printInfo.bottomMargin = 50
printInfo.leftMargin = 0
printInfo.verticalPagination = .autoPagination

let printOp = NSPrintOperation(view: sender.mainFrame.frameView.documentView, printInfo: printInfo)

printOp.run()

是否可以仅对第一页应用不同的 printInfo 设置?

例如:第一页应具有 topMargin = 50,所有其他页面应具有 0。这可能吗?

最佳答案

您只能为整个文档设置这些值,而不能为单个页面设置这些值。如果您想为特定页面设置不同的边距,则必须直接修改文档。

关于swift - 打印网页第一面 View 不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46389441/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com