382 # calculate margin and width of printout |
382 # calculate margin and width of printout |
383 font = QFont("times", 10) |
383 font = QFont("times", 10) |
384 painter.setFont(font) |
384 painter.setFont(font) |
385 fm = painter.fontMetrics() |
385 fm = painter.fontMetrics() |
386 fontHeight = fm.lineSpacing() |
386 fontHeight = fm.lineSpacing() |
387 marginX = printer.pageRect().x() - printer.paperRect().x() |
387 marginX = ( |
|
388 printer.pageLayout().paintRectPixels(printer.resolution()).x() - |
|
389 printer.pageLayout().fullRectPixels(printer.resolution()).x() |
|
390 ) |
388 marginX = ( |
391 marginX = ( |
389 Preferences.getPrinter("LeftMargin") * |
392 Preferences.getPrinter("LeftMargin") * |
390 int(printer.resolution() / 2.54) - marginX |
393 int(printer.resolution() / 2.54) - marginX |
391 ) |
394 ) |
392 marginY = printer.pageRect().y() - printer.paperRect().y() |
395 marginY = ( |
|
396 printer.pageLayout().paintRectPixels(printer.resolution()).y() - |
|
397 printer.pageLayout().fullRectPixels(printer.resolution()).y() |
|
398 ) |
393 marginY = ( |
399 marginY = ( |
394 Preferences.getPrinter("TopMargin") * |
400 Preferences.getPrinter("TopMargin") * |
395 int(printer.resolution() / 2.54) - marginY |
401 int(printer.resolution() / 2.54) - marginY |
396 ) |
402 ) |
397 |
403 |