PDF guides

Decode a PDF stream by object number

·

A PDF stream can store drawing instructions, image samples or arbitrary bytes. Its filter chain tells a reader which decoding steps to apply and in what order.

PDF Stream Decoder

Read object 4 in the example

Choose Load example and select stream object 4 0. Its 50 stored bytes use ASCII85Decode followed by FlateDecode. ASCII85 recovers the compressed bytes, then Flate expands those bytes into drawing instructions.

Choose Decode stream. The text preview includes 0 0 1 rg and 12 14 36 27 re f. These instructions select a blue fill and draw a rectangle. Download the decoded bytes when you want to inspect the complete sequence separately.

Download the numbered PDF stream exampleISO 32000-1, section 7.4 PDF stream filters

Compare stored text with decoded binary

Select object 5 0 and choose Decode stream. Its hexadecimal preview reads 00 7f ff a0. The final single A in the stored ASCIIHex text is interpreted as the high half of A0.

Save the decoded bytes. Use Read stored bytes on the same stream to see its 12-byte encoded text. The download matches the currently chosen byte sequence.

Download the numbered PDF stream exampleISO 32000-1, section 7.4 PDF stream filters

Check limits before working with other streams

Object 6 0 uses LZW and decodes to 1,700 bytes. Object 8 0 uses DCTDecode, which remains available as stored JPEG bytes.

Object 9 0 exceeds the decoded size limit. The tool stops a filter stage when its output would cross 4 MB. Keep a binary download as data until you decide how to open it.

Download the numbered PDF stream exampleISO 32000-1, section 7.4 PDF stream filters

Common questions

Is 4 0 a page number?

It denotes object 4, generation 0. A single page can use several streams. Other streams can belong to fonts, forms or cross-reference data.

Why is the preview shorter than the saved file?

The preview shows at most 4,096 bytes. The binary download contains the complete stored or decoded sequence within the selected limit.

Sources

Put it into practice.

Related guides