HPDFEncodePredictor Function
Encodes complete raster rows with the PDF TIFF or PNG predictor transforms before Flate or LZW compression
Declaration
function HPDFEncodePredictor(const Data: AnsiString; Predictor, Colors,
BitsPerComponent, Columns: Integer; MaxOutputBytes: Int64= 0): AnsiString;
Unit
HPDFPredictor
Parameters
| Name | Purpose |
|---|---|
Data | Unfiltered rows packed in PDF sample order |
Predictor | 1 for identity, 2 for TIFF horizontal differencing, 10 through 14 for fixed PNG filters, or 15 for adaptive per-row PNG selection |
Colors | Number of color components per pixel |
BitsPerComponent | Sample width of 1, 2, 4, 8, or 16 bits |
Columns | Pixel count in each complete input row |
MaxOutputBytes | Optional hard output ceiling, or zero for no explicit ceiling |
Return value
Returns predictor-encoded bytes ready for a matching compression filter
Usage notes
- The input length must be an exact multiple of the calculated row size
- TIFF encoding supports packed and 16-bit samples and preserves unused row padding bits
- PNG predictor
15scores None, Sub, Up, Average, and Paeth for every row and emits the smallest residual score HPDFTryEncodePredictorreturns an error message instead of raisingEHPDFPredictorError- Use the same predictor geometry in the stream
/DecodeParmsdictionary
Example
Predicted := HPDFEncodePredictor(Raster, 15, 3, 8, Width);
Decoded := HPDFDecodePredictor(Predicted, 15, 3, 8, Width);