I have done a lot of searching and cannot find a solution for getting PDF-stamper to work in my rails application. From the tutorials it appears that I write a method in the model? I wrote a simple app with two fields: nameLast and nameFirst. All I want to do is write these to a PDF I have that contains fields for user info. Two field happen to be FirstName and LastName so perfect time to use PDF-stamper right? I just want to take user data from the rails application and have then be able to push a button and generate a PDF. Here is the method I have in my model.
def savePDF
pdf = PDF::Stamper.new("sample.pdf")
pdf.text :nameFirst, "Jason"
pdf.text :nameLast, "Yates"
pdf.save_as "my_output.pdf"
end
That was clearly taken from a tutorial that I must not properly understand. I can actually get this working in java pretty easy, but I don't want to use jRuby. I am using rjb which is working fine. I just don't think I properly understand what needs to happen to get this working. Any help is greatly appreciated!
i was doing the same with use of xfdf as a source data for fields, the following code worked for me, maybe it will be helpful to you aswell: