pdf_min/
lib.rs

1//! This crate implements minimal conversion from HTML to PDF.
2//!
3//! ToDo:
4//! Proper parsing of tag attibutes.
5//! Font sizing, html tables.
6//! A whole lot more.
7
8//!# Test example
9//!
10//! ```
11//!    use pdf_min::*;
12//!    let source = format!("
13//!<html>
14//!<head>
15//!   <title>Rust is Great</title>
16//!</head>
17//!<body>
18//!<h1>Important Notice&excl;</h1>
19//!<p>Hello <b>something bold</b> ok</p>
20//!<p>Hi <i>italic test</i>
21//!<p>Hi <i><b>bold italic test</b> ok</i>
22//!<p>Hi <sup>sup test</sup> ok
23//!<p>Hi <sub>sub text</sub> ok
24//!<p>{}
25//!</body>
26//!</html>
27//!","Some words to cause Line and Page wrapping ".repeat(200));
28//!    let mut w = Writer::default();
29//!    w.b.nocomp = true;
30//!    w.line_pad = 8; // Other Writer default values could be adjusted here.
31//!    html(&mut w, source.as_bytes());
32//!    w.finish();
33//!
34//!    use std::fs::File;
35//!    use std::io::prelude::*;
36//!
37//!    let mut file = File::create("test.pdf").unwrap();
38//!    file.write_all(&w.b.b).unwrap();
39//! ```
40
41#![forbid(unsafe_code)]
42#![warn(missing_docs)]
43
44/// Low level PDF writer.
45pub mod basic;
46/// PDF fonts.
47pub mod font;
48/// PDF page.
49pub mod page;
50/// High level PDF writer.
51pub mod writer;
52
53use basic::*;
54use font::*;
55use page::*;
56pub use writer::{html, Writer};