351 # calculate margin and width of printout |
351 # calculate margin and width of printout |
352 font = QFont("times", 10) |
352 font = QFont("times", 10) |
353 painter.setFont(font) |
353 painter.setFont(font) |
354 fm = painter.fontMetrics() |
354 fm = painter.fontMetrics() |
355 fontHeight = fm.lineSpacing() |
355 fontHeight = fm.lineSpacing() |
356 marginX = printer.pageRect().x() - printer.paperRect().x() |
356 marginX = ( |
|
357 printer.pageLayout().paintRectPixels(printer.resolution()).x() - |
|
358 printer.pageLayout().fullRectPixels(printer.resolution()).x() |
|
359 ) |
357 marginX = ( |
360 marginX = ( |
358 Preferences.getPrinter("LeftMargin") * |
361 Preferences.getPrinter("LeftMargin") * |
359 int(printer.resolution() / 2.54) - marginX |
362 int(printer.resolution() / 2.54) - marginX |
360 ) |
363 ) |
361 marginY = printer.pageRect().y() - printer.paperRect().y() |
364 marginY = ( |
|
365 printer.pageLayout().paintRectPixels(printer.resolution()).y() - |
|
366 printer.pageLayout().fullRectPixels(printer.resolution()).y() |
|
367 ) |
362 marginY = ( |
368 marginY = ( |
363 Preferences.getPrinter("TopMargin") * |
369 Preferences.getPrinter("TopMargin") * |
364 int(printer.resolution() / 2.54) - marginY |
370 int(printer.resolution() / 2.54) - marginY |
365 ) |
371 ) |
366 |
372 |