Re: writing multiple surfaces to a single (pdf) file

Zoltán Vörös <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Dear Andrea, and Kalle,

Thanks for the prompt replies! I have run the code with Andrea's 
changes, and it works OK now.
Cheers,
Zoltán

On 11/07/2011 09:29 AM, Andrea Canciani wrote:
> The issue in your code is that you're doing all the drawing before
> calling the *_page() methods.
> In addition to this, I believe that calling show_page() should be
> sufficient for your use case.
> Can you please your code with the following changes?
>
>             surface = cairo.PDFSurface('pdffile.pdf', 504, 648);
>             cr = cairo.Context(surface)
>             cr.set_source_surface(self.surface, 0, 0)
>             cr.paint()
>             cr.show_page() # show the first page
>
>             self.page += 1
>             self.path = self.pages[self.page]                     # we
> show another page
>             self.draw_note(self.widget('draw'), self.path)   # This
> redraws the surface on gtk drawable, which is self.surface
>             cr.set_source_surface(self.surface, 0, 0)
>             cr.paint() # don't forget to paint(), setting a source does
> not change the surface content
>             cr.show_page() # show the second page
>
> Andrea
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.