https://github.com/oneiros/pdf.cr
crystal library for pdf generation (WIP)
https://github.com/oneiros/pdf.cr
crystal pdf pdf-generation
Last synced: 12 months ago
JSON representation
crystal library for pdf generation (WIP)
- Host: GitHub
- URL: https://github.com/oneiros/pdf.cr
- Owner: oneiros
- License: mit
- Archived: true
- Created: 2019-01-08T15:46:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-08T15:46:50.000Z (about 7 years ago)
- Last Synced: 2025-03-16T05:15:32.545Z (about 1 year ago)
- Topics: crystal, pdf, pdf-generation
- Language: Crystal
- Size: 9.77 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
pdf:
github: oneiros/pdf.cr
```
2. Run `shards install`
## Usage
```crystal
require "pdf"
```
### Document Creation DSL
```crystal
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
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [David Roetzel](https://github.com/oneiros) - creator and maintainer