本文整理汇总了Python中PyQt4.QtGui.QPrinter.setFullPage方法的典型用法代码示例。如果您正苦于以下问题:Python QPrinter.setFullPage方法的具体用法?Python QPrinter.setFullPage怎么用?Python QPrinter.setFullPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPrinter
的用法示例。
在下文中一共展示了QPrinter.setFullPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exportPDF
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def exportPDF(self, view, file_name, width, height):
pdf = QPrinter()
pdf.setOutputFormat(QPrinter.PdfFormat)
pdf.setPrintRange(QPrinter.AllPages)
pdf.setOrientation(QPrinter.Portrait)
pdf.setResolution(QPrinter.HighResolution)
pdf.setPaperSize(QSizeF(width, height), QPrinter.Point)
pdf.setFullPage(True)
pdf.setOutputFileName(file_name)
view.mainFrame().print_(pdf)
QApplication.restoreOverrideCursor()
示例2: plotPDF
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def plotPDF(self, width, height, output_file, units = "pixels", _plotting_object = None):
"""Plots the data specified in the current input file as a page in a
PDF file with the given width and height, writing the output to the
specified output file. The optional units argument specifies the units
used to measure the plot size; by default, pixels are used, but "cm",
"mm" and "in" are also acceptable.
Returns the QPrinter object used to write the file."""
pdf = QPrinter()
pdf.setOutputFormat(QPrinter.PdfFormat)
pdf.setOutputFileName(output_file)
if units == "in":
width = pdf.logicalDpiX() * width
height = pdf.logicalDpiY() * height
elif units == "cm":
width = pdf.logicalDpiX() * (width / 2.54)
height = pdf.logicalDpiY() * (height / 2.54)
elif units == "mm":
width = pdf.logicalDpiX() * (width / 25.4)
height = pdf.logicalDpiY() * (height / 25.4)
elif units != "pixels":
raise BDianaError, "Unknown units specified to plotPDF: %s" % units
pdf.setPaperSize(QSizeF(width, height), QPrinter.DevicePixel)
pdf.setFullPage(True)
return self._plot(width, height, pdf, _plotting_object)[0]
示例3: print_pdf
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def print_pdf(self):
if self.deck is not None:
#Setting the printer
printer = QPrinter(QPrinter.HighResolution)
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOrientation(getattr(QPrinter, "Portrait"))
printer.setOutputFileName(self.path)
printer.setPaperSize(getattr(QPrinter, self.paper))
printer.setFullPage(True)
guide = self.max_cards()
printer.setOrientation(getattr(QPrinter, guide["orientation"]))
print guide, self.card_size
#Start printing
with QPainter(printer) as paint:
ind = 0
resol = printer.resolution()
for c in self.deck:
c.resize(self.card_size[0], self.card_size[1])
if ind == guide["max"]:
printer.newPage()
ind = 0
col = ind % guide["horizontal"]
fil = ind // guide["horizontal"]
print ind, fil, col
target = QRectF((col)*self.card_size[0]*resol, (fil)*self.card_size[1]*resol,
self.card_size[0]*resol, self.card_size[1]*resol)
self.preview_card(c)
self.scene.render(paint, target=target, source=QRectF(0,0,c.width(),c.height()))
ind += 1
示例4: print_to_pdf
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def print_to_pdf(self,
path,
paper_size = (8.5, 11.0),
paper_margins = (0, 0, 0, 0),
paper_units = QPrinter.Inch,
zoom_factor = 1.0,
):
"""Saves page as a pdf file.
See qt4 QPrinter documentation for more detailed explanations
of options.
:param path: The destination path.
:param paper_size: A 2-tuple indicating size of page to print to.
:param paper_margins: A 4-tuple indicating size of each margin.
:param paper_units: Units for pager_size, pager_margins.
:param zoom_factor: Scale the output content.
"""
assert len(paper_size) == 2
assert len(paper_margins) == 4
printer = QPrinter(mode = QPrinter.ScreenResolution)
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setPaperSize(QtCore.QSizeF(*paper_size), paper_units)
printer.setPageMargins(*(paper_margins + (paper_units,)))
printer.setFullPage(True)
printer.setOutputFileName(path)
if self.webview is None:
self.webview = QtWebKit.QWebView()
self.webview.setPage(self.page)
self.webview.setZoomFactor(zoom_factor)
self.webview.print_(printer)
示例5: printWindow
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def printWindow(self, printer=None):
if not printer:
printer = QPrinter()
printer.setFullPage(True)
printer.setPageSize(QPrinter.A4)
dialog = QPrintDialog(printer, self)
dialog.setWindowTitle(QCoreApplication.translate('QwtPlot', 'Print Document'))
if dialog.exec_() != QDialog.Accepted:
return
self.plot.print_(printer, QwtPlotPrintFilter())
示例6: __saveAsPDF
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def __saveAsPDF( self, fileName ):
" Saves the flowchart as an PDF file "
printer = QPrinter()
printer.setOutputFormat( QPrinter.PdfFormat )
printer.setPaperSize( QSizeF( self.scene.width(),
self.scene.height() ), QPrinter.Point )
printer.setFullPage( True )
printer.setOutputFileName( fileName )
painter = QPainter( printer )
self.scene.render( painter )
painter.end()
return
示例7: WebKitPDF
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
class WebKitPDF ( QObject ):
def __init__ ( self, url, dest ):
QObject.__init__ ( self )
self.dest = dest
self.page = QtWebKit.QWebPage ( self )
self.mainFrame = self.page.mainFrame()
self.mainFrame.load ( QUrl ( url ) )
# Settings
# Disable the scrollbars
self.mainFrame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
self.mainFrame.setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
self.connect ( self.page,
SIGNAL ( "loadProgress(int)" ),
self.loadProgress )
self.connect ( self.page,
SIGNAL ( "loadFinished(bool)" ),
self.renderPDF )
def loadProgress ( self, progress ):
print "Progress: ", progress
def renderPDF ( self, status ):
print "Load finished with status: ", status
print "Rendering PDF ..."
contentsSize = self.mainFrame.contentsSize()
contentsSize.setWidth(1280)
self.page.setViewportSize ( contentsSize )
self.printer = QPrinter ( QPrinter.PrinterResolution )
#self.printer = QPrinter ( QPrinter.ScreenResolution )
self.printer.setOutputFormat ( QPrinter.PdfFormat )
#self.printer.setPaperSize ( QPrinter.A4 )
self.printer.setFullPage( True )
self.printer.setPaperSize ( QSizeF( contentsSize ), QPrinter.DevicePixel )
self.printer.setOrientation ( QPrinter.Portrait )
self.printer.setOutputFileName ( self.dest )
self.painter = QPainter ( self.printer )
self.painter.setRenderHint ( QPainter.Antialiasing )
self.mainFrame.render ( self.painter )
self.painter.end()
app = QtGui.QApplication.instance()
app.exit ( 0 )
示例8: printWindow
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def printWindow(self, printer=None):
if not printer:
printer = QPrinter()
printer.setFullPage(True)
printer.setPageSize(QPrinter.A4)
dialog = QPrintDialog(printer, self)
dialog.setWindowTitle(QCoreApplication.translate('Graphics', 'Print Document'))
if dialog.exec_() != QDialog.Accepted:
return
# FIXME: on windows the resolutions seems to be very low, why?
#printer.setResolution(600)
painter = QPainter(printer)
painter.setRenderHint(QPainter.Antialiasing)
self.graphicsView.scene().render(painter)
示例9: _exportCompositionAsPDF
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def _exportCompositionAsPDF(self,composition,filePath):
"""
Render the composition as a PDF file.
"""
printer = QPrinter()
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOutputFileName(filePath)
printer.setPaperSize(QSizeF(composition.paperWidth(),composition.paperHeight()),QPrinter.Millimeter)
printer.setFullPage(True)
printer.setColorMode(QPrinter.Color)
printer.setResolution(composition.printResolution())
#Use painter to send output to printer
pdfPainter = QPainter(printer)
paperRectMM = printer.pageRect(QPrinter.Millimeter)
paperRectPixel = printer.pageRect(QPrinter.DevicePixel)
composition.render(pdfPainter,paperRectPixel,paperRectMM)
pdfPainter.end()
示例10: __createPdf
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def __createPdf(self, savePath):
"""
Diese Funktion druckt den Charakter in ein PDF-Dokument.
"""
# Wenn Unterverzeichnis nicht existiert, erstelle es
dirname = os.path.dirname(savePath)
if not os.path.exists(dirname):
os.makedirs(dirname)
printer = QPrinter(QPrinter.PrinterResolution)
#printer = QPrinter()
printer.setOutputFormat( QPrinter.PdfFormat )
printer.setPaperSize( QPrinter.A4 )
printer.setFullPage( True )
printer.setOutputFileName( savePath )
drawSheet = RenderSheet( self.__storage, self.__character, printer, self )
try:
drawSheet.createSheets()
except ErrSpeciesNotExisting as e:
MessageBox.exception( self, e.message, e.description )
示例11: BatchPlottingDialog
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
#.........这里部分代码省略.........
QApplication.restoreOverrideCursor()
return
if not self.ui.SingleFileCheckbox.checkState():
multiFilePrinter = QPrinter()
outputFileName = QDir( outputDir ).filePath( atlas.currentFilename() ) + ".pdf"
self.composition.beginPrintAsPDF( multiFilePrinter, outputFileName )
# set the correct resolution
self.composition.beginPrint( multiFilePrinter )
printReady = painter.begin( multiFilePrinter )
if not printReady:
QMessageBox.warning( self, tr( "Atlas processing error" ),
tr( "Error creating %s." % outputFileName ) )
progress.cancel()
QApplication.restoreOverrideCursor()
return
self.composition.doPrint( multiFilePrinter, painter )
painter.end()
else:
# start print on a new page if we're not on the first feature
if featureI > 0:
printer.newPage()
self.composition.doPrint( printer, painter )
atlas.endRender()
if self.ui.SingleFileCheckbox.checkState():
painter.end()
QApplication.restoreOverrideCursor()
elif self.ui.OutputTab.currentIndex() == 1: # to Printer
# if To Printer is selected set the printer
# setting up printer
if self.printer is None:
self.printer = QPrinter()
self.printer.setFullPage(True)
self.printer.setColorMode(QPrinter.Color)
# open printer setting dialog
pdlg = QPrintDialog(self.printer,self)
pdlg.setModal(True)
pdlg.setOptions(QAbstractPrintDialog.None)
if not pdlg.exec_() == QDialog.Accepted:
return
QApplication.setOverrideCursor(Qt.BusyCursor)
#prepare for first feature, so that we know paper size to begin with
self.composition.setAtlasMode( QgsComposition.ExportAtlas )
atlas.prepareForFeature(0)
# set orientation
if self.composition.paperWidth() > self.composition.paperHeight():
self.printer.setOrientation(QPrinter.Landscape)
self.printer.setPaperSize(
QSizeF(self.composition.paperHeight(), self.composition.paperWidth()),
QPrinter.Millimeter)
else:
self.printer.setOrientation(QPrinter.Portrait)
self.printer.setPaperSize(
QSizeF(self.composition.paperWidth(), self.composition.paperHeight()),
QPrinter.Millimeter)
self.printer.setResolution(self.composition.printResolution())
self.composition.beginPrint( self.printer )
painter = QPainter(self.printer)
if not len(atlas.featureFilterErrorString()) == 0:
QMessageBox.warning( self, tr( "Atlas processing error" ),
tr( "Feature filter parser error: %s" % atlas.featureFilterErrorString() ) )
QApplication.restoreOverrideCursor()
示例12: save
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def save(self, imgName, w=None, h=None, header=None, \
dpi=150, take_region=False):
ext = imgName.split(".")[-1].upper()
root = self.startNode
#aspect_ratio = root.fullRegion.height() / root.fullRegion.width()
aspect_ratio = self.i_height / self.i_width
# auto adjust size
if w is None and h is None and (ext == "PDF" or ext == "PS"):
w = dpi * 6.4
h = w * aspect_ratio
if h>dpi * 11:
h = dpi * 11
w = h / aspect_ratio
elif w is None and h is None:
w = self.i_width
h = self.i_height
elif h is None :
h = w * aspect_ratio
elif w is None:
w = h / aspect_ratio
if ext == "SVG":
svg = QtSvg.QSvgGenerator()
svg.setFileName(imgName)
svg.setSize(QtCore.QSize(w, h))
svg.setViewBox(QtCore.QRect(0, 0, w, h))
#svg.setTitle("SVG Generator Example Drawing")
#svg.setDescription("An SVG drawing created by the SVG Generator")
pp = QtGui.QPainter()
pp.begin(svg)
targetRect = QtCore.QRectF(0, 0, w, h)
self.render(pp, targetRect, self.sceneRect())
pp.end()
elif ext == "PDF" or ext == "PS":
format = QPrinter.PostScriptFormat if ext == "PS" else QPrinter.PdfFormat
printer = QPrinter(QPrinter.HighResolution)
printer.setResolution(dpi)
printer.setOutputFormat(format)
printer.setPageSize(QPrinter.A4)
pageTopLeft = printer.pageRect().topLeft()
paperTopLeft = printer.paperRect().topLeft()
# For PS -> problems with margins
# print paperTopLeft.x(), paperTopLeft.y()
# print pageTopLeft.x(), pageTopLeft.y()
# print printer.paperRect().height(), printer.pageRect().height()
topleft = pageTopLeft - paperTopLeft
printer.setFullPage(True);
printer.setOutputFileName(imgName);
pp = QtGui.QPainter(printer)
if header:
pp.setFont(QtGui.QFont("Verdana",12))
pp.drawText(topleft.x(),20, header)
targetRect = QtCore.QRectF(topleft.x(), 20 + (topleft.y()*2), w, h)
else:
targetRect = QtCore.QRectF(topleft.x(), topleft.y()*2, w, h)
if take_region:
self.selector.setVisible(False)
self.render(pp, targetRect, self.selector.rect())
self.selector.setVisible(True)
else:
self.render(pp, targetRect, self.sceneRect())
pp.end()
return
else:
targetRect = QtCore.QRectF(0, 0, w, h)
ii= QtGui.QImage(w, \
h, \
QtGui.QImage.Format_ARGB32)
pp = QtGui.QPainter(ii)
pp.setRenderHint(QtGui.QPainter.Antialiasing )
pp.setRenderHint(QtGui.QPainter.TextAntialiasing)
pp.setRenderHint(QtGui.QPainter.SmoothPixmapTransform)
if take_region:
self.selector.setVisible(False)
self.render(pp, targetRect, self.selector.rect())
self.selector.setVisible(True)
else:
self.render(pp, targetRect, self.sceneRect())
pp.end()
ii.save(imgName)
示例13: export_all_features
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
#.........这里部分代码省略.........
new_ext.setYMinimum( bbox.yMinimum() - delta_height / 2)
new_ext.setYMaximum(bbox.yMaximum() + delta_height / 2)
else:
new_width = old_ratio * new_ext.height()
delta_width = new_width - new_ext.width()
new_ext.setXMinimum(bbox.xMinimum() - delta_width / 2)
new_ext.setXMaximum(bbox.xMaximum() + delta_width / 2)
if VRP_DEBUG is True: QgsMessageLog.logMessage(u'bbox old:{0}'.format(compmap.extent().toString()), DLG_CAPTION)
compmap.setNewExtent(new_ext)
if VRP_DEBUG is True: QgsMessageLog.logMessage(u'bbox new:{0}'.format(compmap.extent().toString()), DLG_CAPTION)
#round up to next 1000
compmap.setNewScale(math.ceil((compmap.scale()/1000.0)) * 1000.0)
if VRP_DEBUG is True: QgsMessageLog.logMessage(u'bbox new (after scale):{0}'.format(compmap.extent().toString()), DLG_CAPTION)
#add ORTHO after new extent -> performance
if not self.ortho is None:
self.ortho_lyr = self.__add_raster_layer(self.ortho, self.lyrname_ortho)
self.__reorder_layers()
self.comp_leg = self.__get_items(QgsComposerLegend)
self.comp_lbl = self.__get_items(QgsComposerLabel)
self.__update_composer_items(self.settings.dkm_gemeinde(self.gem_name)['lyrnamegstk'])
if VRP_DEBUG is True:
QgsMessageLog.logMessage(u'paperWidth:{0} paperHeight:{1}'.format(composition.paperWidth(), composition.paperHeight()), DLG_CAPTION)
printer = QPrinter()
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOutputFileName(self.pdf_map)
printer.setPaperSize(QSizeF(composition.paperWidth(), composition.paperHeight()), QPrinter.Millimeter)
printer.setFullPage(True)
printer.setColorMode(QPrinter.Color)
printer.setResolution(composition.printResolution())
pdf_painter = QPainter(printer)
paper_rect_pixel = printer.pageRect(QPrinter.DevicePixel)
paper_rect_mm = printer.pageRect(QPrinter.Millimeter)
QgsPaintEngineHack.fixEngineFlags(printer.paintEngine())
#DKM only
if len(self.themen) < 1:
composition.render(pdf_painter, paper_rect_pixel, paper_rect_mm)
else:
self.statistics = OrderedDict()
try:
pass
#lyr = QgsVectorLayer('/home/bergw/VoGIS-Raumplanung-Daten/Geodaten/Raumplanung/Flaechenwidmung/Dornbirn/Flaechenwidmungsplan/fwp_flaeche.shp', 'flaeiw', 'ogr')
#lyr.loadNamedStyle('/home/bergw/VoGIS-Raumplanung-Daten/Geodaten/Raumplanung/Flaechenwidmung/Vorarlberg/Flaechenwidmungsplan/fwp_flaeche.qml')
#QgsMapLayerRegistry.instance().addMapLayer(lyr)
except:
QgsMessageLog.logMessage('new lyr:{0}'.format(sys.exc_info()[0]), DLG_CAPTION)
#QgsMapLayerRegistry.instance().addMapLayer(lyr)
cntr = 0
for thema, sub_themen in self.themen.iteritems():
if VRP_DEBUG is True: QgsMessageLog.logMessage('drucke Thema:{0}'.format(thema.name), DLG_CAPTION)
if sub_themen is None:
layers = self.__add_layers(thema)
self.__calculate_statistics(thema, thema, layers)
#no qml -> not visible -> means no map
if self.__at_least_one_visible(layers) is True:
if cntr > 0:
printer.newPage()
self.__reorder_layers()
self.__update_composer_items(thema.name, layers=layers)
示例14: _get_composer_pdf_image
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
def _get_composer_pdf_image(self, width, height, dpi):
pdfpath = getTempfilePath('pdf')
temp_size = os.path.getsize(pdfpath)
p = QPrinter()
p.setOutputFormat(QPrinter.PdfFormat)
p.setOutputFileName(pdfpath)
p.setPaperSize(QSizeF(self._c.paperWidth(), self._c.paperHeight()),
QPrinter.Millimeter)
p.setFullPage(True)
p.setColorMode(QPrinter.Color)
p.setResolution(self._c.printResolution())
pdf_p = QPainter(p)
# page_mm = p.pageRect(QPrinter.Millimeter)
# page_px = p.pageRect(QPrinter.DevicePixel)
# self._c.render(pdf_p, page_px, page_mm)
self._c.renderPage(pdf_p, 0)
pdf_p.end()
if temp_size == os.path.getsize(pdfpath):
return False, ''
filepath = getTempfilePath('png')
# Poppler (pdftocairo or pdftoppm):
# PDFUTIL -png -singlefile -r 72 -x 0 -y 0 -W 420 -H 280 in.pdf pngbase
# muPDF (mudraw):
# PDFUTIL -c rgb[a] -r 72 -w 420 -h 280 -o out.png in.pdf
if PDFUTIL.strip().endswith('pdftocairo'):
filebase = os.path.join(
os.path.dirname(filepath),
os.path.splitext(os.path.basename(filepath))[0]
)
call = [
PDFUTIL, '-png', '-singlefile', '-r', str(dpi),
'-x', '0', '-y', '0', '-W', str(width), '-H', str(height),
pdfpath, filebase
]
elif PDFUTIL.strip().endswith('mudraw'):
call = [
PDFUTIL, '-c', 'rgba',
'-r', str(dpi), '-w', str(width), '-h', str(height),
# '-b', '8',
'-o', filepath, pdfpath
]
else:
return False, ''
qDebug("_get_composer_pdf_image call: {0}".format(' '.join(call)))
res = False
try:
subprocess.check_call(call)
res = True
except subprocess.CalledProcessError as e:
qDebug("_get_composer_pdf_image failed!\n"
"cmd: {0}\n"
"returncode: {1}\n"
"message: {2}".format(e.cmd, e.returncode, e.message))
if not res:
os.unlink(filepath)
filepath = ''
return res, filepath
示例15: QPrinter
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFullPage [as 别名]
c.setPlotStyle(QgsComposition.Print)
compmap.setPreviewMode(QgsComposerMap.Render)
#compmap.updateItem()
#emit compmap.itemChanged();
#compmap.extentChanged();
#compmap.toggleAtlasPreview()
#compmap.setNewScale(compmap.scale()+1)
#c.setPrintResolution(150)
#print c.printResolution()
c.setPrintAsRaster(False)
printer = QPrinter()
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOutputFileName(pdf_out)
printer.setPaperSize(QSizeF(c.paperWidth(), c.paperHeight()), QPrinter.Millimeter)
printer.setFullPage(True)
printer.setColorMode(QPrinter.Color)
printer.setResolution(c.printResolution())
pdfPainter = QPainter(printer)
paperRectMM = printer.pageRect(QPrinter.Millimeter)
paperRectPixel = printer.pageRect(QPrinter.DevicePixel)
QgsPaintEngineHack.fixEngineFlags(printer.paintEngine())
#c.renderPage(pdfPainter, 0)
c.doPrint(printer,pdfPainter)
pdfPainter.end()
subprocess.call(('xdg-open', pdf_out))