packages feed

HPDF 1.4.2 → 1.4.3

raw patch · 33 files changed

+444/−76 lines, 33 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Graphics.PDF: pdfByteString :: PDFDocumentInfo -> PDFRect -> PDF a -> IO (ByteString)
- Graphics.PDF.Document: class PDFXObject a
+ Graphics.PDF.Document: class PDFXObject a where privateDrawXObject (PDFReference r) = do { xobjectMap <- gets xobjects; (newName, newMap) <- setResource "XObject" (PDFReference r) xobjectMap; modifyStrict $ \ s -> s {xobjects = newMap}; tell . mconcat $ [serialize "\ \/", serialize newName, serialize " Do"] } drawXObject = privateDrawXObject
- Graphics.PDF.Shapes: class Shape a
+ Graphics.PDF.Shapes: class Shape a where stroke r = do { addShape r; strokePath } fill r = do { addShape r; fillPath } fillAndStroke r = do { addShape r; fillAndStrokePath } fillEO r = do { addShape r; fillPathEO } fillAndStrokeEO r = do { addShape r; fillAndStrokePathEO }
- Graphics.PDF.Typesetting: Glue :: !PDFFloat -> !PDFFloat -> !PDFFloat -> !Maybe s -> Letter s
+ Graphics.PDF.Typesetting: Glue :: !PDFFloat -> !PDFFloat -> !PDFFloat -> !(Maybe s) -> Letter s
- Graphics.PDF.Typesetting: Kern :: !PDFFloat -> !Maybe s -> Letter s
+ Graphics.PDF.Typesetting: Kern :: !PDFFloat -> !(Maybe s) -> Letter s
- Graphics.PDF.Typesetting: Letter :: BoxDimension -> !AnyBox -> !Maybe s -> Letter s
+ Graphics.PDF.Typesetting: Letter :: BoxDimension -> !AnyBox -> !(Maybe s) -> Letter s
- Graphics.PDF.Typesetting: class Box a
+ Graphics.PDF.Typesetting: class Box a where boxAscent a = boxHeight a - boxDescent a
- Graphics.PDF.Typesetting: class (ComparableStyle a, Style s) => ParagraphStyle a s | a -> s
+ Graphics.PDF.Typesetting: class (ComparableStyle a, Style s) => ParagraphStyle a s | a -> s where interline _ = Nothing lineWidth _ w _ = w linePosition _ _ = const 0.0 paragraphChange a _ l = (a, l) paragraphStyle _ = Nothing
- Graphics.PDF.Typesetting: class ComparableStyle a => Style a
+ Graphics.PDF.Typesetting: class ComparableStyle a => Style a where sentenceStyle _ = Nothing wordStyle _ = Nothing updateStyle = id styleHeight = getHeight . textFont . textStyle styleDescent = getDescent . textFont . textStyle

Files

