No commit activity in last 3 years
No release in over 3 years
A simple monthly calendar generator with space for notes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 10.0
~> 3.0

Runtime

~> 2.2
 Project Readme

Monthly Calendar Generator

This is a simple library which allows you to create monthly calendars which have space to write notes.

It allows you to create PDF files like this one.

Installation

Add this line to your application's Gemfile:

gem 'monthly_calendar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install monthly_calendar

Standard Usage

require 'monthly_calendar'

calendar = MonthlyCalendar.new(start_date: "January 2018", pages: 2)
calendar.save("calendar.pdf")

This example is the exact code which was used to generate the sample calendar. The start_date value can be any string that Date#parse can parse, and defaults to Date.today if it isn't provided. pages is probably self explanatory, but that is how many months will be generated, starting with start_date.

Advanced Usage

The API offers a #to_s method which will return the pdf as a string (using Prawn::Document#render).

The API also offers a #stream method which will yield the pdf as a string to the block you supply.

require 'monthly_calendar'

calendar = MonthlyCalendar.new(start_date: "January 2018", pages: 2)
calendar.stream do |calendar_string|
  puts calendar_string
end

# => %PDF-1.3
# => %����
# => 1 0 obj
# => << /Creator <feff0050007200610077006e>
# => /Producer <feff0050007200610077006e>
# ... 

These methods will allow you to easily do something like render the value as a response from a web server.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/brandoncc/monthly_calendar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MonthlyCalendar project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.