What I try to do is to get some data from user input and insert these
data into an existing pdf file and send it to browser.
Thanks!
Can we use Prawn to edit existing pdf?
I installed template branch as a plugin to my project. But I got
undefined method `ruby_18' for Prawn::Document::Text::Wrapping:Module
How to fix this?
On Mar 9, 12:07 pm, Randy Parker <randy.j.par...@gmail.com> wrote:
...is really old. Better update your Prawn.
-Daniel
The error referring to Prawn::Document::Text::Wrapping is generated by
old code. What version of Prawn are you running? It seems it must be
out of date.
-Daniel
On Mar 9, 1:54 pm, Daniel Nelson <dnelso...@gmail.com> wrote:
That's old. Use templates_2010.
-Daniel
but got
fatal: Couldn't find remote ref templates_2010
where is templates_2010?
http://github.com/yob/prawn/tree/templates_2010
-Daniel
undefined method `ruby_18' for Prawn::Text:Module
my env:
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0]
Rails 2.3.5
Mac OS X 10.6.2
What version of Prawn?
-Daniel
It doesn't matter if I add the following line to environment.rb or
not.
config.load_paths << "#{RAILS_ROOT}/vendor/plugins/prawn/lib"
Alright, here's where I have to jump in and be the bad guy. Daniel,
you've been remarkably patient here, but this user is wasting your time.
Xin, you have no idea what you're doing, and you're using a library that
you really need to have some fundamental understanding of things like
git, ruby source, and general open source projects unless you want to
stick to the documented and supported released gems.
Either read up on the necessary stack of things you need to know before
running experimental versions of our code, or wait until Prawn 1.0 which
will have template support. That will be some time in the next 6 months.
-greg
On Mar 9, 2:58 pm, Gregory Brown <gregory_br...@letterboxes.org>
wrote:
This has nothing to do with Rails, at all. But welcome to Ruby, the
language that Rails is built in.
I'm actually not sure where to point you for specific instructions, but
you might want to start with the basics and go from there.
You'll basically want to learn git through and through, and then, be
able to read Ruby source code.
There are some good git tutorials at:
To be able to read Ruby source, you pretty much need to learn the
language basics and then practice a lot. Pull open Prawn's source in
your editor and try to track down the problems yourself. Figure out how
it works.
Rubylearning.com might be a good resource for beginners:
http://rubylearning.com/
Maybe my book will also help you, most of it is free now:
http://blog.rubybestpractices.com/posts/gregory/021-rbp-ch7.html
But the thing that we are really ill-fitted to do here on this list is
teach people open source practices, Ruby, and git. When you have a
Prawn question that you feel pretty sure is actually about Prawn and not
configuring your system, let us know.
Until then, good luck with learning. I know it is a big struggle, but
it is important to ask the right people at the right times. Should you
need help learning Ruby, the folks on the RubyTalk mailing list would
likely be happy to help answer beginners questions. Same goes for
RubyOnRails Talk for Rails questions.
-greg
On Mar 9, 3:13 pm, Gregory Brown <gregory_br...@letterboxes.org>
wrote:
If you are using yob's templates branch, it has no version, because it
is has not been merged into the official codebase. But templates_2010
is effectively a snapshot of the Prawn 0.7 codebase, so following those
release notes should get you some mileage.
-greg
i tried this example
class HelloController < ApplicationController
def index
filename = "path to existing pdf file"
pdf = Prawn::Document.new(:template => filename, :page_size
=>"A5")
pdf.render_file "template.pdf"
output = pdf.render
respond_to do |format|
format.pdf do
send_data output, :filename => "hello.pdf",
:type => "application/pdf"
end
end
end
end
no matter how many pages of my existing pdf file, i always get one
empty pdf page. it seems not encrypt/decrypt problem. what am i
missing here?
On Mar 9, 8:30 pm, Gregory Brown <gregory_br...@letterboxes.org>
wrote:
> no matter how many pages of my existing pdf file, i always get one
> empty pdf page. it seems not encrypt/decrypt problem. what am i
> missing here?
You should read our Rails guide:
On Mar 9, 11:14 pm, xin <zhangxi...@gmail.com> wrote:
> ok, maybe a dumb question.
>
> i tried this example
>
> class HelloController < ApplicationController
> def index
>
> filename = "path to existing pdf file"
> pdf = Prawn::Document.new(:template => filename, :page_size
> =>"A5")
I dont think you need this line, not sure if it hurts, but you dont
need:
> pdf.render_file "template.pdf"
Try adding:
pdf.text_box 'Does this show up in pdf doc', :at => [100,663], :height
=> 12
It turns out my pdf file problem.
Another dumb question. How to edit exiting pdf field? If field name is
'deptname' in my pdf, how to edit the value of field 'deptname'?
You don't with Prawn, at least not yet. James had started on this at
one point, but never got beyond the early stages.
But you might try pdftk:
http://www.accesspdf.com/pdftk/
On Mar 10, 10:48 am, Gregory Brown <gregory_br...@letterboxes.org>
wrote:
> On 3/10/10 10:39 AM, xin wrote:
>
> > Thank you joelkeepup.
>
> > It turns out my pdf file problem.
>
> > Another dumb question. How to edit exiting pdf field? If field name is
> > 'deptname' in my pdf, how to edit the value of field 'deptname'?
>
As Greg said you cant really yet, but you may be able to use :
pdf.text_box 'Does this show up in pdf doc', :at => [100,663], :height
=> 12
to overlay text on the form, I haven tried it with a real form, just
pdf files with underscores in them. I use skim (open source pdf reader
for osx) to get the coordinates (download skim and click the select
tool and click the spot on the form, this will give you the
coordinates.) of where to place the text_box.