Graphics/PDF.hs view
@@ -1,6 +1,7 @@+{-# LANGUAGE CPP #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpheccar 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -8,6 +9,10 @@ -- Portability : portable -- -- Generation of PDF documents+-- A PDF library with support for several pages, page transitions, outlines, annotations, compression, +-- colors, shapes, patterns, jpegs, fonts, typesetting ... Have a look at the "Graphics.PDF.Documentation" +-- module to see how to use it. Or, download the package and look at the test.hs file +-- in the Test folder. That file is giving an example of each feature. --------------------------------------------------------- module Graphics.PDF   (@@ -15,6 +20,7 @@   -- ** PDF Monad     PDF    , runPdf+  , pdfByteString   -- ** PDF Common Types   , PDFRect(..)   , PDFFloat@@ -60,7 +66,6 @@ import qualified Data.Map as M import qualified Data.ByteString.Lazy as B import Data.Int-import System.IO import Text.Printf(printf) import Control.Monad.State import Graphics.PDF.Annotation@@ -232,7 +237,16 @@                 , serialize (show len)                 , serialize "\n%%EOF"                 ]-      ++-- | Generate a lazy bytestring for the PDF     +pdfByteString :: PDFDocumentInfo+              -> PDFRect -- ^ Default size for a page+              -> PDF a  -- ^ PDF action +              -> IO (B.ByteString) +pdfByteString infos rect m = do +    let content = createObjectByteStrings (defaultPdfSettings {defaultRect = rect, docInfo = infos} ) m+    return (toLazyByteString content)+ -- | Generates a PDF document runPdf :: String -- ^ Name of the PDF document        -> PDFDocumentInfo@@ -240,7 +254,7 @@        -> PDF a  -- ^ PDF action         -> IO () runPdf filename infos rect m = do-  let content = createObjectByteStrings (defaultPdfSettings {defaultRect = rect, docInfo = infos} ) m-  B.writeFile filename (toLazyByteString content)+  bytestring <- pdfByteString infos rect m +  B.writeFile filename bytestring  
Graphics/PDF/Action.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Annotation.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Colors.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -34,7 +34,6 @@ import Graphics.PDF.Resources import Control.Monad.Writer import Graphics.PDF.LowLevel.Serializer-import Data.Monoid              black :: Color black = Rgb 0 0 0  
Graphics/PDF/Coordinates.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Data/PDFTree.hs view
@@ -1,4 +1,6 @@-{-# OPTIONS -cpp -fglasgow-exts -XNoBangPatterns #-} +{-# LANGUAGE CPP #-}+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE NoBangPatterns #-} ----------------------------------------------------------------------------- -- | -- Module      :  PDFTree.hs@@ -28,7 +30,7 @@  ) where   import Prelude hiding (lookup,map,filter,foldr,foldl,null)-import Data.Bits +import Data.Bits #if __GLASGOW_HASKELL__ >= 503 import GHC.Exts ( Word(..), Int(..), shiftRL# ) #elif __GLASGOW_HASKELL__
Graphics/PDF/Data/Trie.hs view
@@ -1,6 +1,7 @@+{-# LANGUAGE CPP #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Document.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
+ Graphics/PDF/Documentation.hs view
@@ -0,0 +1,332 @@+{- | Quick documentation for the PDF library.++For detailed examples, download the tar.gz package from Hackage and look at the+test.hs in folder Test.++-}+module Graphics.PDF.Documentation(+	-- * Creating a document+	-- $creating++	-- * Adding pages+	-- $pages++	-- * Creating the page content +	-- $content++	-- * Text +	-- $text++	-- ** MonadStyle +	-- $monadstyle++	-- * Geometry +	-- $geometry++	-- * X Form +	-- $xform++	-- * Image +	-- $image++	-- * Annotations +	-- $annotations++	-- * Warning +	-- $warning+	) where ++import Graphics.PDF++{- $creating ++When you create a document, you must give some information for the PDF file like the author,+the default size (the pages can use different sizes if specified) and if the document is compressed.++So, a standard way to start a PDF document is with:++@+main :: IO()+main = do+    let rect = 'PDFRect' 0 0 600 400+    'runPdf' \"demo.pdf\" ('standardDocInfo' { author='toPDFString' \"alpheccar\", compressed = False}) rect $ do+        myDocument+@++where myDocument is generating the pages and is a value of the PDF monad.+-}+++{- $pages++You can add pages and specify a hierarchical structure for the pages. This hierarchy is optional. Here is an example+of how you could add some pages and specify the table of contents:++@+myDocument :: 'PDF' () +myDocument = do+    page1 <- 'addPage' Nothing+    'newSection' ('toPDFString' \"Section\") Nothing Nothing $ do+     'newSection' ('toPDFString' \"Subsection\") Nothing Nothing $ do+        createPageContent page1+@++when you use 'addPage' you can specify a different size for the page or use the document's default one.+In 'newSection', the two Maybe options are used to style the entry in the PDF table of contents.++There are other functions to add pages with transitions.+-}++{- $content++To create content for a page, you have to use a page reference with 'drawWithPage'.++'drawWithPage' is using a 'Draw' monad value.++Element of the 'Draw' monad are built with geometry, text and color primitives.++@+createPageContent :: 'PDFReference' 'PDFPage' -> Draw () +createPageContent page = 'drawWithPage' page $ do +    'strokeColor' 'red'+    'setWidth' 0.5+    'stroke' $ 'Rectangle' 10 0 200 300+@++-}++{- $text++Text is complex. You can use the low level 'PDFText' to create a text in the 'Draw' monad. For instance:++@+textText :: 'PDFFont' -> 'PDFString' -> 'Draw' ()+textText f t = do+     'drawText' $ do+         'setFont' f+         'textStart' 10 200.0+         'leading' $ 'getHeight' f+         'renderMode' 'FillText'+         'displayText' t+         'startNewLine'+         'displayText' $ 'toPDFString' \"Another little test\"+@++It gives a detailed control on the position of characters and lines but it is too much work.++The library is thus supporting a higher level typesetting system with paragraph styles.++Displaying a formatted text is done with 'displayFormattedText' and using a typesetting monad value:++@+'displayFormattedText' ('Rectangle' (10 :+ 0) (110 :+ 300)) 'NormalPara' 'Normal' $ do +   'paragraph' $ do+        'txt' $ \"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor \"+        'txt' $ \"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud \"+        'txt' $ \"exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute \"+        'txt' $ \"irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla \"+        'txt' $ \"pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia \"+        'txt' $ \"deserunt mollit anim id est laborum.\"+@++The text will be formatted using the NormalPara paragraph style and the Normal style for sentences.++NormalPara is part of an algebraic data type defining some vertical styles (from file test.hs):++@+data MyVertStyles = NormalPara+                  | CirclePara+                  | BluePara !PDFFloat+@++and Normal is part of another algebraic data typec (from file test.hs):++@+data MyParaStyles = Normal+                  | Bold+                  | Crazy+                  | SuperCrazy [Int] [PDFFloat]+                  | DebugStyle+                  | RedRectStyle+                  | BlueStyle+@++The library is coming with standard styles 'StandardParagraphStyle' and 'StandardStyle'.++Custom styles must be instances of some classes. A 'ComparableStyle' to allow the typesetting algorithm to decide when to group+different characters in a span of the same style.++A 'Style' class used for sentence style. And a 'ParagraphStyle' to group together the paragraph style and the sentence+style that can be used in this paragraph.++Why the 'ComparableStyle' is used instead of the class Eq ? A style is containing information +used for the font (size etc ...) but it can also contain additional information used by styling function (a styling+function may draw a decoration). In that latter case, the additional information is changing the look of the sentence+but not its layout : the font size is not changed. So, from a text point of view, the PDF text is drawn using the same+attributes. But the additional decoration on top of it is changing.++So, 'ComparableStyle' is used to compare the font settings of a style.++The 'ParagraphStyle' is used to change the geometry of the paragraph (the paragraph can be typeset using+a circle as shape for instance). This style is also used to style the bounding box.++The other attributes like distance between two lines etc ... are controlled in the typesetting monad.++@+'setParaStyle' (BluePara 0)+'setFirstPassTolerance' 500+'unstyledGlue' 6 0.33 0+'paragraph' $ do+      'txt' $ \"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \"+@++Inside a paragraph, it is possible to change the line style and create new paragraphs:++@+'paragraph' $ do+    'txt' $ \"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor\"+    'setStyle' Bold+    'txt' $ \" incididunt ut labore et dolore magna aliqua. \"+    'forceNewLine'+@++When charts are created, it is often useful to be able to display captions, labels etc ... The position+of the box containing the text is relative to some specific points in the drawing. To ease with this use-case, an+additional function is provided : 'drawTextBox'+-}++{- $monadstyle ++The typesetting is similar to the TeX one with kern, glues and boxes. So, it means that any drawing+can be used as a letter since any drawing can be contained in a box. The operators to draw boxes, glues are+part of the 'MonadStyle' monad. The 'Draw' value can be transformed into a box with 'mkDrawBox'.++The paragraph and the typesetting monad are instances of this class. So, boxes, glues, kerns can be used in horizontal+mode (paragraph) or vertical mode (typesetting monad).++-}++{- $geometry++Building shapes inside the draw monad is easy. For instance:++@+'strokeColor' red+'stroke' $ 'Rectangle' 0 (200 :+ 100)+'fillColor' 'blue'+'fill' $ 'Ellipse' 100 100 300 200+'fillAndStroke' $ 'RoundRectangle' 32 32 200 200 600 400+@++you can also create paths.++In addition to color, other attributes can be changed:++@+'withNewContext' $ do+    'setWidth' 2+    'setDash' $ 'DashPattern' [3] 0+    'stroke' $ 'Rectangle' 0 (200 :+ 100)+@++'withNewContext' is saving and restoring the settings.++Shapes can be filled with shading patterns:++@+'paintWithShading' ('RadialShading' 0 0 50 0 0 600 ('Rgb' 1 0 0) ('Rgb' 0 0 1)) ('addShape' $ 'Rectangle' 0 (300 :+ 300))+'paintWithShading' ('AxialShading' 300 300 600 400 ('Rgb' 1 0 0) ('Rgb' 0 0 1)) ('addShape' $ 'Ellipse' 300 300 600 400)+@++Note that in above example, 'addShape' is used. You can't use 'stroke' or 'fill'. You are just adding a shape to a path.++More complex patterns can also be used to fill the shapes. In below example we are filling shapes with a complex+drawing defined with a 'Draw' monad value.++@+patternTest :: 'PDFReference' 'PDFPage' -> 'PDF' ()+patternTest page = do+     p <- 'createUncoloredTiling' 0 0 100 50 100 50 'ConstantSpacing' pattern+     cp <- 'createColoredTiling' 0 0 100 50 100 50 'ConstantSpacing' cpattern+     'drawWithPage' page $ do+         'strokeColor' 'green'+         'setUncoloredFillPattern' p ('Rgb' 1 0 0)+         'fillAndStroke' $ 'Ellipse' 0 0 300 300+         'setColoredFillPattern' cp+         'fillAndStroke' $ 'Ellipse' 300 300 600 400+         + where +       pattern = do+           'stroke' ('Ellipse' 0 0 100 50)+       'cpattern' = do+           'strokeColor' ('Rgb' 0 0 1)+           'stroke' ('Ellipse' 0 0 100 50) +@+-}++{- $xform++You can share an object between different pages of a document. It helps reducing the size of the+document is the shared drawing is big. An object can be a 'Draw' monad value. But it can be a JPEG picture too.++@+r <- 'createPDFXForm' 0 0 200 200 lineStyle+'drawWithPage' page6 $ do+     'drawXObject' r+@++in the above example, lineStyle is a @Draw()@ value.++-}++{- $image++It is possible to embed JPEG images in the document.++@+testImage ::  'JpegFile' -> 'PDFReference' 'PDFPage' -> 'PDF' ()+testImage jpgf page =  do+    jpg <- 'createPDFJpeg' jpgf+    'drawWithPage' page $ do+      'withNewContext' $ do+          'setFillAlpha' 0.4+          'drawXObject' jpg+      'withNewContext' $ do+           'applyMatrix' $ 'rotate' (Degree 20)+           'applyMatrix' $ 'translate' (200 :+ 200)+           'applyMatrix' $ 'scale' 2 2+           'drawXObject' jpg+@++The 'JpegFile' value must be created in the 'IO' monad with:++@+Right jpg <- 'readJpegFile' \"logo.jpg\"  +@++The haskell code is just extracting the size of the image from the file. The image is not decoded.++-}++{- $annotations ++A pdf page can contain several kind of annotations like links, notes etc ... For instance, to define and+display a link:++@+'newAnnotation' ('URLLink' ('toPDFString' \"Go to my blog\") [0,0,200,100] \"http:\/\/www.alpheccar.org\" True)+@+++-}++{- $warning++The PDF format is full of extensions. Depending on the viewer that you use some extensions may not be supported.+It is always a good thing to test on a few viewers if you use complex features.++Mobile viewers (tablets and phones) are generally focusing on a more portable and more restricted set of features. +So, you may not be able to display you document on a mobile device if you use complex features.++So, I repeat : test.+-}
Graphics/PDF/Draw.hs view
@@ -1,7 +1,13 @@-{-# OPTIONS_GHC -fglasgow-exts #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -240,9 +246,9 @@    -- | Execute the drawing commands to get a new state and an uncompressed PDF stream runDrawing :: Draw a -> DrawEnvironment -> DrawState -> (a,DrawState,BU.Builder)-runDrawing drawing environment state +runDrawing drawing environment drawState      = runST $ do-        dRef <- newSTRef state+        dRef <- newSTRef drawState         bRef <- newSTRef mempty         posRef <- newSTRef 0         let tuple = DrawTuple { drawEnvironment = environment
Graphics/PDF/Hyphenate.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Hyphenate/English.hs view
@@ -1,13 +1,17 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org -- Stability   : experimental -- Portability : portable ----- English rules for hyphenation+-- English rules for hyphenation.+--+--  Extra patterns, from ushyphmax.tex, dated 2005-05-30.+--   Copyright (C) 1990, 2004, 2005 Gerard D.C. Kuiken.+--   See detailed copyright below in this file or in the LICENSE file. --------------------------------------------------------- -- #hide module Graphics.PDF.Hyphenate.English (
Graphics/PDF/Hyphenate/LowLevel.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Image.hs view
@@ -1,6 +1,11 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE ScopedTypeVariables #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -26,7 +31,6 @@ import Graphics.PDF.Draw import Graphics.PDF.Resources import Graphics.PDF.Pages-import Graphics.PDF.Document import qualified Data.ByteString.Lazy as B import Control.Monad.Writer #if __GLASGOW_HASKELL__ >= 608@@ -41,10 +45,6 @@ import Data.Binary.Builder(Builder,fromLazyByteString) import Control.Exception as E -#if __GLASGOW_HASKELL__ >= 610-import Control.OldException(ioErrors)-#endif- m_sof0 :: Int m_sof0 = 0xc0  m_sof1 :: Int @@ -210,7 +210,7 @@     case sof of         a | a `elem` [m_sof5,m_sof6,m_sof7,m_sof9,m_sof10,m_sof11,m_sof13,m_sof14,m_sof15] -> throwError (strMsg "Unuspported compression mode")           | a `elem` [m_sof0,m_sof1,m_sof3] -> do-              readWord16 h+              _ <- readWord16 h               bits_per_component <- readWord8 h               height <- readWord16 h               width <- readWord16 h@@ -257,7 +257,7 @@ -- The read is not lazy. The whole image will be loaded into memory readJpegFile :: FilePath              -> IO (Either String JpegFile)-readJpegFile f = catchJust ioErrors (do+readJpegFile f = (do      r <- liftIO $ withFile f $ \h -> do              runFA (analyzeJpeg h)      case r of@@ -266,7 +266,7 @@                      nb <- hFileSize h'                      B.hGet h' (fromIntegral nb)                  return (Right $ JpegFile bits_per_component width height color_space (fromLazyByteString img))-         Left s -> return $ Left s) (\err -> return $ Left (show err)) +         Left s -> return $ Left s) `E.catch` (\(err :: IOException) -> return $ Left (show err))   -- | Get the JPEG bounds jpegBounds :: JpegFile -> (PDFFloat,PDFFloat)
Graphics/PDF/LowLevel/Serializer.hs view
@@ -1,7 +1,11 @@ {-# OPTIONS_GHC -fno-cse #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE FlexibleInstances #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/LowLevel/Types.hs view
@@ -1,6 +1,12 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -20,7 +26,6 @@ import Data.Word import Data.Binary.Builder(Builder,fromByteString) import Graphics.PDF.LowLevel.Serializer-import Data.Monoid import Data.Complex import qualified Data.ByteString as S #if __GLASGOW_HASKELL__ >= 608
Graphics/PDF/Navigation.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -22,7 +22,6 @@ import Graphics.PDF.Pages import Graphics.PDF.Draw import Graphics.PDF.LowLevel.Types-import Graphics.PDF.Colors(Color(..)) import Control.Monad.State(gets) import Control.Monad(when) import Data.Maybe(isNothing)
Graphics/PDF/Pages.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Pattern.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -31,7 +31,6 @@ import Control.Monad.State import Control.Monad.Writer import Graphics.PDF.LowLevel.Serializer-import Data.Monoid  data PaintType = ColoredTiling                | UncoloredTiling
Graphics/PDF/Resources.hs view
@@ -1,6 +1,8 @@+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE FlexibleInstances #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Shading.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -23,7 +23,6 @@ import Graphics.PDF.Shapes(setAsClipPath) import Control.Monad.Writer import Graphics.PDF.LowLevel.Serializer-import Data.Monoid  -- | Fill clipping region with a shading applyShading :: PDFShading -> Draw ()@@ -41,6 +40,6 @@                  -> Draw () paintWithShading shade d = do     withNewContext $ do-      d+      _ <- d       setAsClipPath       applyShading shade
Graphics/PDF/Shapes.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -55,7 +55,6 @@ import Graphics.PDF.Draw import Control.Monad.Writer import Graphics.PDF.LowLevel.Serializer-import Data.Monoid  class Shape a where     addShape :: a -> Draw ()
Graphics/PDF/Text.hs view
@@ -1,6 +1,10 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveFunctor #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -45,16 +49,13 @@ import Control.Monad.State import Graphics.PDF.Resources import Control.Monad.Writer-import Control.Monad.Trans import qualified Data.Set as Set-import Graphics.PDF.Coordinates import Data.Word import Graphics.PDF.LowLevel.Kern(kerns) import qualified Data.Map as M(findWithDefault) import Data.List(foldl') import Data.Binary.Builder(Builder) import Graphics.PDF.LowLevel.Serializer-import Data.Monoid import qualified Data.ByteString as S #if __GLASGOW_HASKELL__ >= 608 import Data.ByteString.Internal(w2c,c2w)
Graphics/PDF/Typesetting.hs view
@@ -1,6 +1,12 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveFunctor #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org@@ -91,7 +97,6 @@   ) where    import Graphics.PDF.LowLevel.Types-import Graphics.PDF.Text import Graphics.PDF.Draw import Graphics.PDF.Shapes import Graphics.PDF.Coordinates
Graphics/PDF/Typesetting/Box.hs view
@@ -1,6 +1,9 @@+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE FlexibleInstances #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Typesetting/Breaking.hs view
@@ -1,6 +1,9 @@+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE FlexibleInstances #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Typesetting/Horizontal.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006f+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Typesetting/Layout.hs view
@@ -1,6 +1,8 @@+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE FunctionalDependencies #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Typesetting/StandardStyle.hs view
@@ -1,6 +1,7 @@+{-# LANGUAGE MultiParamTypeClasses #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
Graphics/PDF/Typesetting/Vertical.hs view
@@ -1,6 +1,6 @@ --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2006+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org
HPDF.cabal view
@@ -1,16 +1,16 @@ Name: HPDF-Version: 1.4.2+Version: 1.4.3 cabal-version: >=1.6 License: LGPL License-file:LICENSE-Copyright: Copyright (c) 2007-2008, alpheccar+Copyright: Copyright (c) 2007-2012, alpheccar.org category: Graphics synopsis: Generation of PDF documents maintainer: misc@NOSPAMalpheccar.org build-type: Simple-tested-with: GHC==6.8.1, GHC==6.10.1+tested-with: GHC==7.4.2 homepage: http://www.alpheccar.org-description: A PDF library with support for several pages, page transitions, outlines, annotations, compression, colors, shapes, patterns, jpegs, fonts, typesetting ...+description: A PDF library with support for several pages, page transitions, outlines, annotations, compression, colors, shapes, patterns, jpegs, fonts, typesetting ... Have a look at the "Graphics.PDF.Documentation" module to see how to use it. Or, download the package and look at the test.hs file in the Test folder. That file is giving an example of each feature. extra-source-files:   c/ctext.h   c/metrics.h@@ -35,19 +35,6 @@   if impl(ghc >= 6.10)     build-depends: base >= 4   ghc-options: -Wall -funbox-strict-fields  -O2-  extensions: -    FlexibleInstances, -    ForeignFunctionInterface, -    CPP, -    MultiParamTypeClasses, -    BangPatterns, -    ExistentialQuantification, -    ScopedTypeVariables, -    GeneralizedNewtypeDeriving,-    FlexibleContexts,-    EmptyDataDecls,-    TypeSynonymInstances,-    FunctionalDependencies    C-Sources:        c/metrics.c@@ -71,6 +58,7 @@      Graphics.PDF.Shading      Graphics.PDF.Typesetting      Graphics.PDF.Hyphenate+     Graphics.PDF.Documentation   Other-Modules:      Graphics.PDF.LowLevel.Types      Graphics.PDF.Data.PDFTree
LICENSE view
@@ -1,4 +1,4 @@-* Copyright (c) 2007, alpheccar.org+* Copyright (c) 2006-2012, alpheccar.org * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met:
Test/test.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fglasgow-exts #-} --------------------------------------------------------- -- |--- Copyright   : (c) alpha 2007+-- Copyright   : (c) 2006-2012, alpheccar.org -- License     : BSD-style -- -- Maintainer  : misc@NOSPAMalpheccar.org