blob: 7c2874e268b46fbced0f44a431d6eacf05a348f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//! [0]
printer = QPrinter()
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOutputFileName("/foobar/nonwritable.pdf")
QPainter painter
if painter.begin(printer): # failed to open file
print "failed to open file, is it writable?"
return 1
painter.drawText(10, 10, "Test")
if !printer.Page():
print "failed in flushing page to disk, disk full?"
return 1
painter.drawText(10, 10, "Test 2")
painter.end()
//! [0]
|