| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Text.PDF.Slave
Description
Reexports
- type TemplateName = Text
- type TemplateInput = Value
- type TemplateBody = Text
- type TemplateBibtex = Text
- type DependencyBody = ByteString
- type BibTexBody = Text
- data TemplateDependency :: *
- data Template :: * = Template {}
- data TemplateDependencyFile :: *
- data TemplateFile :: * = TemplateFile {}
- loadTemplateInMemory :: TemplateFile -> FilePath -> Sh (Either String Template)
- storeTemplateInFiles :: Template -> FilePath -> Sh TemplateFile
- type PDFContent = ByteString
- data PDFRenderException
- displayPDFRenderException :: PDFRenderException -> String
- renderBundleOrTemplateFromFile :: FilePath -> Maybe Value -> Bool -> Sh PDFContent
- renderFromFileBundleToPDF :: FilePath -> Maybe Value -> Bool -> Sh PDFContent
- renderFromFileToPDF :: FilePath -> Bool -> Sh PDFContent
- renderBundleToPDF :: Template -> Bool -> Sh PDFContent
- renderTemplateToPDF :: TemplateFile -> FilePath -> Bool -> Sh PDFContent
Template definition
type TemplateName = Text #
Template unique name
type TemplateInput = Value #
A template takes simple YAML document as input
type TemplateBody = Text #
Template body is text with .htex content
type TemplateBibtex = Text #
Template can define additional bibtex database
type DependencyBody = ByteString #
Dependency can be a binary file
type BibTexBody = Text #
Content of bibtex file
data TemplateDependency :: * #
Template has different types of dependencies, each type of the dependecy has own affect on rendering pipe.
Constructors
| BibtexDep BibTexBody | Bibtex file for references to other documents. Need call to bibtex |
| TemplateDep Template | HTex file that need to be compiled to .tex file |
| TemplatePdfDep Template | HTex file that need to be compiled to .pdf file |
| OtherDep DependencyBody | Any other file that doesn't need a compilation (listings, images, etc) |
Description of document template
Constructors
| Template | |
Fields
| |
data TemplateDependencyFile :: * #
Same as TemplateDependency but keeps contents in separate files
Constructors
| BibtexDepFile | Bibtex file for references to other documents. Need call to bibtex. Name of dependency is a filename with contents. |
| TemplateDepFile TemplateFile | HTex file that need to be compiled to .tex file Name of dependency defines a subfolder for the template. |
| TemplatePdfDepFile TemplateFile | HTex file that need to be compiled to .pdf file Name of dependency deinfes a subfolder for the template. |
| OtherDepFile | Any other file that doesn't need a compilation (listings, images, etc) Name of dependency is a filename with contents. |
data TemplateFile :: * #
Same as Template, but holds info about template content and dependencies
in other files.
Constructors
| TemplateFile | |
Fields
| |
Instances
Bundle helpers
loadTemplateInMemory :: TemplateFile -> FilePath -> Sh (Either String Template) Source #
Load all external references of template into memory
storeTemplateInFiles :: Template -> FilePath -> Sh TemplateFile Source #
Extract all external references of template into file system
Template rendering to PDF
type PDFContent = ByteString Source #
Contents of PDF file
data PDFRenderException Source #
Errors that are thrown by rendering functions
Constructors
| TemplateFormatError FilePath ParseException | Failed to parse template YAML |
| BundleFormatError FilePath ParseException | Failed to parse template bundle YAML | Failed to parse file in both formats: bundle and template file. |
| BundleOrTemplateFormatError FilePath ParseException ParseException | |
| InputFileFormatError FilePath String | Failed to parse JSON input |
displayPDFRenderException :: PDFRenderException -> String Source #
Convert PDF rendering exception to user readable format
renderBundleOrTemplateFromFile Source #
Arguments
| :: FilePath | Path to either bundle |
| -> Maybe Value | Overwrite of input JSON for bundle |
| -> Bool | Nuke temp folder? |
| -> Sh PDFContent |
Helper to render either a bundle or distributed template from file to PDF.
renderFromFileBundleToPDF Source #
Arguments
| :: FilePath | Path to |
| -> Maybe Value | Overwrite of input JSON for bundle |
| -> Bool | Nuke temp folder? |
| -> Sh PDFContent |
Helper to render from all-in bundle template
Arguments
| :: FilePath | Path to |
| -> Bool | Nuke temp folder? |
| -> Sh PDFContent |
Helper to render from template file
Arguments
| :: Template | Input all-in template |
| -> Bool | Nuke temp folder? |
| -> Sh PDFContent |
Unpack bundle, render the template, cleanup and return PDF
Arguments
| :: TemplateFile | Input template |
| -> FilePath | Base directory |
| -> Bool | Nuke temp folder? |
| -> Sh PDFContent | Output PDF file |
Render template and return content of resulted PDF file