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 'prawn' | |
require 'barby' | |
require 'barby/barcode/code_128' | |
require 'barby/outputter/prawn_outputter' | |
barcode = Barby::Code128B.new('1234567890') | |
outputter = Barby::PrawnOutputter.new(barcode) | |
pdf = Prawn::Document.new | |
pdf.text "bla" |
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 ReportPdf | |
include Prawn::View | |
def initialize(notice) | |
@notice = notice | |
noc_header | |
notice_of_claim | |
verification_header | |
verification_body | |
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
require 'rubygems' | |
require 'prawn' | |
require 'prawn/measurement_extensions' | |
class Sheet | |
SIZE = "LETTER" | |
LAYOUT = :portrait | |
ELEMENTS = { | |
:header => { :position => [(4.5).in, (10.0).in], :width => 3.in }, |
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 'prawn' | |
module Reports | |
class PrawnReport < Reports::Report | |
#call this from irb or any ruby code for that matter (i.e. Reports::PrawnReport.generate) | |
def self.generate | |
Prawn::Document.generate('prawn.pdf') do |pdf| | |
report_header(pdf) | |
report_body(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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'prawn' | |
@pdf = Prawn::Document.new | |
x = 0 | |
texts = [ "alexander", "the alexander", "the alexander building" ] | |
texts.each do |text| |
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
pdf = Prawn::Document.new(:page_size => [ 459, 595 ]) | |
pdf.font_families.update( | |
"Gill" => { :bold => "#{Prawn::BASEDIR}/data/fonts/GillSansBold.ttf", | |
:italic => "#{Prawn::BASEDIR}/data/fonts/GillSansItalic.ttf", | |
:bold_italic => "#{Prawn::BASEDIR}/data/fonts/GillSansBoldItalic.ttf", | |
:light => "#{Prawn::BASEDIR}/data/fonts/GillSansLight.ttf", | |
:light_italic => "#{Prawn::BASEDIR}/data/fonts/GillSansLightItalic.ttf", | |
:normal => "#{Prawn::BASEDIR}/data/fonts/GillSans.ttf" } ) | |
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
#Gallery | |
pdf = Prawn::Document.new(:page_size => [ 459, 595 ]) | |
pdf.font_families.update( | |
"Gill" => { :bold => "#{Prawn::BASEDIR}/data/fonts/GillSansBold.ttf", | |
:italic => "#{Prawn::BASEDIR}/data/fonts/GillSansItalic.ttf", | |
:bold_italic => "#{Prawn::BASEDIR}/data/fonts/GillSansBoldItalic.ttf", | |
:light => "#{Prawn::BASEDIR}/data/fonts/GillSansLight.ttf", | |
:light_italic => "#{Prawn::BASEDIR}/data/fonts/GillSansLightItalic.ttf", | |
:normal => "#{Prawn::BASEDIR}/data/fonts/GillSans.ttf" }) |
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
module MaRuKu::Out::Prawn | |
def to_prawn(pdf) | |
@pdf = pdf | |
@pdf.font_size = 11 | |
array_to_prawn(@children) | |
end | |
def array_to_prawn(children) | |
children.each do |c| | |
send("to_prawn_#{c.node_type}", c) |
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 'jekyll' | |
require 'maruku' | |
require 'pathname' | |
# Need pre for inline format support | |
gem 'prawn', '=0.11.1.pre' | |
require 'prawn' | |
require 'to_prawn' | |
class Converter |
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 header pdf | |
pdf.repeat :all do | |
pdf.bounding_box([0, 720], :width => 540, :height => 720) do | |
pdf.stroke_bounds | |
pdf.cell :content => "<b><font size='17'>Company Name PTE LTD</font></b> | |
email: [email protected] web: www.sptiele.com", | |
:inline_format => true, | |
:leading => 10, | |
:width => pdf.bounds.width, | |
:height => 110, |