Skip to content

PDF Spec Annex B

Marc Jones edited this page Dec 30, 2025 · 1 revision

Annex B: Operators in Type 4 Functions

Part of: PDF-Spec-Annexes

Navigation: PDF-Spec-Annex-A | PDF-Spec-Index | PDF-Spec-Annex-C


Annex B

(normative)

Operators in Type 4 Functions

int 1 shift bitshift int 2 Perform bitwise shift of int 1 (positive is left)
- true true Return boolean value true
- false false Return boolean value false

B.4 Conditional Operators

bool { expr } if - Execute expr if bool is true
bool { expr } { expr } ifelse Execute expr if bool is true , expr if false

B.5 Stack Operators

any pop - top Discard element
any 1 any 2 exch any 2 any 1 Exchange top two elements
any any 1 … dup copy any n n any any any 1 … any n any 1 … any n top Duplicate top n elements Duplicate element
any n … any n index any n … any any 0 n Duplicate arbitrary element Duplicate arbitrary element Duplicate arbitrary element Duplicate arbitrary element Duplicate arbitrary element Duplicate arbitrary element Duplicate arbitrary element
any n -1 … any 0 roll 0 n j any ( j -1) mod n … any 0 any n -1 … any j mod n Roll n elements up j times

C.1 General

In general, PDF does not restrict the size or quantity of things described in the file format, such as numbers, arrays, images, and so on. However, a conforming reader running on a particular processor and in a particular operating environment does have such limits. If a conforming reader encounters a PDF construct that exceeds one of these limits or performs a computation whose intermediate results exceed a limit, an error occurs.

  • NOTE PostScript interpreters also have implementation limits, listed in Appendix B of the PostScript Language Reference , Third Edition. It is possible to construct a PDF file that does not violate PDF implementation limits but fails to print on a PostScript printer. Keep in mind that these limits vary according to the PostScript LanguageLevel, interpreter version, and the amount of memory available to the interpreter.

This annex describes typical limits for a conforming PDF application (readers and writers). These limits fall into two main classes:

  • Architectural limits . The hardware on which a conforming reader executes imposes certain constraints. For example, an integer is usually represented in 32 bits, limiting the range of allowed integers. In addition, the design of the software imposes other constraints, such as a limit to the number of elements in an array or string.
  • Memory limits . The amount of memory available to a conforming reader limits the number of memoryconsuming objects that can be held simultaneously.

C.2 Architectural limits

PDF itself has one architectural limit: Because a cross-reference table (see 7.5.4, "Cross-Reference Table") allocates ten digits to represent byte offsets, the size of a file shall be limited to 10 10 bytes (approximately 10 gigabytes). This limit does not apply in a PDF file that uses a cross-reference stream (see 7.5.8, "CrossReference Streams") instead of a cross reference table.

Table C.1 describes the minimum architectural limits that should be accommodated by conforming readers running on 32-bit machines. Because conforming readers may be subject to these limits, conforming writers producing PDF files should remain within them.

NOTE Memory limits are often exceeded before architectural limits (such as the limit on the number of indirect objects) are reached.

Table C.1 - Architectural limits

Quantity Limit Description
integer 2,147,483,647 Largest integer value; equal to 2 31 - 1.
-2,147,483,648 Smallest integer value; equal to - 2 31 .
real ± 3.403 × 10 38 Largest and smallest real values (approximate).
± 1.175 × 10 -38 Nonzero real values closest to 0 (approximate). Values closer than these are automatically converted to 0.

Navigation: PDF-Spec-Annex-A | PDF-Spec-Index | PDF-Spec-Annex-C

Clone this wiki locally