<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="Pdfflate.html"> <link rel="next" href="Pdfwrite.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Pdfutil" rel="Chapter" href="Pdfutil.html"> <link title="Pdfio" rel="Chapter" href="Pdfio.html"> <link title="Pdftransform" rel="Chapter" href="Pdftransform.html"> <link title="Pdfunits" rel="Chapter" href="Pdfunits.html"> <link title="Pdfpaper" rel="Chapter" href="Pdfpaper.html"> <link title="Pdf" rel="Chapter" href="Pdf.html"> <link title="Pdfcrypt" rel="Chapter" href="Pdfcrypt.html"> <link title="Pdfflate" rel="Chapter" href="Pdfflate.html"> <link title="Pdfcodec" rel="Chapter" href="Pdfcodec.html"> <link title="Pdfwrite" rel="Chapter" href="Pdfwrite.html"> <link title="Pdfgenlex" rel="Chapter" href="Pdfgenlex.html"> <link title="Pdfread" rel="Chapter" href="Pdfread.html"> <link title="Pdfjpeg" rel="Chapter" href="Pdfjpeg.html"> <link title="Pdfops" rel="Chapter" href="Pdfops.html"> <link title="Pdfdest" rel="Chapter" href="Pdfdest.html"> <link title="Pdfmarks" rel="Chapter" href="Pdfmarks.html"> <link title="Pdfpagelabels" rel="Chapter" href="Pdfpagelabels.html"> <link title="Pdfpage" rel="Chapter" href="Pdfpage.html"> <link title="Pdfannot" rel="Chapter" href="Pdfannot.html"> <link title="Pdffun" rel="Chapter" href="Pdffun.html"> <link title="Pdfspace" rel="Chapter" href="Pdfspace.html"> <link title="Pdfimage" rel="Chapter" href="Pdfimage.html"> <link title="Pdfafm" rel="Chapter" href="Pdfafm.html"> <link title="Pdfafmdata" rel="Chapter" href="Pdfafmdata.html"> <link title="Pdfglyphlist" rel="Chapter" href="Pdfglyphlist.html"> <link title="Pdftext" rel="Chapter" href="Pdftext.html"> <link title="Pdfstandard14" rel="Chapter" href="Pdfstandard14.html"> <link title="Pdfgraphics" rel="Chapter" href="Pdfgraphics.html"> <link title="Pdfshapes" rel="Chapter" href="Pdfshapes.html"> <link title="Pdfdate" rel="Chapter" href="Pdfdate.html"> <link title="Pdfocg" rel="Chapter" href="Pdfocg.html"> <link title="Pdfcff" rel="Chapter" href="Pdfcff.html"> <link title="Pdftype1" rel="Chapter" href="Pdftype1.html"> <link title="Pdftruetype" rel="Chapter" href="Pdftruetype.html"> <link title="Pdftype0" rel="Chapter" href="Pdftype0.html"> <link title="Pdfmerge" rel="Chapter" href="Pdfmerge.html"><link title="Types" rel="Section" href="#2_Types"> <link title="Encoding" rel="Section" href="#2_Encoding"> <link title="Decoding" rel="Section" href="#2_Decoding"> <title>Pdfcodec</title> </head> <body> <div class="navbar"><a class="pre" href="Pdfflate.html" title="Pdfflate">Previous</a> <a class="up" href="index.html" title="Index">Up</a> <a class="post" href="Pdfwrite.html" title="Pdfwrite">Next</a> </div> <h1>Module <a href="type_Pdfcodec.html">Pdfcodec</a></h1> <pre><span class="keyword">module</span> Pdfcodec: <code class="code">sig</code> <a href="Pdfcodec.html">..</a> <code class="code">end</code></pre><div class="info module top"> Encoding and Decoding PDF Streams<br> </div> <hr width="100%"> <br> <b>Currently supported:</b><ul> <li>Decoders: ASCIIHexDecode, ASCII85Decode, FlateDecode, LZWDecode, RunLengthDecode.</li> <li>Encoders: ASCIIHexDecode, ASCII85Decode, FlateDecode, RunLengthDecode.</li> <li>Predictors: PNG (all), TIFF (8-bit only).</li> </ul> <br> <br> <h2 id="2_Types">Types</h2><br> <pre><code><span id="TYPEencoding"><span class="keyword">type</span> <code class="type"></code>encoding</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTencoding.ASCIIHex"><span class="constructor">ASCIIHex</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTencoding.ASCII85"><span class="constructor">ASCII85</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTencoding.RunLength"><span class="constructor">RunLength</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTencoding.Flate"><span class="constructor">Flate</span></span></code></td> </tr></table> <div class="info "> Supported encodings.<br> </div> <pre><code><span id="TYPEpredictor"><span class="keyword">type</span> <code class="type"></code>predictor</span> = </code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.TIFF2"><span class="constructor">TIFF2</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.PNGNone"><span class="constructor">PNGNone</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.PNGSub"><span class="constructor">PNGSub</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.PNGUp"><span class="constructor">PNGUp</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.PNGAverage"><span class="constructor">PNGAverage</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.PNGPaeth"><span class="constructor">PNGPaeth</span></span></code></td> </tr> <tr> <td align="left" valign="top" > <code><span class="keyword">|</span></code></td> <td align="left" valign="top" > <code><span id="TYPEELTpredictor.PNGOptimum"><span class="constructor">PNGOptimum</span></span></code></td> </tr></table> <div class="info "> Predictors.<br> </div> <pre><span id="EXCEPTIONCouldn'tDecodeStream"><span class="keyword">exception</span> Couldn'tDecodeStream</span> <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info "> There was bad data.<br> </div> <pre><span id="EXCEPTIONDecodeNotSupported"><span class="keyword">exception</span> DecodeNotSupported</span> <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info "> CamlPDF doesn't support this encoding or its predictor.<br> </div> <br> <h2 id="2_Encoding">Encoding</h2><br> <pre><span id="VALencode_pdfstream"><span class="keyword">val</span> encode_pdfstream</span> : <code class="type"><a href="Pdf.html#TYPEt">Pdf.t</a> -><br> <a href="Pdfcodec.html#TYPEencoding">encoding</a> -><br> ?predictor:<a href="Pdfcodec.html#TYPEpredictor">predictor</a> -><br> ?predictor_columns:int -> <a href="Pdf.html#TYPEpdfobject">Pdf.pdfobject</a> -> unit</code></pre><div class="info "> Encode a PDF stream with an encoding. The only predictor supported is PNGUp.<br> </div> <br> <h2 id="2_Decoding">Decoding</h2><br> <pre><span id="VALdecode_pdfstream"><span class="keyword">val</span> decode_pdfstream</span> : <code class="type"><a href="Pdf.html#TYPEt">Pdf.t</a> -> <a href="Pdf.html#TYPEpdfobject">Pdf.pdfobject</a> -> unit</code></pre><div class="info "> Given a document and stream, decode. The pdf document is updated with the decoded stream. May raise either of the exceptions above.<br> </div> <pre><span id="VALdecode_pdfstream_onestage"><span class="keyword">val</span> decode_pdfstream_onestage</span> : <code class="type"><a href="Pdf.html#TYPEt">Pdf.t</a> -> <a href="Pdf.html#TYPEpdfobject">Pdf.pdfobject</a> -> unit</code></pre><div class="info "> Given a document and stream decode just one stage. May raise either of the exceptions above.<br> </div> <pre><span id="VALdecode_pdfstream_until_unknown"><span class="keyword">val</span> decode_pdfstream_until_unknown</span> : <code class="type"><a href="Pdf.html#TYPEt">Pdf.t</a> -> <a href="Pdf.html#TYPEpdfobject">Pdf.pdfobject</a> -> unit</code></pre><div class="info "> Given a document and stream decode until there's an unknown decoder. May raise <code class="code">Couldn'tDecodeStream</code>.<br> </div> <pre><span id="VALdecode_from_input"><span class="keyword">val</span> decode_from_input</span> : <code class="type"><a href="Pdfio.html#TYPEinput">Pdfio.input</a> -> <a href="Pdf.html#TYPEpdfobject">Pdf.pdfobject</a> -> <a href="Pdfio.html#TYPEbytes">Pdfio.bytes</a> option</code></pre><div class="info "> Given a <code class="code">Pdfio.input</code> with pointer at the first byte and an inline image stream dictionary, decode the first decoder and its predictor. Return the data, or <code class="code">None</code> 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.<br> </div> </body></html>