forked from johnwhitington/camlpdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdfcodec.mli
74 lines (52 loc) · 2.01 KB
/
pdfcodec.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(** Encoding and Decoding PDF Streams *)
(**
{b Currently supported:}
- Decoders: ASCIIHexDecode, ASCII85Decode, FlateDecode,
LZWDecode, RunLengthDecode.
- Encoders: ASCIIHexDecode, ASCII85Decode, FlateDecode, RunLengthDecode.
- Predictors: PNG (all), TIFF (8-bit only).
*)
(** {2 Types} *)
(** Supported encodings. *)
type encoding =
| ASCIIHex
| ASCII85
| RunLength
| Flate
(** Predictors. *)
type predictor =
TIFF2
| PNGNone
| PNGSub
| PNGUp
| PNGAverage
| PNGPaeth
| PNGOptimum
(** There was bad data. *)
exception Couldn'tDecodeStream of string
(** CamlPDF doesn't support this encoding or its predictor. *)
exception DecodeNotSupported of string
(** {2 Encoding} *)
(** Encode a PDF stream with an encoding. The only predictor supported is PNGUp. *)
val encode_pdfstream : Pdf.t -> encoding -> ?predictor:predictor -> ?predictor_columns:int -> Pdf.pdfobject -> unit
(** {2 Decoding} *)
(** 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 : Pdf.t -> Pdf.pdfobject -> unit
(** Given a document and stream decode just one stage. May raise either of the
exceptions above. *)
val decode_pdfstream_onestage : Pdf.t -> Pdf.pdfobject -> unit
(** Given a document and stream decode until there's an unknown decoder. May
raise [Couldn'tDecodeStream]. *)
val decode_pdfstream_until_unknown : Pdf.t -> Pdf.pdfobject -> unit
(** 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. *)
val decode_from_input : Pdfio.input -> Pdf.pdfobject -> Pdfio.bytes option
(**/**)
(* Inter-module recursion. *)
val string_of_pdf : (Pdf.pdfobject -> string) ref
val flate_level : int ref
val encode_flate : Pdfio.bytes -> Pdfio.bytes