hi,
i got a complex printing class, it pronts text,line,image objects.
it generates a good preview, good pdf if print to file,
but if printed to printer or to file type ps, printing of the page stops
after an image is prnted. the image comes out, but the paper is white
after it.
on the draw-page signal i run a cycle and draw each item.
each page begins with
cr=context.cairo_context
ends with cr.stroke
items are placed on cr,
this is how the image is placed:
cr.set_source_pixbuf(pixbuf.scale(width.to_f, height.to_f), x,y)
cr.paint
cr.stroke
if i comment out the row containing set_surce, than printing the .ps
file continues.
my question: is this not the right way to print images?
thanks
balint
don’t bother,
looks like i have systems where it works, and systems, where id does
not.
i managed to implemented a workaround, by changing the order of placing
items on the page: images after all other items
that way the .ps looks as the .pdf, thus printing is looks ok.
take back the last one.
i come now with a working script, attached.
i also attach the generated pdf and ps files.
the fist page will include the image, the second will not.
there are some lines printed before the image,
there is a text printed after the image.
place the script and the image in the same folder, change there, run
from there.
step1: print to file ps format
step2: print to file pdf format
step3: notice on the first page there is no other graphics than the
image, while on the second page there is are lines.
step4: notice the pdf having the text after the image, while the ps does
not.
i think cairo_context.set_source_pixbuf is doing this to me. can i
replace it with something else?
thanks
balint
Hi,
In [email protected]
“Re: [ruby-gnome2-devel-en] printing image problem” on Wed, 20 Aug
2008 11:09:16 +0300,
Dobai-Pataky Bálint [email protected] wrote:
step1: print to file ps format
step2: print to file pdf format
step3: notice on the first page there is no other graphics than the image,
while on the second page there is are lines.
step4: notice the pdf having the text after the image, while the ps does not.
i think cairo_context.set_source_pixbuf is doing this to me. can i replace it
with something else?
You need to restore surface’s source.
before:
if page_number == 0
cr.set_source_pixbuf(Gtk::Image.new(“im.png”).pixbuf.scale(60,60),30,30)
cr.paint
end
after:
if page_number == 0
cr.save do
cr.set_source_pixbuf(Gtk::Image.new(“im.png”).pixbuf.scale(60,60),30,30)
cr.paint
end
end
Thanks,
kou