Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for serving PDF from Yesod. Uses and depends on command line utility wkhtmltopdf to render PDF from HTML.
- uri2PDF :: MonadIO m => WkhtmltopdfOptions -> URI -> m PDF
- html2PDF :: MonadIO m => WkhtmltopdfOptions -> Html -> m PDF
- newtype PDF = PDF {}
- typePDF :: ContentType
- def :: Default a => a
- data WkhtmltopdfOptions
- wkCollate :: WkhtmltopdfOptions -> Bool
- wkCopies :: WkhtmltopdfOptions -> Int
- wkGrayscale :: WkhtmltopdfOptions -> Bool
- wkLowQuality :: WkhtmltopdfOptions -> Bool
- wkPageSize :: WkhtmltopdfOptions -> PageSize
- wkOrientation :: WkhtmltopdfOptions -> Orientation
- wkTitle :: WkhtmltopdfOptions -> Maybe String
- wkMarginBottom :: WkhtmltopdfOptions -> UnitReal
- wkMarginLeft :: WkhtmltopdfOptions -> UnitReal
- wkMarginRight :: WkhtmltopdfOptions -> UnitReal
- wkMarginTop :: WkhtmltopdfOptions -> UnitReal
- wkZoom :: WkhtmltopdfOptions -> Double
- data PageSize
- data Orientation
- data UnitReal
Conversion
uri2PDF :: MonadIO m => WkhtmltopdfOptions -> URI -> m PDF Source
Use wkhtmltopdf to render a PDF given the URI pointing to an HTML document.
html2PDF :: MonadIO m => WkhtmltopdfOptions -> Html -> m PDF Source
Use wkhtmltopdf to render a PDF from an HTML (Text.Blaze.Html) type.
Data type
Provide MIME type "application/pdf" as a ContentType for Yesod.
Options
data WkhtmltopdfOptions Source
Options passed to wkhtmltopdf. Please use the def
value
and then modify individual settings. For more information, see
http://www.yesodweb.com/book/settings-types.
wkCollate :: WkhtmltopdfOptions -> Bool Source
Collate when printing multiple copies.
wkCopies :: WkhtmltopdfOptions -> Int Source
Number of copies to print into the PDF file.
wkGrayscale :: WkhtmltopdfOptions -> Bool Source
Whether output PDF should be in grayscale.
wkLowQuality :: WkhtmltopdfOptions -> Bool Source
Generate lower quality output to conserve space.
wkOrientation :: WkhtmltopdfOptions -> Orientation Source
Orientation of the output.
wkTitle :: WkhtmltopdfOptions -> Maybe String Source
Title of the generated PDF file.
wkMarginBottom :: WkhtmltopdfOptions -> UnitReal Source
Bottom margin size.
wkMarginLeft :: WkhtmltopdfOptions -> UnitReal Source
Left margin size.
wkMarginRight :: WkhtmltopdfOptions -> UnitReal Source
Right margin size.
wkMarginTop :: WkhtmltopdfOptions -> UnitReal Source
Top margin size.
wkZoom :: WkhtmltopdfOptions -> Double Source
Zoom factor.
Cf. wkPageSize
.
A4 | |
Letter | |
OtherPageSize String | |
CustomPageSize UnitReal UnitReal | Height and width. |
data Orientation Source
Cf. wkOrientation
.