[Gtk-sharp-list] High resolution image on a PdfSurface

David Cantin david_cantin at videotron.ca
Sun May 27 02:00:08 EDT 2007


Hi, the following code is working great except that I don't known how I
can render a image on my PdfSurface at good resolution (say 300 dpi).


// (8,5 x 11) x 72dpi = (612 x 792)
PdfSurface pdfSurface = new PdfSurface("/home/me/Desktop/test.pdf", 612,
792);
pdfSurface.SetFallbackResolution(300.0, 300.0);

Cairo.Context cc = new Cairo.Context(pdfSurface);

cc.Rectangle(new PointD(75, 100), 480, 360);

// "/home/me/Desktop/test.jpg" is a 2304x1728 picture
Pixbuf pixbuf = new Pixbuf("/home/me/Desktop/test.jpg");
Gdk.CairoHelper.SetSourcePixbuf(cc, pixbuf.ScaleSimple(480, 360,
InterpType.Hyper), 75, 100);

cc.Fill();

pdfSurface.Finish();



Maybe the problem is around the "Gdk.CairoHelper.SetSourcePixbuf" but i
didn't find a way to pass higher resolution image to the method, if I
put higher values on "pixbuf.ScaleSimple", the image get simply
clipped...

I have also tried to change the initial size of the PdfSurface to
2550x3300 (see (8,5 x 11) x 300dpi = (2250 x 3300)) but this impact the
paper size and it's not a good thing..

Should I use an other way to render an image to the surface ??

Any thought ??

David



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070527/a7325be1/attachment.html 


More information about the Gtk-sharp-list mailing list