Announcing genpdf, a user-friendly PDF generator written in pure Rust

genpdf (,,, source code) is a high-level PDF generator built on top of printpdf and rusttype. It takes care of the page layout and text alignment and renders a document tree into a PDF document. All of its dependencies are written in Rust, so you don’t need any pre-installed libraries or tools.

// Create a document and set the default font family
let mut doc = genpdf::Document::new("./fonts", "Liberation")
    .expect("Failed to create PDF document");
// Change the default settings
doc.set_title("Demo document");
// Add one or more elements
doc.push(genpdf::elements::Paragraph::new("This is a demo document."));
// Render the document and write it to a file
    .expect("Failed to write PDF file");

For a complete example with all supported elements, see the
examples/ file that generates this PDF document.

For more information, see the readme and the API documentation.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.