Start adapting the code to make use of the new PDF.Box class type
This commit is contained in:
parent
7f889cf168
commit
308cfd4cbe
2 changed files with 9 additions and 10 deletions
|
@ -24,7 +24,9 @@ executable reveal
|
|||
build-depends: base >=4.9.1 && <4.13
|
||||
, bytestring
|
||||
, containers
|
||||
, mtl
|
||||
, Hufflepdf >= 0.2.0
|
||||
, zlib
|
||||
hs-source-dirs: src
|
||||
ghc-options: -Wall
|
||||
default-language: Haskell2010
|
||||
|
|
17
src/Main.hs
17
src/Main.hs
|
@ -3,6 +3,7 @@
|
|||
module Main where
|
||||
|
||||
import Codec.Compression.Zlib (compress, decompress)
|
||||
import Control.Monad.State (execState)
|
||||
import Data.ByteString.Char8 (ByteString)
|
||||
import qualified Data.ByteString.Char8 as BS (
|
||||
length, readFile
|
||||
|
@ -11,8 +12,10 @@ import qualified Data.ByteString.Lazy.Char8 as Lazy (
|
|||
fromStrict, intercalate, split, toStrict, writeFile
|
||||
)
|
||||
import qualified Data.Map as Map (insert, lookup)
|
||||
import PDF (Document(..), parseDocument, render)
|
||||
import PDF.Object (Content(..), DirectObject(..), Object(..), Name(..), Number(..))
|
||||
import PDF (Document(..), UnifiedLayers(..), parseDocument, render)
|
||||
import PDF.Box ((.@), modifyAt)
|
||||
import PDF.Layer (AllObjects(..))
|
||||
import PDF.Object (DirectObject(..), Object(..), Name(..), Number(..))
|
||||
import PDF.TextRendering (TextRendering(..), update)
|
||||
import Prelude hiding (lines, unlines)
|
||||
import System.Environment (getArgs)
|
||||
|
@ -40,15 +43,9 @@ revealObject obj@(Stream {header, streamContent}) =
|
|||
_ -> obj
|
||||
revealObject obj = obj
|
||||
|
||||
revealContent :: Content -> Content
|
||||
revealContent content = content {
|
||||
objects = revealObject <$> (objects content)
|
||||
}
|
||||
|
||||
reveal :: Document -> Document
|
||||
reveal document = document {
|
||||
updates = revealContent <$> (updates document)
|
||||
}
|
||||
reveal = execState $ do
|
||||
modifyAt (UnifiedLayers .@ AllObjects) (return . fmap revealObject)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
|
Loading…
Reference in a new issue