yesod-content-pdf alternatives and similar packages
Based on the "yesod" category.
Alternatively, view yesod-content-pdf alternatives based on common mentions on social networks and blogs.
-
yesod-dsl
A domain specific language and a code generator desined to create RESTful services for managing an RDBMS with Yesod web framework and Persistent. -
yesod-raml
Generate Yesod framework route definitions, documentaiton, mock-handler, and more from your RAML spec. -
yesod-datatables
Routines for implementing server-side processing for DataTables (jQuery grid) in Haskell -
yesod-auth-hmac-keccak
DISCONTINUED. An account authentication plugin for yesod with encrypted token transfer.
InfluxDB - Power Real-Time Data Analytics at Scale
Do you think we are missing an alternative of yesod-content-pdf or a related project?
README
Yesod.Content.PDF
Library for serving PDF content from a Yesod application.
The library calls the wkhtmltopdf
command line tool to convert HTML pages to PDF documents, therefore it requires that wkhtmltopdf
is installed and on your PATH. Tested with wkhtmltopdf versions 0.9.6 and 0.12.5.
Example Usage:
-- html2PDF now takes an instance of WkhtmltopdfOptions, and a default instance is provided.
-- html2PDF :: MonadIO m => WkhtmltopdfOptions -> Html -> m PDF
-- using a dedicated handler function for serving PDF
getItemPDFR :: ItemId -> Handler PDF
getItemPDFR itemId = do
item <- runDB $ get404 itemId
html <- defaultLayout $(widgetFile "item")
liftIO (html2PDF def html)
-- using provideRep to respond to requests with Accept "application/pdf"
getItemR :: ItemId -> Handler TypedContent
getItemR itemId = do
item <- runDB $ get404 itemId
selectRep $ do
provideRep $ defaultLayout $(widgetFile "item") -- respond with text/html
provideRep $ return $ toJSON item -- respond with application/json
provideRep $ do -- respond with application/pdf
html <- defaultLayout $(widgetFile "item")
liftIO (html2PDF def html)
Available on Hackage
Package is usable, but in early development so the API is unstable. Issues and Pull Requests welcome.