Swiftでアプリから文書を印刷させるためのメモ
var s = ""
s += "<FONT color='#00ff00'><h1>hogeeeeeeeeeee</h1></FONT>"
s += "<br><br>"
s += "<font size='10' face='Osaka'><h2>piyooooooooooooooo<br>foooo</h2><br></font>"
s += "<font size='10' face='arial'><h2>piyooooooooooooooo<br>foooo</h2><br></font>"
s += "<strong>ほほほほほげ</strong>"
s += "<small>うぬぬぬぬ</small>"
let pi = UIPrintInfo(dictionary: nil)
pi.outputType = UIPrintInfoOutputType.General
pi.jobName = "print Job"
pi.orientation = UIPrintInfoOrientation.Portrait
pi.duplex = UIPrintInfoDuplex.LongEdge
let pic = UIPrintInteractionController.sharedPrintController()
pic.printInfo = pi
// markupText(HTMLファイル)印刷させる場合
let formatter = UIMarkupTextPrintFormatter(markupText: s)
// text(文字列)印刷させる場合
// let formatter = UISimpleTextPrintFormatter(text: s)
// formatter.font = UIFont.systemFontOfSize(CGFloat(20)) //フォントサイズ
// formatter.color = UIColor.blueColor() //フォントカラー
formatter.contentInsets = UIEdgeInsets(top: 20, left: 32, bottom: 32, right: 20) //余白
pic.printFormatter = formatter
pic.presentAnimated(true, completionHandler: nil)