[cairo] cropping an SVG image
jan aerts (RI)
jan.aerts at bbsrc.ac.uk
Mon May 7 09:40:55 PDT 2007
Looks like I got it working, but I don't entirely understand why... The
code looks like this (using the ruby bindings):
<BEGIN CODE SNIPPET>
big_surface = Cairo::SVGSurface.new('big.svg', 200, 500)
big_context = Cairo::Context.new(big_surface)
# Draw 2 rectangles
small_surface = Cairo::SVGSurface.new('small.svg', 100,100)
small_context = Cairo::Context.new(small_surface)
<END CODE SNIPPET>
The file 'big.svg' shows no rectangles at all unless I uncomment the
big_context.show_page line, but it's created even though the
big_surface.finish line is commented out...
Where would I find a full-blown explanation (and simple to understand
for a novice) of what all the different methods do?
From: Daniel Amelang [mailto:daniel.amelang at gmail.com]
Sent: 07 May 2007 06:22
To: jan aerts (RI)
Cc: cairo at cairographics.org
Subject: Re: [cairo] cropping an SVG image
On 5/2/07, jan aerts (RI) <jan.aerts at bbsrc.ac.uk> wrote:
> Is it in any way possible to crop an SVG surface? I've found code in
> one of Carl's answers to do the very thing for PNGs
> but I just can't get it to work for an SVG or PDF... The trick seemed
> to be to create a smaller surface and copy the wanted part from the
> big surface onto that one.
Hi Jan, yes, that technique should work for SVG and PDF (AFAIK). Can you
share some code with us and explain how your expected results and
observed results differ?
More information about the cairo