-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace prawn-format by prawn-markup
TODO: - [] Make sure that the pdf is generated correctly - [] Make sure all styles are correct
- Loading branch information
1 parent
48ead26
commit 59359bd
Showing
10 changed files
with
92 additions
and
70 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'prawn/format' | ||
|
||
class Pdf::Styles::BlackAndWhite < Pdf::Styles::Base | ||
|
||
def tags | ||
super.merge( | ||
{ :domain => { :font_weight => :bold, :font_size => 14}, | ||
:period => { :font_size => 6.mm}, | ||
:date => { :font_size => 5.mm, :font_weight => :bold}, | ||
{ :domain => { :font_weight => :bold, :font_size => 14 }, | ||
:period => { :font_size => 6.mm }, | ||
:date => { :font_size => 5.mm, :font_weight => :bold }, | ||
:subtitle => { :font_size => 4.mm, :font_weight => :bold }, | ||
:td => { :font_size => 3.mm, :font_weight => :bold }, | ||
:th => { :font_weight => :bold, :font_size => 3.5.mm, :color => "ffffff"}, | ||
:small => { :font_size => 3.5.mm, :color => "555"}, | ||
:red => { :color => 'black'}, | ||
:green => { :color => 'b0b0b0'}, | ||
:b => { :style => :bold } | ||
table: { | ||
header: { style: :bold, size: 3.mm, color: "ffffff" }, | ||
cell: { size: 3.mm, style: :bold} | ||
}, | ||
:small => { :font_size => 3.5.mm, :color => "555" }, | ||
:red => { :color => 'black' }, | ||
:green => { :color => 'b0b0b0' }, | ||
:b => { :style => :bold } | ||
}) | ||
end | ||
|
||
def table_style | ||
super.merge(:border_color => 'a7a7a7', | ||
:header_color => 'd6d6d6', | ||
# :row_colors => [ "d6d6d6d", "efefef" ], | ||
:row_colors => %w[ffffff ffffff]) | ||
super.deep_merge( | ||
cell_style: { :border_color => 'a7a7a7' }, | ||
:header_color => 'd6d6d6', | ||
# :row_colors => [ "d6d6d6d", "efefef" ], | ||
:row_colors => %w[ffffff ffffff]) | ||
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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# require 'prawn' | ||
# require 'prawn/format' | ||
require "prawn/measurement_extensions" | ||
require 'gruff' | ||
require "open-uri" | ||
|
||
module Prawn | ||
class Table | ||
def header_color=(color) | ||
row(0).background_color = color | ||
end | ||
|
||
class Cell | ||
class << self | ||
prepend(Module.new do | ||
def make(pdf, content, options = {}) | ||
content = content.to_s if content.is_a?(ThreeScale::Money) | ||
super(pdf, content, options) | ||
end | ||
end) | ||
end | ||
end | ||
end | ||
end |