From Wikitech

PDF is handled by our custom Ghostscript engine. It handles multipage support via the custom "page" filter, which simply exposes the page URL parameter to the engine. It attempts to render the requested page and if that fails (eg. the requested page is out of bounds), it defaults to the first page.

The page is extracted as a high quality JPEG and passed to our default custom Imagemagick engine for actual resizing.