lib/resumetools/resume/pdf.rb in resumetools-0.2.9.2 vs lib/resumetools/resume/pdf.rb in resumetools-1.0.0
- old
+ new
@@ -28,13 +28,13 @@
module ResumeTools
module Renderer
module PDF
FONT_DIR = File.join(File.dirname(__FILE__), '..', '..', 'fonts')
- MARGINS = [1.0, 1.0, 1.0, 1.0]
+ MARGINS = [0.75, 1.0, 0.85, 1.0]
FONT_SIZES = {
- :default => 9,
+ :default => 10,
:header => 14,
:contact => 9,
:section => 11,
:para => 9,
:item => 9,
@@ -53,16 +53,10 @@
:bottom_margin => MARGINS[2].in,
:right_margin => MARGINS[3].in
)
pdf.font_families.update(
- "VeraSans" => {
- :normal => File.expand_path("Vera.ttf", FONT_DIR),
- :bold => File.expand_path("VeraBd.ttf", FONT_DIR),
- :italic => File.expand_path("VeraIt.ttf", FONT_DIR),
- :bold_italic => File.expand_path("VeraBI.ttf", FONT_DIR)
- },
"SourceSansPro" => {
:normal => File.expand_path("SourceSansPro-Regular.ttf", FONT_DIR),
:bold => File.expand_path("SourceSansPro-Semibold.ttf", FONT_DIR),
:italic => File.expand_path("SourceSansPro-It.ttf", FONT_DIR),
:bold_italic => File.expand_path("SourceSansPro-SemiboldIt.ttf", FONT_DIR)
@@ -71,22 +65,29 @@
# Set default font
pdf.font(default_font, :style => :normal, :size => FONT_SIZES[:default], :kerning => true)
# Name
- pdf.text self.full_name, :style => :bold, :size => FONT_SIZES[:header], :align => :center
+ pdf.text(self.full_name, style: :bold, size: FONT_SIZES[:header], align: :center)
# Contact info
self.header_lines.each do |line|
- pdf.text line, :align => :center
+ pdf.text(line, {
+ align: :center
+ })
end
- pdf.pad_bottom 20 do
+ pdf.pad_bottom 10 do
end
+ drawline(pdf)
+
+ pdf.pad_bottom 0 do
+ end
+
# Sections
- self.sections.each do |section|
+ self.sections.each_with_index do |section, index|
pdf.pad_top(20) do
# Section title
pdf.text section.title, :style => :bold, :size => FONT_SIZES[:section]
# Section paragraph
@@ -135,9 +136,16 @@
end
pdf.render
end
+ def drawline(pdf)
+ pdf.stroke do
+ pdf.line_width = 0.25
+ pdf.stroke_color("000000")
+ pdf.horizontal_rule
+ end
+ end
end #module PDF
end #module Renderer
Resume.class_eval do
include Renderer::PDF