Re: outputting pdf with Cairo 0.3
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: outputting pdf with Cairo 0.3
- Date: Fri, 10 Feb 2006 20:15:45 +0100
On Fri, 2006-02-10 at 12:26 -0500, zentara wrote:
Does anyone have an example of outputting pdf
from Cairo? It says in the docs it supports pdf
output, but I can only find png output.
It's as simple as creating a Cairo::PdfSurface and remembering to call
show_page when you're finished:
use Cairo;
my $surface = Cairo::PdfSurface->create ("tmp.pdf", 2*72.0, 1*72.0);
my $cr = Cairo::Context->create ($surface);
$cr->move_to (20, 40);
$cr->select_font_face ("Sans", "normal", "bold");
$cr->set_font_size (20);
$cr->show_text ("Hi there!");
$cr->show_page;
(Keep in mind that the text rendering functionality cairo provides is
called a "toy API" for a reason. Use pango's cairo glue to get better
results should you need them.)
--
Bye,
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]