Howdy all, I''ve been trying the various methods outlined in the HOWTOs on generating a PDF : http://wiki.rubyonrails.com/rails/show/HowtoGeneratePDFs I have managed to get PDFWriter to work, but that''s quite limited (eg can only use Times, can''t import pictures). FPDF looks to be much more capable, but whenver I run the basic example I get this error from Acrobat Reader - "File does not begin with ''%PDF-''. I am using the exact sample code (both from the howto and from the documenation from FPDF). Has anyone managed to get FPDF working? Am I missing something (and yes, I do have require ''fpdf'' and it''s in my lib dir) Any help appreciated. Cheers, -- Jordan Brock Spin Technologies www.spintech.com.au <http://www.spintech.com.au> _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Apr 3, 2005 2:03 PM, Jordan Brock <jordanbrock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Howdy all, > > I''ve been trying the various methods outlined in the HOWTOs on generating a > PDF : > http://wiki.rubyonrails.com/rails/show/HowtoGeneratePDFs > > I have managed to get PDFWriter to work, but that''s quite limited (eg can > only use Times, can''t import pictures). FPDF looks to be much more capable, > but whenver I run the basic example I get this error from Acrobat Reader - > "File does not begin with ''%PDF-''. I am using the exact sample code (both > from the howto and from the documenation from FPDF). > > Has anyone managed to get FPDF working? Am I missing something (and yes, I > do have require ''fpdf'' and it''s in my lib dir) > > Any help appreciated.Chances are you''re outputting a space or a blank line before the PDF. Use curl or wget or something to see what''s actually being sent. -- Phillip Hutchings http://www.sitharus.com/ sitharus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org / sitharus-QrR4M9swfipWk0Htik3J/w@public.gmane.org
If not already done, disable layout for your pdf method. class YourController < ApplicationController layout "layouts/yourLayout" , :except => :yourPdfMethod def yourPdfMethod .. end end Simone ________________________________________ From: Jordan Brock [mailto:jordanbrock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] Sent: domenica 3 aprile 2005 4.03 To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] Generating PDF Files Howdy all, I''ve been trying the various methods outlined in the HOWTOs on generating a PDF : http://wiki.rubyonrails.com/rails/show/HowtoGeneratePDFs I have managed to get PDFWriter to work, but that''s quite limited (eg can only use Times, can''t import pictures). FPDF looks to be much more capable, but whenver I run the basic example I get this error from Acrobat Reader - "File does not begin with ''%PDF-''. I am using the exact sample code (both from the howto and from the documenation from FPDF). Has anyone managed to get FPDF working? Am I missing something (and yes, I do have require ''fpdf'' and it''s in my lib dir) Any help appreciated. Cheers, -- Jordan Brock Spin Technologies www.spintech.com.au