Enhance content streams and pdf example 📝

This commit is contained in:
Laurenz 2019-02-25 18:44:55 +01:00
parent 8a87e4a623
commit 95d7edeb8d

View File

@ -3,18 +3,21 @@
//! output format like _PDF_. //! output format like _PDF_.
//! //!
//! # Example //! # Example
//! This is an example of compiling a _really_ simple document into _PDF_. //! This is an example of compiling a really simple document into _PDF_.
//! ``` //! ```
//! use typeset::{parsing::ParseTree, doc::Generate, export::WritePdf}; //! use typeset::{parsing::ParseTree, doc::Generate, export::WritePdf};
//! //!
//! let path = "hello-typeset.pdf"; //! // Create an output file.
//! # let path = "../target/hello-typeset.pdf"; //! # /*
//! let mut file = std::fs::File::create(path).unwrap(); //! let mut file = std::fs::File::create("hello-typeset.pdf").unwrap();
//! # */
//! # let mut file = std::fs::File::create("../target/hello-typeset.pdf").unwrap();
//! //!
//! // Parse the source and then generate the document. //! // Parse the source and then generate the document.
//! let src = "Hello World from Typeset!"; //! let src = "Hello World from Typeset!";
//! let doc = src.parse_tree().unwrap().generate().unwrap(); //! let doc = src.parse_tree().unwrap().generate().unwrap();
//! //!
//! // Write the document into file as PDF.
//! file.write_pdf(&doc).unwrap(); //! file.write_pdf(&doc).unwrap();
//! ``` //! ```