module Pdfcodec: sig
.. end
Encoding and Decoding PDF Streams
Currently supported:
- Decoders: ASCIIHexDecode, ASCII85Decode, FlateDecode,
LZWDecode, RunLengthDecode.
- Encoders: ASCIIHexDecode, ASCII85Decode, FlateDecode, RunLengthDecode.
- Predictors: PNG (all), TIFF (8-bit only).
Currently supported:
- Decoders: ASCIIHexDecode, ASCII85Decode, FlateDecode,
LZWDecode, RunLengthDecode.
- Encoders: ASCIIHexDecode, ASCII85Decode, FlateDecode, RunLengthDecode.
- Predictors: PNG (all), TIFF (8-bit only).
Types
type
encoding =
| |
ASCIIHex |
| |
ASCII85 |
| |
RunLength |
| |
Flate |
Supported encodings.
type
predictor =
| |
TIFF2 |
| |
PNGNone |
| |
PNGSub |
| |
PNGUp |
| |
PNGAverage |
| |
PNGPaeth |
| |
PNGOptimum |
Predictors.
exception Couldn'tDecodeStream of string
There was bad data.
exception DecodeNotSupported of string
CamlPDF doesn't support this encoding or its predictor.
Encoding
val encode_pdfstream : Pdf.t ->
encoding ->
?predictor:predictor ->
?predictor_columns:int -> Pdf.pdfobject -> unit
Encode a PDF stream with an encoding. The only predictor supported is PNGUp.
Decoding
val decode_pdfstream : Pdf.t -> Pdf.pdfobject -> unit
Given a document and stream, decode. The pdf document is updated
with the decoded stream. May raise either of the exceptions above.
val decode_pdfstream_onestage : Pdf.t -> Pdf.pdfobject -> unit
Given a document and stream decode just one stage. May raise either of the
exceptions above.
val decode_pdfstream_until_unknown : Pdf.t -> Pdf.pdfobject -> unit
Given a document and stream decode until there's an unknown decoder. May
raise Couldn'tDecodeStream
.
val decode_from_input : Pdfio.input -> Pdf.pdfobject -> Pdfio.bytes option
Given a Pdfio.input
with pointer at the first byte and an inline image
stream dictionary, decode the first decoder and its predictor. Return the data,
or None
if this decoder isn't supported but the data pointer has been left in
the right place. The exceptions above can both be raised, in the case of bad
data or a completely unknown encoding.