Cactoos PDF is a collection of object-oriented Java classes to build a PDF document.
Motivation. We are not happy with current Java PDF solutions because:
-
Their code aren't truly object-oriented, i.e. they aren't obey these design principles
-
Their license code aren't really free to do anything, like MIT or BSD license
<dependency>
<groupId>com.github.fabriciofx</groupId>
<artifactId>cactoos-pdf</artifactId>
<version>0.0.1</version>
</dependency>
Java version required: 1.8+.
WARNING: Cactoos PDF is in a VERY early development stage. So the API can change at any moment.
Here an example how to build a Hello World PDF file using our API:
final File file = new File("HelloWorld.pdf");
final Id id = new Serial();
Files.write(
file.toPath(),
new Document(
id,
new DefaultPages(
id,
new DefaultPage(
id,
new Contents(
new Text(
id,
new TimesRoman(id, 18),
0,
500,
new TextOf("Hello World")
)
)
)
)
).asBytes()
);
More examples can be found here.
Contributions are welcome! Please, open an issue before submit any kind (ideas, documentation, code, ...) of contribution.
$ mvn clean install -Pqulice
The MIT License (MIT)
Copyright (C) 2023-2024 FabrĂcio Barros Cabral
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
David West (Blog) for:
- Object Thinking Book
@yegor256 as Yegor Bugayenko (Blog) for:
- Elegant Objects Vol. 1 and Vol. 2 books