This file contains 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 characters
require 'sinatra' | |
not_found do | |
halt 404, 'Shit\'s busted.' | |
end | |
get '/input' do | |
@input = params[:input] | |
case params[:input] | |
when "go north" |
This file contains 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 characters
using System; | |
using System.IO; | |
using System.Text; | |
using System.Net; | |
using System.Web; | |
namespace DocRaptorConsoleExample { | |
class DocRaptor { | |
private const string PostFormat = "doc[{0}]={1}&doc[name]={2}&doc[document_type]={3}&doc[test]={4}"; | |
private const string ApiKey = @"YOUR API KEY HERE"; |
This file contains 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 characters
require 'rubygems' | |
require 'doc_raptor' | |
TEN_SECONDS = 10 | |
FIVE_MINUTES = 300 | |
DocRaptor.api_key "YOUR_API_KEY_HERE" | |
xls_html = "<table name='My First Sheet'><tr><td>Cell 1</td><td>Cell 2</td></tr></table>" |
This file contains 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 characters
#This simple Curl example will create a sample test Excel file with the authentication information as part of the POST data. All you have to do is copy this code, plug in your API key, and paste it into a command line. | |
curl -H "Content-Type:application/json" -d'{"user_credentials":"YOUR_API_KEY_HERE", "doc":{"name":"docraptor_sample.xls", "document_type":"xls", "test":"true", "document_content":"<table><tr><td>Example!</td></tr></table>"}}' http://docraptor.com/docs > docraptor_sample.xls |
This file contains 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 characters
asdf |
This file contains 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 characters
def show | |
@random = Random.find(params[:id]) | |
respond_to do |format| | |
format.html | |
format.pdf { doc_raptor_send } | |
end | |
end |
This file contains 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 characters
def show | |
@random = Random.find(params[:id]) | |
respond_to do |format| | |
format.html | |
format.pdf { doc_raptor_send } | |
end | |
end | |
def doc_raptor_send(options = { }) | |
default_options = { |
This file contains 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 characters
<%= show_for @random do |s| %> | |
<%= s.attribute :title %> | |
<% end %> | |
<%= link_to 'Edit', edit_random_path(@random) %> | | |
<%= link_to 'Back', randoms_path %> | |
<%= link_to("Download Random PDF", random_path(@random, format: :pdf)) %> |
This file contains 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 characters
<style type="text/css"> | |
/* setup the page */ | |
@page { | |
size: US-Letter; | |
margin: 0 0 35mm 0; | |
background: #ffffff; | |
} | |
/* setup the footer */ | |
@page { |
This file contains 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 characters
<style type="text/css"> | |
/* setup the page */ | |
@page { | |
size: US-Letter; | |
margin: 0 0 35mm 0; | |
background: #ffffff; | |
} | |
/* setup the footer */ | |
@page { |