A PDF can contain both. Text, lines, and geometric shapes are vector objects — drawn from mathematical descriptions, so a 10× zoom renders them perfectly and they print razor-sharp. Photos and scans are raster images — grids of colored pixels with a fixed resolution.
The distinction drives everyday PDF outcomes: compressing a text-heavy page barely shrinks it (vector text recompresses losslessly), while photo-heavy pages shrink dramatically (images are resampled). Converting a PDF to JPG rasterizes everything — fine for sharing, fatal for future text editing.
When a tool claims "vector cropping" or "vector output," it means the operation preserves the mathematical objects instead of taking a pixel snapshot — which is why barcodes stay scannable and text stays selectable.