The logo works for Confluence 2.5.8, but it does not work for 2.7.1 and above.
The relevant code that stopped working is in the page header and is as follows:
<fo:external-graphic
src="$baseUrl/download/userResources/$generalUtil.escapeXml($page.space.key)/logo"
height="1.5cm"
/>
I am quite sure that src url address is processed correctly (the rendered value can be pasted into a browser and the logo appears), but the image still does not render in the final PDF output.