lib/princely/pdf_helper.rb in fa_princely-1.2.6 vs lib/princely/pdf_helper.rb in fa_princely-1.2.7
- old
+ new
@@ -34,19 +34,25 @@
html_string = render_to_string(:template => options[:template], :layout => options[:layout])
end
# Make all paths relative, on disk paths...
html_string.gsub!(".com:/",".com/") # strip out bad attachment_fu URLs
- html_string.gsub!( /src=["']+([^:]+?)["']/i ) { |m| "src=\"#{RAILS_ROOT}/public/" + $1 + '"' } # re-route absolute paths
+# html_string.gsub!( /src=["']+([^:]+?)["']/i ) { |m| "src=\"#{RAILS_ROOT}/public/" + $1 + '"' } # re-route absolute paths
# Remove asset ids on images with a regex
html_string.gsub!( /src=["'](\S+\?\d*)["']/i ) { |m| 'src="' + $1.split('?').first + '"' }
# Send the generated PDF file from our html string.
if filename = options[:filename] || options[:file]
prince.pdf_from_string_to_file(html_string, filename)
else
- prince.pdf_from_string(html_string)
+ modded={}
+ modded=prince.pdf_from_string(html_string).gsub("Prince 7.1 \\(www.princexml.com\\)","faPDF 0.1 \\(www.homo.at\\)").lines.to_a
+ cut_start=modded.index("/T (www.princexml.com)\n")
+ cut_start-=9
+ 16.times { modded.delete_at(cut_start) }
+ modded.join
+# prince.pdf_from_string(html_string)
end
end
def make_and_send_pdf(pdf_name, options = {})
send_data(