PNG and JPEG store the same planned page pixel grid in different ways. PageRaster paints the PDF page onto an opaque white Canvas first, then asks the browser for PNG or JPEG bytes and verifies their signature and decoded dimensions. The format choice does not change the selected PDF page or planned width and height.
Choose PNG for crisp flat graphics
PNG uses lossless image compression, so repeated decoding does not add JPEG block or ringing artifacts. It is often useful for slides, diagrams, interface captures, small text and pages with large areas of flat colour. PageRaster still flattens transparency onto white because the visible PDF page has a composed background. A PNG can be larger than JPEG, and lossless encoding does not mean the raster preserves vector paths, selectable text, embedded colour profiles or the PDF’s semantics.
Choose JPEG for photographic pages
JPEG can reduce bytes for photographs, scans and textured pages by discarding detail. PageRaster exposes only 0.70, 0.85 and 0.95 quality so the encoder choice is explicit. Quality 0.85 is a reasonable comparison point, not a universal optimum: small text, sharp edges and gradients can reveal compression. Render a representative page at the same PPI in both formats, compare visible artifacts and file bytes, and keep the format that satisfies the actual destination.
Verify the downloaded pixels
Open every downloaded PNG or JPEG in the application that will use it, confirm the page number and measured width and height, and compare visible text, fonts, colours, transparency and annotations with the authoritative PDF. Keep the PDF as the source. Raster output is a browser-rendered snapshot, not proof of vector, print, archival, accessibility, legal or semantic equivalence.