Revisions
-
janxious revised this gist
Dec 20, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ def render_with_doc_raptor( html ) DocRaptor.api_key SOME_KEY response = DocRaptor.create(:document_content => html, :document_type => :pdf, :name => 'filename.pdf', :test => true, :strict => "none") puts "Response Code: #{response.code}" -
mustmodify revised this gist
Dec 14, 2011 . 1 changed file with 28 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ require 'rubygems' require 'doc_raptor' def render_with_doc_raptor( html ) DocRaptor.api_key SOME_KEY response = DocRaptor.create(:document_content => html, :document_type => :pdf, :name => 'filename.pdf', :test => true, 'doc[strict]' => 'none') puts "Response Code: #{response.code}" if response.code == 200 f = File.open('public/sample.pdf', 'w') f.puts response.to_s f.close puts "please check /sample.pdf" else puts "\n\n#{response.body}" end end Dir.glob('public/svg/*.*').each do |filename| f = File.open(filename, 'r') puts "=======================================" puts "Trying #{filename}..." render_with_doc_raptor( f.read ) puts "\n\n\n" end -
mustmodify revised this gist
Dec 14, 2011 . 2 changed files with 0 additions and 30 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ <!DOCTYPE html> <html> <head> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +0,0 @@ -
mustmodify revised this gist
Dec 14, 2011 . 4 changed files with 59 additions and 39 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ <!DOCTYPE html> <html> <head> <title>MathML and SVG in text/html</title> </head> <body> <a href="https://developer.mozilla.org/en/Code_snippets/Embedding_SVG">Source</a> <h1>SVG in text/html</h1> <p><svg height=86 width=90 viewBox='5 9 90 86' style='float: left;'> <path stroke=#F53F0C stroke-width=10 fill=#F5C60C stroke-linejoin=round d='M 10,90 L 90,90 L 50,14 Z'/> <line stroke=black stroke-width=10 stroke-linecap=round x1=50 x2=50 y1=45 y2=75 /> </svg> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <body> <a href="https://developer.mozilla.org/en/Code_snippets/Embedding_SVG">Source</a> <p>hello</p> <svg:svg version="1.1" baseProfile="full" width="150" height="150"> <svg:rect x="10" y="10" width="100" height="100" fill="red"/> <svg:circle cx="50" cy="50" r="30" fill="blue"/> </svg:svg> <p>world</p> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,39 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ require 'rubygems' require 'doc_raptor' def render_with_doc_raptor( html ) DocRaptor.api_key '9C8MER0MpgFroXug239m' response = DocRaptor.create(:document_content => html, :document_type => :pdf, :name => 'filename.pdf', :test => true, 'doc[strict]' => 'none') puts "Response Code: #{response.code}" if response.code == 200 f = File.open('public/sample.pdf', 'w') f.puts response.to_s f.close puts "please check /sample.pdf" else puts "\n\n#{response.body}" end end Dir.glob('public/svg/*.*').each do |filename| f = File.open(filename, 'r') puts "=======================================" puts "Trying #{filename}..." render_with_doc_raptor( f.read ) puts "\n\n\n" end -
mustmodify created this gist
Dec 14, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ require 'rubygems' require 'doc_raptor' def render_with_doc_raptor( html ) DocRaptor.api_key SOME_KEY_HERE response = DocRaptor.create(:document_content => html, :document_type => :pdf, :name => 'filename.pdf', :test => true, 'doc[strict]' => 'none') puts "Response Code: #{response.code}" if response.code == 200 f = File.open('public/sample.pdf', 'w') f.puts response.to_s f.close puts "please check /sample.pdf" else puts "\n\n#{response.body}" end end # Example from https://developer.mozilla.org/en/Code_snippets/Embedding_SVG MOZILLA_XHTML_EXAMPLE = %| <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <body> <p>hello</p> <svg:svg version="1.1" baseProfile="full" width="150" height="150"> <svg:rect x="10" y="10" width="100" height="100" fill="red"/> <svg:circle cx="50" cy="50" r="30" fill="blue"/> </svg:svg> <p>world</p> </body> </html>| render_with_doc_raptor( MOZILLA_XHTML_EXAMPLE )