Hi,<br>I'm pretty new to pycairo and I'd like to insert PNG images into PDFs and it looks like I'm not doing so correctly:<br><br>import cairo<br><br>def pngInPDF():<br> pdf_file = open("test.pdf", 'wb')<br>
surface = cairo.PDFSurface(pdf_file, 595, 841)<br> context = cairo.Context(surface)<br> png_surface = cairo.ImageSurface.create_from_png('test.png')<br> context.set_source(png_surface)<br><br>I get a traceback on the set_source() call:<br>
context.set_source(png_surface)<br>TypeError: Context.set_source() argument 1 must be cairo.Pattern, not cairo.ImageSurface<br><br>I'd appreciate any pointers on the correct way of doing this.<br><br>Best Regards,<br>
Steve<br>
<a href="http://tech.agilitynerd.com/" target="_blank">http://tech.agilitynerd.com/</a><br>
<br>