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
# coding: utf-8 | |
require 'rubygems' | |
require 'thinreports' | |
ThinReports.configure do | |
generator.pdf.eudc_fonts = 'eudc.ttf' | |
end | |
ThinReports::Report.generate_file('eudc.pdf', :layout => 'eudc.tlf') do |
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
# coding: utf-8 | |
require 'rubygems' | |
require 'thinreports' | |
report = ThinReports::Report.new :layout => 'security.tlf' | |
report.start_new_page | |
# See more details: | |
# [Prawn Documentation] |
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
# coding: utf-8 | |
require 'rghost' | |
require 'rghost_barcode' | |
require 'thinreports' | |
RGhost::Config::GS[:path] = '/usr/local/bin/gs' | |
bar = RGhost::Document.new :paper => ['10 cm', '1 cm'] | |
bar.barcode_japanpost '26300233-30-8-403', |
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
最短マッチ | |
<.\{-}> #=> <a><b> = "<a>" | |
改行を含む任意の一文字 | |
\_.* #=> foo\nbar\nhoge = "foo\nbar\nhoge" | |
CAUTION: | |
注意すべきは、"\"は「円(¥)」ではなく「バックスラッシュ」であること | |
MEMO: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<meta charset="UTF-8"> | |
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script> | |
function hoge() { | |
$.ajax({ | |
type: 'get', |
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
# coding: utf-8 | |
require 'thinreports' | |
report = ThinReports::Report.new :layout => 'hello_world.tlf' | |
report.start_new_page do | |
item(:hello_world).value('World') | |
end | |
report.generate_file('hello_world.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
# coding: utf-8 | |
require 'thinreports' | |
report = ThinReports::Report.new :layout => 'dynamic_image.tlf' | |
report.start_new_page do | |
item(:image).src('rails.png') | |
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
class TasksController < ApplicationController | |
def index | |
@tasks = Tasks.all | |
respond_to do |format| | |
format.html | |
# GET /tasks.pdf | |
# response as pdf | |
format.pdf do | |
report = ThinReports::Report.new :layout => 'tasks.tlf' | |
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
# app/controllers/tasks_controller.rb | |
class TasksController < ApplicationController | |
def index | |
@tasks = Task.all | |
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
# app/views/tasks/index.pdf.thinreports | |
report.set_layout | |
@tasks.each do |task| | |
report.list.add_row :name => task.name | |
end |