package camlpdf

  1. Overview
  2. Docs

Parsing PDF Graphics Streams

type t =
  1. | Op_w of float
  2. | Op_J of int
  3. | Op_j of int
  4. | Op_M of float
  5. | Op_d of float list * float
  6. | Op_ri of string
  7. | Op_i of int
  8. | Op_gs of string
  9. | Op_q
  10. | Op_Q
  11. | Op_cm of Pdftransform.transform_matrix
  12. | Op_m of float * float
  13. | Op_l of float * float
  14. | Op_c of float * float * float * float * float * float
  15. | Op_v of float * float * float * float
  16. | Op_y of float * float * float * float
  17. | Op_h
  18. | Op_re of float * float * float * float
  19. | Op_S
  20. | Op_s
  21. | Op_f
  22. | Op_F
  23. | Op_f'
  24. | Op_B
  25. | Op_B'
  26. | Op_b
  27. | Op_b'
  28. | Op_n
  29. | Op_W
  30. | Op_W'
  31. | Op_BT
  32. | Op_ET
  33. | Op_Tc of float
  34. | Op_Tw of float
  35. | Op_Tz of float
  36. | Op_TL of float
  37. | Op_Tf of string * float
  38. | Op_Tr of int
  39. | Op_Ts of float
  40. | Op_Td of float * float
  41. | Op_TD of float * float
  42. | Op_Tm of Pdftransform.transform_matrix
  43. | Op_T'
  44. | Op_Tj of string
  45. | Op_TJ of Pdf.pdfobject
  46. | Op_' of string
  47. | Op_'' of float * float * string
  48. | Op_d0 of float * float
  49. | Op_d1 of float * float * float * float * float * float
  50. | Op_CS of string
  51. | Op_cs of string
  52. | Op_SC of float list
  53. | Op_sc of float list
  54. | Op_SCN of float list
  55. | Op_scn of float list
  56. | Op_SCNName of string * float list
  57. | Op_scnName of string * float list
  58. | Op_G of float
  59. | Op_g of float
  60. | Op_RG of float * float * float
  61. | Op_rg of float * float * float
  62. | Op_K of float * float * float * float
  63. | Op_k of float * float * float * float
  64. | Op_sh of string
  65. | InlineImage of Pdf.pdfobject * Pdf.pdfobject option * Pdfio.bytes
  66. | Op_Do of string
  67. | Op_MP of string
  68. | Op_DP of string * Pdf.pdfobject
  69. | Op_BMC of string
  70. | Op_BDC of string * Pdf.pdfobject
  71. | Op_EMC
  72. | Op_BX
  73. | Op_EX
  74. | Op_Unknown of string

A flat representation of the PDF graphics stream operators. Where the operator contains the asterisk character (not allowable in OCaml syntax), a prime is substituted.

val parse_single_stream : Pdf.t -> Pdf.pdfobject -> Pdfio.bytes -> t list

Parse a single byte streams to an operator list given a document and resource dictionary.

val parse_stream : Pdf.t -> Pdf.pdfobject -> Pdfio.bytes list -> t list

Parse a list of byte streams to an operator list given a document and resource dictionary.

val concat_bytess : Pdfio.bytes list -> Pdfio.bytes

Concatenate a list bytes, padding with whitespace between.

val parse_operators : Pdf.t -> Pdf.pdfobject -> Pdf.pdfobject list -> t list

Given a pdf document, resource dictionary and list of streams representing the graphics content (PDF allows a single page's graphics content to be split over several streams), return a list of operators. Raises PDFError on bad content.

val stream_of_ops : t list -> Pdf.pdfobject

Flatten a list of operators to an uncompressed PDF stream.

val string_of_op : t -> string

Make a string of a single operator (for debug purposes).

val string_of_ops : t list -> string

Same as string_of_op, but of several operators (for debug purposes).

val components : Pdf.t -> Pdf.pdfobject -> Pdf.pdfobject -> int

Given a pdf, a resources dictionary and a colourspace dictionary, give the number of bytes per pixel in the stored image data.

val debug : bool ref

When this reference is set, some debug information is printed to Standard Output.

OCaml

Innovation. Community. Security.