Hi,
A little question. I''ve written a method that uses PDF::Writer to
generate a PDF document with some images and text. This is the code on
my controller:
def pdf
gen_pdf
redirect_to("#{@request.relative_url_root}/pdf/cupones.pdf")
end
private
def gen_pdf
pdf = PDF::Writer.new(:paper => "A4")
pdf.margins_cm(0)
pdf.start_columns(2, 0)
pdf.select_font "Times-Roman"
10.times do
pdf.open_object do |card|
pdf.save_state
pdf.image "public/images/card.png", :justification => :left,
:width => PDF::Writer.cm2pts(10.5), :height => PDF::Writer.cm2pts(6)
#pdf.add_text_wrap(0, pdf.y, PDF::Writer.cm2pts(1), "Test1", 12,
:left, 0)
#pdf.add_text_wrap(PDF::Writer.cm2pts(8.5), pdf.y,
PDF::Writer.cm2pts(6), "Test2", 12, :center, 90)
pdf.restore_state
pdf.close_object
pdf.add_object(card, :this_page)
end
end
pdf.save_as("public/pdf/cupones.pdf")
end
But the generated pdf has a top margin of 36pt, and the cards are then
printed in two pages. I need a margin of 0 for the page, to ensure
that all that cards are printed at the same page.
Also, a couple of cards are printed one on top of the other partially.
The others are placed correctly.
Any idea? Thanks!
--
Carlos Alberto Paramio Danta .--.
http://www.sinfoniadebits.com/ |o_o |
email : carlosparamio @ gmail.com |:_/ |
jabber: parax @ jaim.at // \ \
----------------------------------------( | | )--
Fingerprint 41C6 D2BE 7DE7 AB61 C23F /''\_ _/`\
F697 5A1D 1849 01B8 D318 \___)=(___/