pdf.cr
A crystal PDF library in very early stages of development.
The immediate goal is to generate PDF files, possibly similar to the ruby gem
prawn
.
Installation
- Add the dependency to your
shard.yml
:
dependencies:
pdf:
github: oneiros/pdf.cr
- Run
shards install
Usage
require "pdf"
Document Creation DSL
include PDF::DSL
my_pdf = document do
page_size A4
page_orientation Orientation::Landscape
page do
text "Headline", at: {0, 10}
line from: {0, 0}, to: {10, 10}
end
page do
circle at: {100, 100}, radius: 20
end
end
my_pdf.write_to_file("/tmp/my.pdf")
Low-level primitives
The classes in src/pdf/core/
provide a very low-level abstraction, trying to
preserve naming used in the PDF spec.
src/pdf/core/primitives/
holds classes that represent "objects", the basic
building blocks of a PDF file.
Development
TODO Write development instructions here
Contributing
- Fork it (https://github.com/oneiros/pdf.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- David Roetzel - creator and maintainer