Exemplo n.º 1
0
func RunPr2Engine(s string, pr2 driverlayer.IPr2Print, pin *driverlayer.DriverArg) error {
	var pc PrintCurState
	pf, e := ParserPrintXml(s)
	if e != nil {
		utils.Error("parse xml file error %s", e.Error())
	} else {
		utils.Info("parse xml file success")
	}
	ps := pf.S
	pi := pf.V
	pc.BottomMargin = ps.ps.Bottommargin
	pc.LeftMargin = ps.ps.Leftmargin
	pc.PageHeight = ps.ps.Height
	pc.PageWidth = ps.ps.Width
	pc.TopMargin = ps.ps.Topmargin
	pc.RightMargin = ps.ps.Rightmargin
	pc.CurX = 0
	pc.CurY = 0
	pc.CurPage = 1
	pc.Flags = 0
	pc.LineInterval = ps.ps.LineInterval
	pc.ColInterval = ps.ps.ColInterval

	RecurCalcExtent(pi, &pc)
	utils.Info("RecurCalcExtent success")
	fl := GeneratePrintLine(pi)
	utils.Debug("begin print printline----------------------------")
	PrintPrintLine(fl)
	utils.Debug("end print printline----------------------------")
	pr2.BeginPrintJob(pin, 20)
	defer pr2.EndPrinterJob()
	RunRealPrinter(ps, fl, pr2)
	return nil
}