packages feed

yesod-content-pdf 0.2.0.3 → 0.2.0.4

raw patch · 3 files changed

+42/−16 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Yesod.Content.PDF: wkDisableSmartShrinking :: WkhtmltopdfOptions -> Bool

Files

src/Yesod/Content/PDF.hs view
@@ -16,6 +16,7 @@   , wkLowQuality   , wkPageSize   , wkOrientation+  , wkDisableSmartShrinking   , wkTitle   , wkMarginBottom   , wkMarginLeft@@ -105,6 +106,8 @@       -- ^ Page size (e.g. "A4", "Letter").     , wkOrientation     :: Orientation       -- ^ Orientation of the output.+    , wkDisableSmartShrinking  :: Bool+      -- ^ Intelligent shrinking strategy used by WebKit that makes the pixel/dpi ratio none constant.     , wkTitle           :: Maybe String       -- ^ Title of the generated PDF file.     , wkMarginBottom    :: UnitReal@@ -125,20 +128,21 @@  instance Default WkhtmltopdfOptions where   def = WkhtmltopdfOptions-    { wkCollate         = True-    , wkCopies          = 1-    , wkGrayscale       = False-    , wkLowQuality      = False-    , wkPageSize        = A4-    , wkOrientation     = Portrait-    , wkTitle           = Nothing-    , wkMarginBottom    = Mm 10-    , wkMarginLeft      = Mm 0-    , wkMarginRight     = Mm 0-    , wkMarginTop       = Mm 10-    , wkZoom            = 1-    , wkJavascriptDelay = Nothing-    , wkWindowStatus    = Nothing+    { wkCollate               = True+    , wkCopies                = 1+    , wkGrayscale             = False+    , wkLowQuality            = False+    , wkPageSize              = A4+    , wkOrientation           = Portrait+    , wkDisableSmartShrinking = False+    , wkTitle                 = Nothing+    , wkMarginBottom          = Mm 10+    , wkMarginLeft            = Mm 0+    , wkMarginRight           = Mm 0+    , wkMarginTop             = Mm 10+    , wkZoom                  = 1+    , wkJavascriptDelay       = Nothing+    , wkWindowStatus          = Nothing     }  -- | Cf. 'wkPageSize'.@@ -176,6 +180,7 @@       Prelude.concat        [ [ "--grayscale"  | True <- [wkGrayscale  opts] ]        , [ "--lowquality" | True <- [wkLowQuality opts] ]+       , [ "--disable-smart-shrinking" | True <- [wkLowQuality opts] ]        , toArgs (wkPageSize    opts)        , toArgs (wkOrientation opts)        , maybe [] (\t -> ["--title",            t     ]) (wkTitle           opts)
+ test/Yesod/Content/PDFSpec.hs view
@@ -0,0 +1,20 @@+-- |++module Yesod.Content.PDFSpec (main, spec) where++import Test.Hspec+import Yesod.Content.PDF+import Data.ByteString.UTF8 (toString)+import Text.Blaze.Html++main :: IO ()+main = hspec spec++h :: Html+h = toHtml ("<html><body>Hello World</body></html>" :: String)++spec :: Spec+spec = do+  describe "generate PDF from HTML document" $ do+    it "should generate PDF from html document" $ do+      (fmap ((take 8) . toString . pdfBytes) (html2PDF def h)) `shouldReturn` ("%PDF-1.4" :: String)
yesod-content-pdf.cabal view
@@ -1,7 +1,7 @@ name:                yesod-content-pdf-version:             0.2.0.3+version:             0.2.0.4 synopsis:            PDF Content Type for Yesod-description:         Please see README.md+description:         Provides a PDF content type for integrating wkhtmltopdf with Yesod apps. Please see README.md for further details. homepage:            https://github.com/alexkyllo/yesod-content-pdf#readme license:             BSD3 license-file:        LICENSE@@ -41,6 +41,7 @@   hs-source-dirs:      test   main-is:             Spec.hs   default-extensions:  OverloadedStrings+  other-modules:       Yesod.Content.PDFSpec   build-depends:       base                      , yesod-content-pdf                      , hspec