File: pdfwrite.mli

package info (click to toggle)
camlpdf 2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,272 kB
  • sloc: ml: 20,816; ansic: 9,525; makefile: 100; sh: 23
file content (75 lines) | stat: -rw-r--r-- 2,645 bytes parent folder | download | duplicates (2)
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
72
73
74
75
(** Writing PDF Files *)

(** When set to [true], various pieces of information are printed to standard
output when a PDF is written. On library startup, is [false]. *)
val write_debug : bool ref

(** {2 Encryption methods} *)

(** Encryption methods. The boolean for [AES128bit], [AES256bit] and
[AES256BitISO] indicates encryption of metadata or lack thereof.
AlreadyEncrypted is used as a flag to prevent garbage collection internally by
[pdf_to_file_recrypting]. *)
type encryption_method =
  | PDF40bit
  | PDF128bit
  | AES128bit of bool
  | AES256bit of bool
  | AES256bitISO of bool
  | AlreadyEncrypted

(** The type of an encryption with certain user permissions. *)
type encryption = 
  {encryption_method : encryption_method;
   owner_password : string;
   user_password : string;
   permissions : Pdfcrypt.permission list}

(** {2 Writing to outputs, channels and files.} *)

(** Write a PDF document to an [Pdfio.output], optionally encrypting. If
[?preserve_objstm] is set (default is false), object streams which were in the
original file will be preserved. If [?create_objstm] is set (default is false),
additional new object streams will be created. To re-encrypt the file using its
existing encryption, provide the user or owner password in the [?recrypt]
argument. *)
val pdf_to_output :
  ?preserve_objstm:bool ->
  ?generate_objstm:bool ->
  ?compress_objstm:bool ->
  ?recrypt:string option ->
  encryption option -> bool -> Pdf.t -> Pdfio.output -> unit

(** As [pdf_to_output] but to an OCaml channel. If the second boolean is set, build a new
/ID (don't set this for encrypted documents). *)
val pdf_to_channel :
  ?preserve_objstm:bool ->
  ?generate_objstm:bool ->
  ?compress_objstm:bool ->
  ?recrypt:string option -> 
  encryption option -> bool -> Pdf.t -> out_channel -> unit

(** As [pdf_to_channel] but to a named file. *)
val pdf_to_file_options :
  ?preserve_objstm:bool ->
  ?generate_objstm:bool ->
  ?compress_objstm:bool ->
  ?recrypt:string option ->
  encryption option -> bool -> Pdf.t -> string -> unit

(** Simple write to given file name. Equivalent to [pdf_to_file_options false None true] *)
val pdf_to_file : Pdf.t -> string -> unit

(** {2 String of a PDF object} *)

(** Calculate a string of a pdf object. *)
val string_of_pdf : Pdf.pdfobject -> string

(** Calculate a string of a pdf object, but include binary data too. *)
val string_of_pdf_including_data : Pdf.pdfobject -> string

(** For debug, print out the PDFs objects to standard output. *)
val debug_whole_pdf : Pdf.t -> unit

(** Convert a PDF string to Hex PDF string representation *)
val make_hex_pdf_string : string -> string