diff --git a/src/Yesod/Content/PDF.hs b/src/Yesod/Content/PDF.hs
--- a/src/Yesod/Content/PDF.hs
+++ b/src/Yesod/Content/PDF.hs
@@ -31,6 +31,7 @@
 import Blaze.ByteString.Builder.ByteString
 import Control.Monad.IO.Class (MonadIO(..))
 import Data.ByteString
+import Data.ByteString.Builder (hPutBuilder)
 import Data.Conduit
 import Data.Default (Default(..))
 import Network.URI
@@ -38,10 +39,11 @@
 import System.IO.Temp
 import System.Process
 import Text.Blaze.Html
-import Text.Blaze.Html.Renderer.String
+import Text.Blaze.Html.Renderer.Utf8
 import Yesod.Core.Content
 
-newtype PDF = PDF ByteString
+newtype PDF = PDF { pdfBytes :: ByteString }
+            deriving (Eq, Ord, Read, Show)
 
 -- | Provide MIME type "application/pdf" as a ContentType for Yesod.
 typePDF :: ContentType
@@ -66,8 +68,10 @@
 html2PDF opts html =
   wkhtmltopdf opts $ \inner ->
   withSystemTempFile "input.html" $ \tempHtmlFp tempHtmlHandle -> do
-    System.IO.hPutStrLn tempHtmlHandle $ renderHtml html
-    hClose tempHtmlHandle
+    hSetBinaryMode tempHtmlHandle True
+    hSetBuffering  tempHtmlHandle $ BlockBuffering Nothing
+    hPutBuilder    tempHtmlHandle $ renderHtmlBuilder html
+    hClose         tempHtmlHandle
     inner tempHtmlFp
 
 -- | (Internal) Call wkhtmltopdf.
diff --git a/test/Spec.hs b/test/Spec.hs
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -1,2 +1,9 @@
+import Test.Hspec
+import qualified Yesod.Content.PDFSpec
+
 main :: IO ()
-main = putStrLn "Test suite not yet implemented"
+main = hspec spec
+
+spec :: Spec
+spec = do
+  describe "Yesod.Content.PDF" Yesod.Content.PDFSpec.spec
diff --git a/yesod-content-pdf.cabal b/yesod-content-pdf.cabal
--- a/yesod-content-pdf.cabal
+++ b/yesod-content-pdf.cabal
@@ -1,5 +1,5 @@
 name:                yesod-content-pdf
-version:             0.2.0.0
+version:             0.2.0.1
 synopsis:            PDF Content Type for Yesod
 description:         Please see README.md
 homepage:            https://github.com/alexkyllo/yesod-content-pdf#readme
@@ -19,6 +19,7 @@
   default-extensions:  OverloadedStrings
                      , TypeSynonymInstances
                      , FlexibleInstances
+                     , GeneralizedNewtypeDeriving
 
   build-depends:       base >= 4.7 && < 5
                      , blaze-builder
@@ -39,8 +40,13 @@
   type:                exitcode-stdio-1.0
   hs-source-dirs:      test
   main-is:             Spec.hs
+  default-extensions:  OverloadedStrings
   build-depends:       base
                      , yesod-content-pdf
+                     , hspec
+                     , hspec-expectations
+                     , utf8-string
+                     , blaze-html
   ghc-options:         -threaded -rtsopts -with-rtsopts=-N
   default-language:    Haskell2010
 
