AddPDFRRasterPageFromString

Compliance, raster exchange, binary input

Description

Adds one full-page PDF/R raster strip from binary bytes and derives the page size from the pixel dimensions and resolution

Syntax

Delphi

Function AddPDFRRasterPageFromString(Const Source: AnsiString; Width, Height, BitsPerComponent, ColorModel, Compression: Integer; HorizontalDPI, VerticalDPI: Double; Rotation: Integer): Integer;

Parameters

SourceRaw packed samples, CCITT Group 4 data or a complete JPEG byte sequence
Width, HeightRaster dimensions in pixels
BitsPerComponent1 for bitonal, 8 or 16 for grayscale and RGB, with JPEG restricted to 8
ColorModelPDFR_COLOR_BITONAL, PDFR_COLOR_GRAY or PDFR_COLOR_RGB
CompressionPDFR_COMPRESSION_RAW, PDFR_COMPRESSION_CCITT_G4 or PDFR_COMPRESSION_JPEG
HorizontalDPI, VerticalDPIPositive pixel resolutions used to derive the MediaBox
Rotation0, 90, 180 or 270

Return value

The one-based page number on success, or 0 with LastErrorCode 607 on invalid input or configuration

Remarks

Call SetPDFRMode before adding raster pages

Raw rows are tightly packed and each row is rounded up to a whole byte; their exact byte length is validated before allocation

CCITT Group 4 input is decoded once to reject malformed T.6 data, then embedded unchanged with /K -1 and BlackIs1 omitted

JPEG dimensions and component count are verified from the encoded header and the DCT sequence is embedded unchanged

See also

AddPDFRRasterPageFromStream, AddPDFRRasterPageFromJPEGFile, GetPDFRDiagnostics