!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN O P Q R S T U V WXYZ[\]^_ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { |}~NoneIn pdf file EOL could be "\n", "\r" or "\n\r" +Also space (0x20) is usually ok before EOL None Random access Input Stream Internal state of  Sequential input stream Seek the stream Create RIS from  with the specified chunk size Create RIS from  with default chunk size Number of bytes in the stream Current position in bytes :Get sequential input stream, that is valid until the next         None Any pdf object It is parameterized by  content 7Object reference, contains object index and generation )Contains stream dictionary and a payload =The payload could be offset within pdf file, actual content,  content stream or nothing Sequence of zero or more bytes 4Represents both the literal and hexadecimal strings " An array $ Set of key/ value pairs &/Names usually are used as keys in dictionaries They starts with '/', but we strip it out, see  ("true" or "false" *Integer or real  !"#$%&'()*+, !"#$%&'()*+,*,+()&'$%"# !   !"#$%&'()*,+None-Build indirect object .Render inline object (without "obj/endobj").  It is  to supply , because it could not 5 be inlined, but should always be an indirect object -./0123456 -./0123456 -.0123456/ -./0123456None7 The monad 8Execute writer action 95Write PDF header. Used for generating new PDF files. ; Should be the first call. Not used fo incremental updates : Write object ;Delete object <+Write xref table. Should be the last call. . Used for generating and incremental updates. 78streams to write to action to run 9:;<8size of the original PDF file. Should be 0 for new file trailer 789:;<789:;<789:;<None =5parseOnly parseDict "<</Key1(some string)/Key2 123>>"XRight (Dict [(Name "Key1",OStr (Str "some string")),(Name "Key2",ONumber (NumInt 123))])>,parseOnly parseArray "[1 (string) /Name []]"\Right (Array [ONumber (NumInt 1),OStr (Str "string"),OName (Name "Name"),OArray (Array [])])?parseOnly parseNumber "123"Right (NumInt 123)parseOnly parseNumber "12.3"Right (NumReal 12.3)parseOnly parseNumber ".01"Right (NumReal 1.0e-2)@parseOnly parseStr "(hello)"Right (Str "hello")A$parseOnly parseHexStr "<68656C6C6F>"Right (Str "hello")BparseOnly parseRef "0 2 R"Right (Ref 0 2)CparseOnly parseName "/Name"Right (Name "Name")D$Whether the character can appear in & EparseOnly parseBoolean "true"Right (Boolean True)parseOnly parseBoolean "false"Right (Boolean False)FConsumes input till stream's data Use = then F : to determine whether the object is dictionary or stream.  If F! fails, then it is a dictionary. < Otherwise it is stream, and current position in input data  will point to stream' s data start iparse (parseDict >>= \dict -> parseTillStreamData >> return dict) "<</Key 123>>\nstream\n1234\nendstream"?Done "1234\nendstream" Dict [(Name "Key",ONumber (NumInt 123))]GIt parses any  except   cos for  we need offset of data in file parseOnly parseObject "/Name"Right (OName (Name "Name"))H*Parse object. Input position should point  to offset defined in XRef +parseOnly parseIndirectObject "1 2 obj\n12"#Right (Ref 1 2,ONumber (NumInt 12)) =>?@ABCDEFGH =>?@ABCDEFGH G=>C@AB?EFHD =>?@ABCDEFGHNoneI#Offset of the very last xref table ?Before calling it, make sure your are currently somewhere near ; the end of pdf file. Otherwice it can eat all the memory.  E.g. examine only the last 1KB TparseOnly startXRef "anything...startxref\n222\n%%EOF...blah\nstartxref\n123\n%%EOF" Right 123J2When current input position points to xref stream  (or doesn'/t point to xref at all), the parser will fail. 7 When it points to xref table, the parser will succeed < and input position will point to the first xref subsection parseOnly tableXRef "xref\n"Right ()parseOnly tableXRef "not xref"Left "Failed reading: takeWith"KKParse subsection header, return (the first object index, number of object) .Input position will point to the first object L'Parse trailer located after XRef table #Input position should point to the "trailer" keyword MSParse XRef table entry. Returns offset, generation and whether the object is free. IJKLMIJKLMIJKLMIJKLM  Safe-InferredN!API uses this for error handling OErrors PSomething unexpected S Parser error T Wrap any O into Q 7Usefull when you want to add high-level description to ' error, returned by low-level function UT with fliped arguments V&Catch exception if any and convert to  NOPQRSTUV      !"#$%&'()*+,-./0123456789:;<NOPQRSTUV OSRQPNTUVNOSRQPTUVNoneWTotal number of bytes in  XChange input position in  YCurrent input position Z Parse from   [+Convert random access stream to sequential \See = ]See > ^Same as ], but ignores the result WXYZ[\]^ WXYZ[\]^  WXYZ[\]^WXYZ[\]^ None_DException that should be thrown by the decoder in case of any error C User code could catch it when reading from decoded stream content aStream filter cas "Filter" key value in stream dictionary d,decode params -> content -> decoded content _`abcd?_`abcdabcd_`_`abcd? NoneeAllows you to cast  to specific type u&Apply function to all stream contents efghijklmnopqrstu@ABCDEFefghijklmnopqrstuefmnopsqrtughjiklefghijklmnopqrstu@ABCDEF NonevAVary basic implementation. Only PNG-UP prediction is implemented GPGN-UP prediction !TODO: Hacky solution, rewrite it vHIJGvvvHIJG Nonew.All stream filters implemented by the toolbox .Right now it contains only FlateDecode filter xRaw content of stream.  Filters are not applyed The   is valid only until the next X Note: "Length"( could be an indirect object, but we don't want D to read indirect objects here. So we require length to be provided yDecoded stream content The   is valid only until the next X Note: "Length"* could be an indirect object, that is why  we cann't read it ourself zRead  at the current position in the  {Decode stream content The   is valid only until the next  operation wx(random access input stream to read from stream length #stream object to read content for. & The payload is offset of stream data resulting stream object y!random input stream to read from stream filters  decryptor stream length stream with offset z{Kawxyz{awxyz{wxyz{KNone|Cross reference }&Offset and stream with content offset ~Offset Entry in cross reference  Entry in cross reference stream BObject number of object stream and index within the object stream CObject offset (in bytes from the beginning of file) and generation Object number and generation Entry in cross reference table Find the last cross reference %Check whether the stream starts with "xref" keyword.  The keyword iyself is consumed Find prev cross reference Read trailer for the xref 8Read xref entry for the indirect object from xref table 6RIS position should point to the begining of the next  line after "xref" keyword 9Read xref entry for the indirect object from xref stream /See pdf1.7 spec: 7.5.8 Cross-Reference Streams |}~LMNOPinput stream to read from indirect object to look for decoded xref stream content indirect object |}~|~}|~}LMNOPNone-Read indirect object at the specified offset Read object from object stream input stream to read from object offset object generation $input object stream decoded content an offset of the first object ("First" key in dictionary) object number to read None      !"#$%&'()*+,-./0123456789:;<  !"#$%&'()*+,-./0123456789:;<NOPQRSTUVWXYZ[\]^aefghijklmnopqrstuwxyz{|}~Q !"#$%&'()*+,-..//001122334456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW X Y Z [ \ ] ^ _ ` !a"bcd e e f f g h i j k l m n o p q r s t u v w x y z { | } ~ B\      !"#$%&'()*+,-./0122344565758595:5;5<5=5>5?5@5A5B5C5C5D5E5EFGbFGc H I J K L M N O P Q R S TUVWXYZpdf-toolbox-core-0.0.2.0Pdf.Toolbox.Core.IOPdf.Toolbox.Core.Parsers.UtilPdf.Toolbox.Core.IO.RISPdf.Toolbox.Core.Object.TypesPdf.Toolbox.Core.Object.BuilderPdf.Toolbox.Core.WriterPdf.Toolbox.Core.Parsers.ObjectPdf.Toolbox.Core.Parsers.XRefPdf.Toolbox.Core.Error#Pdf.Toolbox.Core.Stream.Filter.TypePdf.Toolbox.Core.Object.Util*Pdf.Toolbox.Core.Stream.Filter.FlateDecodePdf.Toolbox.Core.StreamPdf.Toolbox.Core.XRefPdf.Toolbox.Core.Util parseNamePdf.Toolbox.Coretransformers-0.3.0.0Control.Monad.IO.ClassliftIO endOfLineRISRIS'risSeekrisInputStreamrisPosrisSizeISseek fromHandle' fromHandlesizetell inputStreamMonadIOObjectONullORefOStreamOStrOArrayODictONameOBooleanONumberRefStreamStrArrayDictNameBooleanNumberNumRealNumIntbuildIndirectObject buildObject buildStream buildNumber buildBoolean buildName buildDict buildArraybuildStrbuildRef PdfWriter runPdfWriterwritePdfHeader writeObject deleteObjectwriteXRefTable parseDict parseArray parseNumberparseStr parseHexStrparseRef isRegularChar parseBooleanparseTillStreamData parseObjectparseIndirectObject startXRef tableXRefparseSubsectionHeaderparseTrailerAfterTableparseTableEntryPdfEPdfErrorUnexpectedErrorAnnotatedErrorIOError ParseError annotateErrorannotatingErrortryPdfIOparse takeBytes readExactly dropExactlyDecodeException StreamFilter filterName filterDecode FromObject fromObject lookupDict lookupDict'deleteValueForKeysetValueForKeyintValue realValuetoNumber toBooleantoNametoDicttoStrtoReftoArraytoStream mapObject flateDecode knownFiltersrawStreamContentdecodedStreamContent readStream decodeStreamXRef XRefStream XRefTable XRefEntryXRefStreamEntryXRefTableEntry StreamEntryStreamEntryCompressedStreamEntryUsedStreamEntryFree TableEntryteOffsetteGenteIsFreelastXRefisTableprevXReftrailerlookupTableEntrylookupStreamEntryreadObjectAtOffsetreadCompressedObjectbaseGHC.IO.Handle.TypesHandle $fIsStringStr$fIsStringNameGHC.Errerror intercalatePdfStatestOutput stObjectsstCountstOffsetElem elemIndexelemGen elemOffsetelemFree countWrittenaddElem dumpObjectbuildXRefTablebuildXRefSection buildFixed $fOrdElem$fEqElemparseKeyGHC.IO.Exception Data.EitherpartitionEithersrightsleftseither Data.MaybemapMaybe catMaybes listToMaybe maybeToList fromMaybe isNothingisJustmaybe either-4.0Control.Monad.Trans.Either hoistEither mapEitherT bimapEitherTrightlefteitherT runEitherTEitherTControl.Monad.Trans.Maybe liftCallCC liftCatch liftListenliftPass mapMaybeTMaybeT runMaybeT safe-0.3.3SafetailDeftailMaytailSafeinitDefinitMayinitSafeheadDefheadMaylastDeflastMay minimumDef minimumMay maximumDef maximumMay foldr1Def foldr1May foldl1Def' foldl1May' fromJustDefatDefatMayreadDefreadMay lookupJustDef findJustDef errors-1.4.3Control.Error.SaferightZjustZassertZreadZatZfoldl1Z'foldl1Zfoldr1ZmaximumZminimumZlastZheadZinitZtailZtryRighttryJust tryAsserttryReadtryAt tryFoldl1' tryFoldl1 tryFoldr1 tryMaximum tryMinimumtryLasttryHeadtryInittryTailjustErr assertErrreadErratErr foldl1Err' foldl1Err foldr1Err maximumErr minimumErrlastErrheadErrinitErrtailErrrightMay assertMayControl.Error.ScriptscriptIO runScriptScriptControl.Error.UtilsyncIOtryIOerrLnerrfmapRTfmapRisRightisLeftnothingjustmaybeT!??? hoistMaybenoteTnotehushThushrunAllEAllErunAnyEAnyE Data.EitherRflipETfmapLThandleTcatchTthrowTsucceedTflipEfmapLhandleEcatchEthrowEsucceed runEitherREitherR runEitherRTEitherRTio-streams-1.1.2.0System.IO.Streams.ByteString$fExceptionDecodeException$fFromObjectArray$fFromObjectRef$fFromObjectStr$fFromObjectDict$fFromObjectName$fFromObjectBoolean$fFromObjectNumber unpredict12catchZlibExceptionsdecode unpredictbuildFilterListreadXRef skipTablesubsectionHeadernextSubsectionHeaderskipSubsection