Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parsers for XRef
Documentation
startXRef :: Parser Int64 Source #
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
>>>
parseOnly startXRef "anything...startxref\n222\n%%EOF...blah\nstartxref\n123\n%%EOF"
Right 123
tableXRef :: Parser () Source #
When current input position points to xref stream (or doesn't point to xref at all), the parser will fail. 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"
parseSubsectionHeader :: Parser (Int, Int) Source #
Parse subsection header, return (the first object index, number of object)
Input position will point to the first object
parseTrailerAfterTable :: Parser Dict Source #
Parse trailer located after XRef table
Input position should point to the "trailer" keyword